#help-development
1 messages · Page 650 of 1
How so?
what why? It's so damn annoying to extrapolate from the InventoryEvents
how can i replace the current item meta with another item meta?
in the first case, it opens the menu, but does not cancel, and in the second, the method passes and is canceled, why is that?
You gonna define a long type constructor instead and pollute your code with invoking that type constructor every where u call it?
If java was structurally typed that’d be fine
Hm, if you got an NVMe SSD then just load your worlds and see if it causes any problems
But since java is not its just gonna flop ur design
itemStack.setItemMeta(anotherItemMeta)?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ItemStack.html#setItemMeta(org.bukkit.inventory.meta.ItemMeta)
btw i would recomment checking the wiki, i just googled for item stack and searched for meta. U new?
declaration: package: org.bukkit.inventory, class: ItemStack
I'd assume any competent vps hosting would provide nvme
Id rather just have to type that out like 3 times over making a whole record
alr thanks
Bro records arent even that expensive
And u still have to define a class
Like i dont get ur point
Its not about being expensive
No but thats a fact
They cost the same at the point of c2
if i need it quick I go to the discord
How much do you pay for your VPS and what do you get for it?
if I need to solve a deep problem I go to forums
How do you define a data type then holding 6 types w/o a class or anything?
I'm currently doing anything on local. my question about loading worlds for this use case was purely hypothetical and was just to know in case i was gonna do that in the future
Are you gonna Pair<First,Pair<Second,Pair<Third,Fourth>>> or what?
You can reuse container classes for lots of things
Yes but your system becomes less specific and poorly named
What that would be stupid
And all of that gets erraised anyways
this sounds like a excelend design choice
How?
Lets say you define some sort of reusable data class, Quadruple<A,B,C,D>
First of all this becomes unnecessarily verbose
public class Data<A, B, C, D, E, F, G, H>
{
}
hear me out...
Second, its less specific and thus a bit more poorly named to the scope of ur system
How is it less specific
Because it has a more general name?
Ok? Variables have names
Its as if I were to use Map everywhere and avoid defining adapters
DataFixerUpper
There is a reason we use DTO classes, DAO classes and design patterned classes
I mean sure you can go with a Map<String,Object> for every dto class
What
Hm?
We define new classes, give them responsibilities with helpful names, thats pretty basic of a design convention in object oriented programming
Wait DataFixerUpper isnt scuffed anymore?
exactly!. magnificent idea
Ok but this is just a container, it does nothing besides holding data
That is not an excuse for poorly naming ur system
Wheres the poor naming
There is a reason u have Map.Entry and not MutablePair instead
Sure Map.Entry just holds data
But we still decided to create a dedicated class for it
and records are built to be created as transparent immutable data carriers
Name your system, it comes to show meaningfulness and significant value when you have millions of lines of code
In kotlin using these generic data classes are different since they have in built semantics to zip and unzip, transform and map those without becoming ridiculously verbose
block damage or entity damage
Where i can find id of packet "Map Data" for every version? from 1.8 to 1.20
I'm attempting to load a nested HashMap (HashMap within another HashMap) from a config. The saving component is finished and works flawlessly. I'm struggling to figure out what I should replace toArray with to get this to work properly.
The HashMap initialization:
public static HashMap<String, HashMap<String, String[]>> playerList = new HashMap<>();
The code in question:
playerData.getConfig().getConfigurationSection("data").getKeys(true).forEach(key ->{
@SuppressWarnings("unchecked")
HashMap<String, String[]> listValues = ((Map<String, String[]>) playerData.getConfig().get("data." + key)).toArray(new String[0]);
playerList.put(key, listValues);
});
Bukkit.getLogger().info("Loading playerList");
}```
A working similar case in which I load from a String, String[] HashMap:
``` public void loadSyndicateData() {
syndicateData.getConfig().getConfigurationSection("data").getKeys(false).forEach(key ->{
@SuppressWarnings("unchecked")
String[] listValues = ((List<String>) syndicateData.getConfig().get("data." + key)).toArray(new String[0]);
syndicateList.put(key, listValues);
});
Bukkit.getLogger().info("Loading syndicateList");
}```
I guess it can be fine if your component/module is generic itself so becoming more specific might be impossible, else its worthy to be specific imo
No bro. On this site there are only id's of packets for the newest version
what does this mean? i dont use linux
plugins isnt working, was wonering if it has dependancies?
That's not even the right error.
It goes back a long ways
How? Where?
?nms
I have been looking for this for like hour and didn't find packet-id history
im using gradle, does anybody have this but in gradle?
Theres a version history and each version has all the packets
Is there an efficient way to track which blocks have been placed by a player and which are naturally generated?
theres a plugin that does that, i dont recall the name rn
Do you mean this?
yes, he does
thank you
Pdc or coreprotect api ig
well yea i just linked that
can i use it for a plugin that rewards players for breaking blocks, too? or does it not have an api ?
pretty sure it does
This shit ends on 1.16
persistentdatacontainer?
Yes, put random flag in block rhat is placed by player
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
as far as i know, you can only use it on certain blocks like chests
Could you send me link?
Look at block pdc command I typed
another api :(?
Save my life
First aid would be something like minecraft engine on github so i can just copy these versions for most of the packets
Because now i have to spend whole night putting each packet id for every version
what arr you making
or doing
oh
you can look at via’s mappings
or other projects
that do this already
what are you developing to need to do this
Another engine XD
oh with networking?
Yeo
clientBound.register(PacketPlayerListHeader::new,
reg(0x47, V1_8, V1_8),
reg(0x48, V1_9, V1_9_2),
reg(0x47, V1_9_4, V1_11_1),
reg(0x49, V1_12, V1_12),
reg(0x4A, V1_12_1, V1_12_2),
reg(0x4E, V1_13, V1_13_2),
reg(0x53, V1_14, V1_14_4),
reg(0x54, V1_15, V1_15_2),
reg(0x53, V1_16, V1_16_4),
reg(0x5E, V1_17, V1_17_1),
reg(0x5F, V1_18, V1_18_2),
reg(0x60, V1_19, V1_19),
reg(0x63, V1_19_1, V1_19_1),
reg(0x61, V1_19_3, V1_19_3),
reg(0x65, V1_19_4, V1_20)
);
I have some of them from bungeecord
Do you know what limbo is?
a limbo server?
Yea
yes
you could use my packet library
it’s cross platform
i implemented my minecraft server in it
So i am making limbo server that support multiple instances running together, where u can upload small schematic
Link?
https://github.com/retrooper/packetevents in my server i’ll happily help you implement what you need with my library
network related
You are kinda famous
I understand
i don’t wanna come off as some weirdo promoting his stuff
but you shouldn’t need to spend much time on that stuff
it’s too much work
you should focus on the engine itself
otherwise thats how projects die
everything from scratch is overkill
Its not going to be public
i have no such scruples but i dont have any good code to offer either :/
Yea there is already to much cool stuff implemented
what are you talkin abou :/
yeah
but some people urgently wanna make it from scratch
to learn
then fair enougj
but its overkill
you won’t get to your engine
i would absolutely self promote would i have any plugin worth bragging about
which i dnt
you’ll spend a year on networking
I have mostly have done everything
is it opem source
or private you said right
if it were open source i would have loved to see your progress
Only things that need to be implemented is custom maps, inventory, and schematic (world) support, skin support
100% not its basicly everything you need for your server proxy, its combined and better version of jPremium, DeluxeMenu and EyfenCord
It for example allows you to send data from your game server to the lobby so you can put your custom data from gameserver in lobby scoreboard for example
Everything 100% configurable. I am thinking about selling it
This is the coolest part so far XD
wtf is that console lol
What?
lol
i dont recognize that GUI style hence the question
that some sort of reformatted IntelliJ?
If you code you can run your server directly from the coding enviroment like IntelliJ
well im aware of that though i havent bothered to set it up, i dont recognize the IDE youre running
IntelliJ Idea
ok
I have this little button and it turns on BungeeCord
must shift the buttons around then compared to normal console
wdym? Runnables dont self-terminate unless they're only set to run once or you make them stop
Tutorial for this
?xy
Asking about your attempted solution rather than your actual problem
while(true) {
}
wellllll thats not a good idea
runnables still run on the same thread
that just freezes your server
what are you developing
maybe run a task every tick or every few ticks
but what are u making
you might think you’ve got the right approach
but be wrong
why?
because if that'S all there is cant you just check the inventory when it's opened/closed
what you probably want is the inventoryInteractEvent and cancel it if it'd put an egg into the EC
no u cant
theres events for all that too
or they're part of the inventoryClickEvent
I'm pretty sure inventoryevents handle everything possible
how can i get all the keys in a hashmap
alr
you probably still want that plus whatever other events are applicable instead of doing it over inventoryInteractEvent, unless you do something ilke this
if(event instanceof InventoryClickEvent cEvent){ ...
I'm trying to take a config file like this and map it onto a HashMap<String, HashMap<String, String[]>>:
a51bace4-58c3-4852-bb89-6c788489950c:
syndicate:
- test```
This is my current solution but it returns an error (Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null):
I'm very new with Spigot dev and Java as a whole so I may be overlooking a far simpler solution as well
Unsure why this won't work though
if its 'null' you want either to not init that section or insert null into it
put that into a temp variable and do an if(temp == null){}else{}
Alright I'll give that a go
how to get block state from block data?
Have you tried googling that one
my guy couldn't find BlockData#createBlockState() 💀
mean staff
use the latest spigot version
Kinky
ok
In runTaskAsynchronously it says:
Schedules this in the Bukkit scheduler to run asynchronously.
how can i do this?
?scheduling
Bukkit.getScheduler().runTaskAsync….
ty
is deprecated
BukkitRunnable.runTaskAsync
i use BukkitRunnable#runTaskTimer
Just read the wiki page
It tells you what to do
?scheduling
im reading
hi! i give this error in via version
[19:04:01 INFO]: [ViaVersion] ViaVersion detected server version: 1.8.x (47)
[19:04:01 WARN]: [ViaVersion] This version of Minecraft is extremely outdated and support for it has reached its end of life. You will still be able to run Via on this Minecraft version, but we are unlikely to provide any further fixes or help with problems specific to legacy Minecraft versions. Please consider updating to give your players a better experience and to avoid issues that have long been fixed.
[19:04:01 INFO]: [ViaVersion] Finished mapping loading, shutting down loader executor!
how i fix it?
use a version that is not 1.8
or fork viaversion to keep 1.8 supported :)
the version in 1.8.8
I'm a bit confused as to what I should throw into a temp var
whatever gives you the null thign
why are these codes giving an error on player join?
playerjoin listener:
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e){
if(e.getPlayer().isOp()){
e.getPlayer().getInventory().addItem(new TestShovel().build());
}
}
test shovel class:
public class TestShovel extends CustomItem {
{
setId("TXT");
setMaterial(Material.WOODEN_SHOVEL);
setName("txt");
setRarity(Rarity.EPIC);
setAdditionalLore("txt!");
addStat(Stat.DEFENSE, 69f);
}
public void onBlockBreak(BlockBreakEvent e){
e.getPlayer().sendMessage("TXT");
}
}
custom item class:
public abstract class CustomItem {
//variable removed dis limit
public ItemStack build(){
ItemStack item = new ItemStack(material);
ItemMeta itemMeta = item.getItemMeta();
Multimap<Attribute, AttributeModifier> modifiers = itemMeta.getAttributeModifiers();
ArrayList<String> lore = new ArrayList<>();
if(stats.size() != 0){
for (Stat key : stats.keySet()) {
lore.add(ChatColor.RED + key.getName() + ": " + ChatColor.GRAY + stats.get(key));
}
}
lore.add(ChatColor.GRAY + additionalLore);
lore.add("");
lore.add(rarity.getColor() + "" + ChatColor.BOLD + rarity.getName() + " Item");
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_UNBREAKABLE);
itemMeta.setLore(lore);
itemMeta.setUnbreakable(true);
itemMeta.setDisplayName(ChatColor.AQUA + name);
itemMeta.getPersistentDataContainer().set(HypixelCustomItems.getPlugin().getItemKey(), PersistentDataType.STRING, id);
item.setItemMeta(itemMeta);
return item;
}
//getters and seters removed
public void addStat(Stat stat, float amount){
stats.put(stat, amount);
}
public abstract void onBlockBreak(BlockBreakEvent e);
}```
the actual error would be more usefull
do i have to stop my server for the latest log or its being written to the file at runtime?
dont you have a console open where you can copy it?
yes but its windows server 2012 so the cmd isnt that long and it can fit half an error message
ok lemme copy it
there's no way to a plugin in drafts is there
your hashmap is null
probably forgot to assign it
but you removed the vars so cant see
why fork
sorry i didnt read above that msg
oooo aren't you the guy who made the super cool models thing?
doesnt via have like 3 plugins including viaversion to support up to like 1.7
yes
more like "down to 1.7"
Cos if the devs stop supporting it do it yourself
Oh I mean I don't think the devs would stop supporting it but isk
Idk
I assume if they stop supporting that means they would abandon ViaRewind and ViaBackwards or whatever it is
Because it defeats the purpose of the plugin then
just a personal question: is it just me or does your brain also reset to factory settings every like 5 minutes and you forget what were you doing and you check your code to remember again
I be building and forgot I built a minute later
When IJ instant builds im like ah because my goofy ass built it already
havent had that issue provided im running on 3+ hours of sleep 
yes they do
maybe I should stop coding while high
while its day of course
lmfao
At this point use a set
cant ever be too sure its in there!
I don't even know what that code is for lmfao
"if the list contains the player, add the player to the list"
essentials vanish remake wish.com edition
lmao
well, at first I actually just looked at how essentials did that and copied lmao
did they do it without packets?
do you not know the hidePlayer method?
Hello
no
ItemStack#addEnchantment()
don't you need an ItemMeta?
i dont think so
But i said that I need sharpens
How I put sharpness i the bracket
javadocs be like
.
Theres an Enum named Enchantment i believe
except its not an enum but sure
No way to do that via name.addenchantment(…)
^
at this point im too tired to open Intellij idea to tell you
can someone else help him?
Ok
If you want to use the name you need to get the enchantment by namespaced key
that would only stop the respawn anchor block stop from exploding
it would not stop the explosion itself
iirc
yeah just download angelchest free and extract the .jar, it's in there somewhere lol
here it is
crafting slots are 41, 42, 43, 44 and result is 45
Now you have to edit that image
To have crafting slots
And why is that amazing image showing inventory slots not pinned in this channel
fuck you chatgpt, I had it write a single snippet of code just to see how it would work and it injected a bug that delayed my release by 4 hours and is pushing to have me have a heart attack by the time I'm 35
I even had a solution for what it was doing in another plugin, I just wanted to see how it would do
What are you releasing?
FreeMinecraftModels and the EternalTD plugin I've been working on
it was the last issue
I'm just doing a clean install to double check
4h is nothing
The really cool model thing?
it's only worth $448
I know it's nothing, it's added to the very much not nothing that has been these last 3 weeks
of one's time if you're an average developer
Wtf how much do you get per hour
yeah we're def the average ai dev in here
💀
sorry did you say something I couldn't hear you over the sound of my lambo revving
But according to my calculation: 448/4 = 112
this one sounds bad I think I'll crash it and buy a new one
I'm bad at math
lmao that's actually funny
yeah so it's 248$
I wrote a 4 instead of a 2
Lol
I have bad news about your career as an AI dev
😭
tbh
I'm wondering what should I do
do I go for the generic doctor shit
or do I go for AI
but I'm not sure how well paying AI is in algeria
💀
at least you wont have to write readable
I can confirm I can't write readable text even if I try to
perfect then
so this requirement is fullfiled
it’s gonna stay supported
they just won’t put any effort in fixing further bugs
or any improvements
that message was more of a warning lol
begging you to update
Its gonna stay supported followed by the devs just wont support it
?
Sounds a lot like dropped support to me
Either way is there are issues the devs wont fix, you have to do it yourself
yes
it’s not like it will no longer run on 1.8
eventually maybe
eventually maintaining all these versions will be too much
protocol changes too much
minecraft 2.0
1.8 -> newest is hell
viatimetravel
how can i check that player hold left click?
world
there really is no reliable way to do that i believe
click on block
doesnt that event trigger when you release aswell
yea true
declaration: package: org.bukkit.event.block, class: BlockDamageAbortEvent
this one i believe
unfortunately that only works on blocks. If you hold left click at air all bets are off
the playerInteractEvent doesnt trigger if you stop attacking air cuz it's one punch you throw, not a continuous action
its ok
i want to do punch sound when player kicks the door
thank u i will try this
Is it possible to create a custom packet in BungeeCord?
I know it actually is, but how would I do it?
old and outdated but you can learn from https://www.spigotmc.org/resources/packet-menu.26613/
um perhaps thats not the right one
Apparently, what I am looking for exactly is https://github.com/Exceptionflug/protocolize/tree/master (the dependency ProtoGUI is using)
Thanks tho
Cool jetbrains logo
anyone know of a way to scan for maximal depth (number of method calls before termination of function) of java source code?
pass a counter
without executing i meant
actually I'll just stuff a temporal restraint onto it, that'd work too
Sounds like bad code 
YO THEY'RE USING THE COOL S
my justification for this is that giving other people access to run code on your stuff has to be done very carefully
I need a plug-in dev for an smp plug-in
you would usually look for people like that on the spigot searching for devs thing
Where is that?
spigotmc forums iirc
K
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
One question to the custom packet registration, is the ID field the minecraft packet id? For example; In BungeeCord source code, the "KeepAlive" packet is registered as this:
TO_CLIENT.registerPacket(
KeepAlive.class,
KeepAlive::new,
map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x1F ),
map( ProtocolConstants.MINECRAFT_1_13, 0x21 ),
map( ProtocolConstants.MINECRAFT_1_14, 0x20 ),
map( ProtocolConstants.MINECRAFT_1_15, 0x21 ),
map( ProtocolConstants.MINECRAFT_1_16, 0x20 ),
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1F ),
map( ProtocolConstants.MINECRAFT_1_17, 0x21 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x1E ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x20 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1F ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x23 )
Does this means, in Minecraft 1.8, the KeepAlive packet has the packet ID 0x00?
in Minecraft 1.8, the KeepAlive packet has the packet ID 0x00?
yes, it does https://wiki.vg/index.php?title=Protocol&oldid=7368#Keep_Alive
Aight, thanks
What Player#hasAI returns? just asking
hopefully False... 
but also just fck around n find out, getLogger().info("Sentience? " + getPlayer().hasAI());
I think if the player puts the milk before the cereal it returns false
🗿
🤔
It actually returns false
As the player doesn't have an AI
It's controlled by "something else"
A naturally spawned EnderDragon for example, will return true, because the game has control over what the dragon "thinks"
If basically means that the entity "exists" by himself, it has thoughts, feelings, loves and cries, have goals, or simply exists and nothing else, like an empty recipient, with no soul
okay that was kinda deep for a development convo
whatd u do
How do people design so good their plugin pages?
It's not hard
They pay people
wtf
not only did I not pay people it's not even a particularly neat page, I didn't have much time to make it
I'm leaving in two days and still have two more plugins to do updates and bugfixing for
Well done my man
Now imo, first thing you should do asap , as its ur first plugin, is find the bit that kicked ur arse the hardest. The bit uve just got working. And make a comment rn explaining, in detail , what the issue was and how you solved it
Future you will thank you
yup, I was having difficulties running a synchronous method asynchronously
So go into detail , with a comment in ur code in the area where u finally fixed it
It'll help with retention n shit
i didn't know nothing about schedulers till now lol
aight ty
finally now time to add the "new line" feature
I wonder how I'm gonna implement this
generic types 
Go to the church and ask god to forgive you
Can someone tell me why the selected line returns "java.lang.NullPointerException: Cannot invoke "java.util.List.toArray(Object[])" because the return value of "org.bukkit.configuration.file.FileConfiguration.get(String)" is null"
This is the config: data: a51bace4-58c3-4852-bb89-6c788489950c: syndicate: - test
Why are you casting?
Not entirely sure but my guy, as a general note MockBukkit is brilliant for solving issues like thi
The debugger literally gets rid of 90% of the guese work
I'm trying to load these values into a HashMap<String, HashMap<String, String[]>>, if there's a better way to do it that would be super helpful as well
Never gonna work im afraid. Ran into this exact issue before.
it will always bee Class<T> which, in a cruel twist of fate, will never be considered okay for Class<? extends GameMapTemplate<?>>
The api lets you get lists
Yeah but T extends GameMapTemplate<?>
Also syndicate is not a configuration section
Java cares not
Ah we love java generics
Its really dumb in some generics
Sorry kid, i'll save you trouble now, its a fucking bust
If you manage to solve it, legit gg. But I dumped 12 hours of my life into that rabbit hole
plugin.textDisplayMessage = plugin.textDisplayMessage + "\n" + newLineText;``` in theory, this should create a new line right?
I believe text displays support \n, yes
Exactly. When i say "cant solve it" i meant i tried everything and anything to make it so i didnt have to
nothing helped
Though tbh, I saw like what? 3-4 generics in that gamestate class shit?
My man you are probably approaching the problem wrong if ur relying on 3-4 generics
So what should I actually do then if I want the final hashmap to be UUID -> Syndicate (key of inner hashmap) -> test (value of inner hashmap)
In one dang method
But yes there is a better way to do it then like this. I dont have time however to show you. But your casting is not necessary that you are doing.
I am sure maybe one of the others may be kind enough to help on the code end
getStringList
Is it more efficient to have all the, for example BlockBreakevent stuff, in one listener, or would the more organised varient of having blockbreakevents for each category of something impact perfomance?
It shouldnt impact performance assuming you dont have some crazy things going on in each of them lol
As long as you sanity checks are quick, cheap and cheerful, you should be aight
They are called with reflection, but it’ll get optimized after a while
Alternatively you can have one actual listener that just calls various other methods for each thing
i want to have 5 skills, mining, foraging and so on, i want to have all of the kinds of blocks belonging to one skill in one listener
would you call this crazy things?
Not if you do it right. What you want is easily done with a few classes and a single listener for it
Fully restricted or bonuses when mining or doing the other bblock breaking?
Just map the blocks to the skills
i was going to define every block to one number (xp amount)
you mean hashmaps?
*Aye have it as a Set<Material> in each of the skills and have one singular block break event. Have it check if the player has a skill, then check the Set<Material>.
Hashmap is one way. Not the only way. Could use enum
I'd go with Set<Material> for the skill check itself and then enum for the XP imo
wdym by that?
i never used an enum
time to learn son
im not really experienced
Hey
everyone starts somewhere
enums are a very useful tool for values that wont change 🙂
i'll look into that
Defo worth adding to your tool kit
Stuff in minecraft always changes :p
Infact you know what makes this easier
Enums are so 2012
so only one listener and no organisation :(?
@inner mulch you ever used the "Material" in spigot?
yes
Material is an enum 🙂
oh
For now
So listen, imo you could get away with aving one single method that is like 20 lines long max
True, but this doesnt impact enum on the runtime end lol just the coding end when you need to update
Step 1:
Check if the player has a skill
Step 2:
Check the skill's Set<Materials> to see if it equals the broken block
Step 3:
Do ur funky xp stuff via the Enum
Then it doesnt matter what skill, what block, what action etc. All done in 20 odd lines :L
My Internet was broken
Thank you
no worries man
it wont be the only approach
might not even be the "best" approach
but hey every day is a learning day
what?
i couldn't believe it'd work
damn why u so amzed
Let him enjoy his first plugin
Mhm.
Uh idk man maybe because I managed to create such masterpiece and I'm like super new to java (only been using it like for 4 days)
wait how do i use a set?
A set is basically an unordered list
U can even create it through a custom gui 🤩
Wait so like this? because this is returning a type incompatibility error
getStringList returns a List<String>, convert it to an array
just cast it to an array then? alr
Yeet!
This man will basically take you from 2/10 to at least 5/10 just from learning the various concepts he teaches
Full tutorial on Sets and HashSets in Java!
Thanks to Mailgun for sponsoring this video! Go to https://mailgun.com/john to try Mailgun today.
☕ Complete Java course: https://codingwithjohn.thinkific.com/courses/java-for-beginners
What exactly are Sets and HashSets in Java? How are they different? How do you use them, and how are they different...
thank you
With the greatest respect you are are doing the equivalent of describing a giraffe by saying "it has spots" haha
Is there a way to change the client's skin that they see or is that done client side
Does the player info packet get sent to themself?
one question regarding the sets, where should i save them, would loading and creating a set every time the event is called be super inefficient?
Okay new task. Learn about abstract classes and interfaces.
:( ok
Trust me moment you know about those 2. (Use this guys channel) you will weep with joy 😉
What are abstract classes and methods in Java, and how and why would you use them?
Also, what's the difference between an abstract class and an interface?
Abstract classes can seem like a wacky, complicated Java concept, but they're pretty simple. We'll explain them in just a few minutes in this beginner Java tutorial video lesson.
How do I ma...
bald supremacy
Essentially, imagine being able to make a "skill" class, that has fields like the set of materials, the name, the effects to call etc.
And then being able to make specific classes that use that skill class as a "parent"
So you have all the same building blocks, but decide the specifics in each class
okay
Imo abstracts and interfaces are the difference between 100 lines of code per class and 20-30 lines per class (if done right haha)
abstract factories
@livid dove contrary to what you said
all the map caching works
Minigame lib is starting to take shape
shit my ip
eh whatever this bitch works

Your ip isnt worthy
eh this works
how do you iterate through an hashmap
uhm, I'll take a look on those
I'm working on creating a basic land-claim plugin in which I'll need to store data for syndicates (basically factions). I need to store a variety of values for each created syndicate such as tags, banner patterns, player lists, role configurations, etc. This seems like an issue that is best tackled with a HashMap (which each syndicate name as a key) and the rest as a list of values- however in certain cases I'll need to have further lists for those values while for others I won't. What is the best way to tackle this problem?
I'm open to any and all suggestions including a complete restructuring if needed
Map<String, Syndicate>
With syndicate being a custom class that holds everything you need
Is there any good documentation on using classes for data storage?
When item entities move, EntityMoveEvent is triggered right?
I did a test where I send a message (don’t judge me) if a moving entity is an instance of an item entity, but nothing shows up.
for some reason I can't find BlockSign in CraftBukkit
should be around here, but It's just not
I also did an entire project search its imported and used in places, but literally just doesn't exist outside of that as a class
might not have been patched
what do you do to make a new patch
it's on the readme
alrighty
Does anyond know how can i get auth lib in my plugin?
Do i just need to use it as gradle dependency?
How do you get a CraftBukkit block from NMS
Ye i know
uhh
from NMS is what I meant
thanks
It's just a wrapper class
ahhh i see
It's more of an adapter class actually
I'm pretty new to a lot of NMS stuff trying to get used to this stuff so I can PR more
tryna add some event rn
also so I can just leverage more of the server
and patch shit in if I ever need on private servers
ye
I'm just happy with getting my minigame lib to work nicely
Takes like 50 lines to add a new minigame
Half of those are loading the map from a config file
are you allowed to add params to methods in NMS or am I going to have to hack
You can if you make previous methods maintain compatibility
made this one really fast
got maybe 5 hours on this project
but it worky
And cleanup is basic too
yeah I spent like 2 weeks on mine lol granted I "had" a minigame lib I was supposed to use it was just bad though
I hadn't touched minigames and was expected to make and maintain a game engine now that's some practice :P
I wrote a guide like last week
on what
minigames
I was absolute doodoo at minigames a year ago
You mind giving me the link? sound interesting
It's really basic and I need to write like 19x more content
Fair enough
thanks
EnumInteractionResult use this is an NMS type event thing I'm assuming
its just called use spigot doesn't have it mapped, but mojang map says triggeredEvent lol
patched spigot maybe like a year ago
meh fuck it I can always change the Reason if I get it wrong
Hey I need help with a plugin that I'm using
@echo basalt do you know how to remake patches? not sure what I'm supposed to be targeting my path towards when I do
nvm figured it out sorry for the ping
Anyone know if there is an event for when the item for suspicious sand/gravel gets generated? It looks like the LootGenerateEvent isn't getting called for it even though it triggers a loot table generation. I suspect there's a missing event or it was missed for getting added to the LootGenerateEvent since it's such new API
Huh, yeah LootGenerateEvent should definitely be called for that. I can't really think of any other way you could detect that. Might be a bug with spigot rn.
You've tested it with other loot tables right?
How do I get this to work i'm trying to make a command where if the warp exists it'll delete it and give you $500 if it doesn't it won't do anything it'll just say it doesn't exist. Delete_warp:
command: /del
type: RUN_COMMAND
runcmd:
- '/delwarp $arg1'
- $Script$%if%$arg1==$arg1
- '/eco give * 500'
- $Script$%else%
- $text$doesn't exist
is that even java
It's from inside of this plugin https://www.spigotmc.org/resources/mycommand.22272/
I have been messing with it and I just can't figure it out trying to just create a command
#help-server is where you need to ask
I asked there but no one helped
then be patient. This is not the right channel
okay
It's skript i think
dont know what that is
holy shit I finally finished my hologramm plugin
omg this is soo fucking cool!!!
4 days in to learning and I already made my first big project
Actually I think it's a custom script of some sort for that plugin, but skript is a plugin that basically allows you to make simple plugins in a scripting language.
lit
Nice, what does it do?
Create a hologram
and u can create it through a custom gui
ISN't THAT COOl
Eeeee
and your created holograms are stored so that you can delete it anytime you want to
Ey that's cool
how are holograms stored
idk how to make my code fancy, I'm new to java
ArrayList inside a hashmap
what about restarts
i wont show you the code you will vomit
that map wont exist
Could be worse
fuck
Yeah is it saved to file?
Well looks like ya got some more work to do
If you want advice on saving things just ask
What do you mean?
Don't try to hide it
Also yeah what would be the point of that
ok
Either store in pdc or use a file that users can edit/remove
anyways yes teach me how to save stuff
?pdc
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
damn, I don't know how to work with apis
Eh I wouldn't use a pdc for this
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
I would use a yml
i'll just store this in a yaml file
yes that
welp this will take another 1 day
😭
or maybe less
idk
Just load the yml to memory and save onDisable
how do i obfuscate my .jar file
my code is nested, it's super hard to navigate and find things
luckily ctrl + f exists
Or if you want to get fancy serialize it to dat file
Or just use PDC
uhm i'll just store it in a yaml file
Which saves to the data files
pdc to what tho?
it's only been like 4 days since I started learning
Chunk
ig that could work
So you can load and unload when needed
im gonna take a rest for now, I have been working for like 8 hours
my brain got melted
Instead of always keeping things in memory
i didn't even eat lunch
Idk I mean unless your expecting a vary large amount of holograms to be stored the memory would be pretty negligible
Very minor optimization but yeah 🤷♂️
i dont even know how I made this work
i mean the code is nested with alot of if statements
😭
IT HURTS my eyes everytime I look at it
Time for rewrite using your new knowledge
lol well maybe research DRY
Oh god wtf
I could just get rid of them and everything will work fine
yeah I know, I don't need most of them
So,,, why do you have them?
idk man I just dont bother on changing stuff, I don't wanna break it
What in the world where you even trying to accomplish here??
I'm sorry I know your just starting but it's hard not to laugh about that abomination
Maybe try learning a bit more java before you jump into your next project lol
I'm aware of my mistakes I just dont bother on removing them
😭
I dont wanna break it
yeah those indian dudes on youtube really helped me alot
So you just leave a bunch of useless code in your project?
Maybe you just haven't found the right Indian dude
lol fr tho there are alot of really good resources out there for learning java
fine I will clean them, I gotta go eat first
im about to go crazy
but hey atleast its functioning well
:DDDD
Please get the fundamentals down before jumping into another project. It will save you and other people alot of time and pain trust me.
i thought I could grasp java because I'm familiar with lua
:C
turns out I was soo wrong
i will eventually learn stuff throughout my journey
this isn't the worst progress right, I mean I already mmade my first project and I'm only like 4 days in
as stupid as it may sound, grab a thin (!) book about learning java and read it front to back. Helped me immensely with C++
i dont have money to buy books
Look, a lot of people have that mentality and it always ends up the same way for them. They waste so much time and go through so much but don't get anywhere because they are to stubborn to do it the right way.
Okay i'll learn the fundamentals :CC
Please, for your own sanity, trust me you will be thanking me later
Good luck, I think you could be a great dev. Seems like you have a lot of enthusiasum about making projects.
Oh also check out Alex Lee on youtube @simple schooner
I will, thank you for your suggestions.
If you help on something specific in java or spigot feel free to @ or dm me
Okay thank you
returning false on command doesn't do anything except the usage message right?
correct
Is hashmaps in hashmaps acceptable?
ig it depends on the context
🤣
I would usually wrap something like that in an object to make it easier to use
nested hashmaps of any depth are considered 'equal' as an argument
so HashMap<String, HashMap<String, Object>> and HashMap<String, HashMap<String, HashMap<String, Object>>> as the only elements in a method signature dont work as overloading parameters
It really depends on what your storing and how your using it
Huh I didn't know that, that's interesting
that should be defined as Map not HashMap in those
im writing this from memory sue me
IDK what propper way to store stuff
Maybe it depends on what you're making hmm
alright now im not worried 🤣
What are you storing, I might be able to help
Just talking about practices
Shet maybe back to reading
I'd say generally it's not the best idea but it can be acceptable in some situations
Hi guys, I have a question. Which is better resource-wise when setting up a minigame network, having one server per lobby and per map, or having only one server for all, lobby and maps included?
Follow up question, how does a server treat the ram dedicated to it? I don't have much knowledge on that field yet. If we dedicated 4gb to a server, does it keep those 4gbs all to itself or does it allow other servers as well to share it? For instance a system has 8 gb ram total and I'd like 3 servers with 4gb ram dedicated to each running in it
well
First, #help-server
but it depends on exactly how you specify the allocation
for example, -Xms4G will eat 4G in heap regardless
but -Xmx4G will scale to at most 4G
as for a minigame network, welll xd
Keep in mind that MC is (mostly) single-threaded. I would really, really recommend running separate servers and disabling nether / end in em for your lobbies and minigames
You should never over allocate though, that's a great way to get a memory crash
^ my recommendation as well, separate servers with as much as possible disabled
There's no reason for it
Yeah that is the best way to do it
as for proper architecture of a large minigame server, you'd be auto scaling with containers
but
that's once you get several hundred players at least
and make sure you aren't allocating all 8GB of an 8GB system (example)
the system takes a small amount of memory as overhead for the OS
Yeah that's a good point
so, to be safe, block out like 1.5gb as unusable. or if you want exacts, you can run htop on your env. with no servers running and figure out around how much your system takes at idle
If your running windows for some reason leave at least 2-4 depending on the version
welllll windows 10: 8 GB for OS + Chrome
Yeah fr
4gb would be the absolute minimum on windows 10 and that's with only the server running
only 1.5 GB of that is chrome
everything else is background stuff that doesnt seem to add up to 6GB
I don't think windows 10 eats 6.5gb by itself, at least not if you kill start up apps and everything that isn't necessary
I see, thanks for the knowledge dump guys lol, I learned a lot 😄 I now know what to search, I'll just google the rest later
i do disable auto startup unless necessary, but i've discovered that even with that a good deal of stuff launches itself if installed anyways
for example you cant disable wacom drivers auto startup
you'd have to uninstall em
Yeah some stuff can be real stubborn
Also that would enough for maybe 1 chrome tab lol
try 400
yea. its not in auto boot
Well a driver wouldn't be in auto boot
Might be in task scheduler, if not you would probably have to do a regedit or something
or perhaps it's in device manager
isnt that only current devices?
but honestly 40MB isn't worth the hassle of enabling the driver anytime you want to use the tablet
truthfully no idea, I just know I go there to restart battery drivers when they remove my laptop's battery icon
among WiFi drivers as well, since those always fuck up on my laptop
ah, and yea it is
i remove my mouse, my input devices decrease
i no longer go to device manager since i learned windows has a shortcut to force a restart of your graphic drivers
control shift windows b
it beeps and freezes for 20 seconds tho
what
Warn what
i want to prevent null values
Ey what's up md_5
in arguments?
from being passed to path
then a contract, no?
Is Path.of annotated?
the entire thing cant be null
It's varargs
its entries can
You need two annotations, I think it's possible that way
@NotNull String @NotNull ... nodes
Is there some structure API or I need to create one myself? I want to create some sort of preset housing.
only nodes[0] == null
is there a way to make commends in the plugin.yml
cant recall the name
Yes, search the javadocs for structure
redlib maybe
commands or comments
Commands or comments?
# comment
what for
yea thas the name
organisation
thx
How big is your plugin yml?
org.bukkit.structure? ;D
howd u make that text so big md_5?
markdown
#h1 text
# text
nope
Also are normal yml comments not allowed in plugin yml?
its just the hashtag
E
text
ah
also why is that a channel
i mean yea it's accurate but not really descriptive
What is a normal comment
iirc # works
old voice channel text channel
I thought they meant normal "#" comments weren't working in plugin yml
literally any valid comment in the spec should work, considering the yml is parsed by snakeyml
am I wrong?
pretty sure I've used comments in plugin.yml before
right
If i set another permisson as a child does the child get the parents permisson or the parent the childs permisson
Every child will be included in the parent if that's what your asking
Well actually it would be parent.*
It's whatever the parent is, * isn't treated specially by Spigot, although most permissions plugins treat it as a wildcard
Oh ok
so if i have
permisson.fly
permisson.walk
and i set walk as flys child, fly will be able to do both
sorry my brain is to slow for this rn
wdym? the parent is "permisson" and it's child is fly
okay thx
if I have GameStartEvent and SpleefStartEvent, and i Bukkit.callEvent(new SpleefStartEvent()); does it trigger for GameStartEvent too or do i have to call for that separately?
unless spleef start even also calls gamestart event you have to call it urself
That doesn't necessarily mean the super is called
I'm not actually sure how spigot handles this
hmm, i'll do a test then just to be sure
i've seen some events that trickle down
so i expected it worked for custom events too
it's not a trickle down, but inheritance is supported
for example, if you have SpleefStartEvent that extends GameStartEvent, then listeners to GameStartEvent and SpleefStartEvent will trigger once for a SpleefStartEvent
If you want both to be called i believe all you need to do is have spleef extend game event
awesome
Because that is how some of the events work in the bukkit api
yep, that's all you have to do
You mean trickle up in regards to inheritance lol
on another note, why's intellij enforcing this when it's not even adding it in the pom file
that makes sense
yeah i meant trickle up
It probably adds it to the idea file for the project
Probably to know if it needs to change styling rules or whatever else
Netbeans does this but doesnt enforce setting anything in particular for a project unless you tell it to. Handy when you need different settings for just a single project
Do people actually still use netbeans lol
md does