#help-development
1 messages · Page 1102 of 1
its definitely desync of some sort
opening your own inventory wasn't the issue tho o.O
that has alwayas been fucked no?
yeah no that's always been fucked
this issue started around 1.18.2 from what I found
inserting an itembuilder there would be so much beneficial
Back when I was a server admin I think I had seen it a few times
Yeah I think its the client not liking the fact a player has a player inventory open at all
ItemBuilder?
you know builder for items
instead of getting the itemmeta, applying stuff to it, setting it back and all that nonsense
Could you wrap the player inventory with a chest inventory
that's not really Ideal for API we are already probably somewhat illegally stuffing a PlayerContainer within a ChestMenu
but making a mirror inventory for API's sakes seems unstable at best. If someone else wanted to do it sure, but I wouldn't add that to CraftBukkit
Yeah, maybe as an external library
never heard of it tbh
goated pattern
I wonder if those desyncs are somehow related to the player inventory having an amount of slots that isn't divisible by 9, or do the crafting table slots count as slots too
i mean yeah that would make it cleaner tbh, but wouldn't solve the problem
why not kotlin builders 🤔
still old code
so it's basically something like the Gson-builder but for item stacks?
that is NOT rad approved kotlin code
Most people aren't kotlin fanatics like you, rad
am not using that code
at com.github.shioku.servercore.gui.misc.OptionsGUI.createInventory(OptionsGUI.java:47) ~[?:?]
whats here
?code
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
bruh my internet
I already got it get owned
?paste
get sued
line 35
FOR MY OWN COMMENT? 😭
yep, bad man
sucks to be you
copyright comments are a joke anyways
especially on plugins
anyways
how are you creating OptionsGUI
like how are you instantiating it
@hybrid turret
why is that?
whats the point
always put them in code you upload to any repo
if you wanted you can just remove them
you never know what the future holds
like what
private InventoryButton createPlayerButton(Player onlinePlayer) {
return new InventoryButton()
.creator(player -> {
ItemStack item = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) item.getItemMeta();
assert meta != null;
meta.setDisplayName(onlinePlayer.getName());
meta.setOwningPlayer(onlinePlayer);
item.setItemMeta(meta);
return item;
})
.consumer(event -> {
Player player = (Player) event.getWhoClicked();
if (!this.hasOptions) {
Bukkit.dispatchCommand(player, this.getAction() + " " + onlinePlayer.getName());
player.closeInventory();
return;
}
System.out.println(this + " " + this.getAction() + " "); // for testing
OptionsGUI optionsGUI = new OptionsGUI(this.getPlugin(), this.getAction(), this.getGuiManager(), onlinePlayer.getName(), 1);
this.getGuiManager().openGUI(optionsGUI, player);
});
}
like I said, you never know
to this
and whats this.getPlugin
If you uploaded a bunch of code to github with no copyright and 10 years down teh road some company uses it in a product which nets millions.
well that would beeee illegulllllll
@Getter(AccessLevel.PROTECTED)
@RequiredArgsConstructor
public abstract class PaginatedGUI extends InventoryGUI {
private final ServerCore plugin;
...
}
if there is no copyright on it you will have a very hard time filing a suit against the compant
the license allows you to do that anyways right? or is it non commercial
i kinda forgor
and this.getPlugin() does return something in PlayerListGUI fsr
but not in OptionsGUI
no I mean in this class
depends on the license
there is always copyright on your intellectual property
wel im talking about the license required by mojang
there is but you have to prove its not free/OS
yeah. this.getPlugin() is inherited from the its super class
okay, and where do you create this inventory then
PaginatedGUI is abstract
..
sorry I meant where do you create the implemented version of this class that isnt options gui
oh yea hold on
public class AdminToolsGUI extends InventoryGUI {
private static final int INVENTORY_SIZE = 2 * 9;
private final ServerCore plugin;
private final GUIManager guiManager;
public AdminToolsGUI(ServerCore plugin) {
this.plugin = plugin;
this.guiManager = plugin.getGuiManager();
}
@Override
protected Inventory createInventory() {
return Bukkit.createInventory(null, INVENTORY_SIZE, "Admin-Tools");
}
@Override
public void decorate(Player player) {
this.addButton(0, createBanButton());
this.addButton(1, createKickButton());
this.addButton(2, createGlobalMuteButton());
this.addButton(3, createDayButton());
this.addButton(4, createNightButton());
this.addButton(5, createPVPButton());
this.addButton(6, createInvSeeButton());
this.addButton(7, createRainButton());
this.addButton(8, createKillButton());
this.addButton(9, createCheckKeyButton());
super.decorate(player);
}
private InventoryButton createBanButton() {
return new InventoryButton()
.creator(player -> createAdminButton(Material.NETHERITE_SWORD, "&4Ban", "Ban"))
.consumer(event -> {
Player player = (Player) event.getWhoClicked();
PlayerListGUI playerListGUI = new PlayerListGUI(this.plugin, "ban", this.guiManager, 1, true);
this.guiManager.openGUI(playerListGUI, player);
});
}
...
}
ew
wha
hardcoded items 
rude? > :(
what's the issue?
At some point you'll need to adapt your system for configurability :)
you're a hardcoded item
why is that?
Uh..
so the admins can have their own funny icons?
maybe users wanna have a diamond sword instead
but like
in germany we say to that: "Zukunfsmusik"
it doesnt really matter
first of all i need to get it to work. the rest is for later lmao
what
"future music" (word for word). It's an expression of when you don't give a crap about something and let your future self handle it xD
okay and finally how do you create AdminToolsGUI
anyone have code to make a BlockDisplay entity extend from one point to another? Matrix and vector calculations will make me kill someone
yeah
https://paste.md-5.net/egayusosex.java menu go brr
@RequiredArgsConstructor
public class AdminToolsCmd implements CommandExecutor {
private final ServerCore plugin;
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player player)) {
sender.sendMessage(Errors.getConsoleError());
return true;
}
if (args.length != 0) {
sender.sendMessage(Errors.getSyntaxError(cmd));
return true;
}
AdminToolsGUI adminToolsGUI = new AdminToolsGUI(plugin);
this.plugin.getGuiManager().openGUI(adminToolsGUI, player);
return true;
}
}
I mean I already have my own stuff lmao
haha sex in the url
gay...sex
gay sex
😳
fr
u forgot to DI it
You’ve heard of eboys and egirls
egay
Now get ready for egay
Lombok?
u mean @RequiredArgsConstructor?
yeah
Lombok. it adds a constructor for all values that are private final... an not immediately assigned
ah right, i dont like it xD
anyways thats not the point
have you tried printing this.getPlugin() anywhere and see where it starts being null?
yeah it's like a 50/50 thing with the ppl that like it and the ppl that dont
yeah I dont because it hides a lot of stuff
apparently it starts being null in createInventory of the OptionsGUI class
but people probably like it because it hides a lot of stuff
yeah maybe i'll delombok everything at some point idk
looks cleaner rn and since i know what it does, i'm good with it
yeah
kinda trashy for support tbh
you can see some sout stuff in my code as well already
eg here
I keep having to search for those things which doesnt help when looking for things that are actually forgotten in the implementation vs what lombok will just add anyways
but tbh that's the wrong log
yeah
yeaaaaaa.... tbh i might just delombok in the future for support questions
yea wrong log
what's wrong with that
just for a quick log?
well its fine for that I guess
as long as you use a normal logger for anything more permanent
yea i do
i don't like sout
but i use it for stuff where i don't wanna give a shit about having plugin in the class or not
ah
maybe if you did use it you would know if it errored xD
which kinda defeats the point of logging this.plugin anyways lol
but in my plugin I just have static methods to log
fair enough tbh
private InventoryButton createPlayerButton(Player onlinePlayer) {
return new InventoryButton()
.creator(player -> {
ItemStack item = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) item.getItemMeta();
assert meta != null;
meta.setDisplayName(onlinePlayer.getName());
meta.setOwningPlayer(onlinePlayer);
item.setItemMeta(meta);
return item;
})
.consumer(event -> {
Player player = (Player) event.getWhoClicked();
if (!this.hasOptions) {
Bukkit.dispatchCommand(player, this.getAction() + " " + onlinePlayer.getName());
player.closeInventory();
return;
}
System.out.println("Plugin right before instantiating OptionsGUI is: " + this.getPlugin());
OptionsGUI optionsGUI = new OptionsGUI(this.getPlugin(), this.getAction(), this.getGuiManager(), onlinePlayer.getName(), 1);
this.getGuiManager().openGUI(optionsGUI, player);
});
}
@Override
protected Inventory createInventory() {
System.out.println("Here:" + this + " " + this.getAction()); // fixme: getAction is not null in PlayerListGUI:85 but it is here????
System.out.println("Plugin in OptionsGUI is: " + this.getPlugin());
return Bukkit.createInventory(
null,
this.plugin.getServerDataManager().get(0).getGuiOptionsMap().get(this.getAction()).size(),
"Options"
);
}
[22:05:58] [Server thread/INFO]: Plugin right before instantiating OptionsGUI is: ServerCore v0.4.0
[22:05:58] [Server thread/INFO]: Here:com.github.shioku.servercore.gui.misc.OptionsGUI@79311af3 null
[22:05:58] [Server thread/INFO]: Plugin in OptionsGUI is: null
there's the logging
and just to have it complete, here's the stacktrace again when trying to open the OptionsGUI
https://paste.md-5.net/fobowedozu.cs
Using NMS to spawn a custom entity, addFreshEntity is returning true but I can't see my entity, any ideas why? Here's the entity class itself:
public class CustomZombie extends net.minecraft.world.entity.monster.Zombie{
public CustomZombie(Location loc) {
super(EntityType.ZOMBIE, ((CraftWorld)loc.getWorld()).getHandle());
//this.setCustomName(Component.literal("Test :3"));
boolean spawned = ((CraftWorld)loc.getWorld()).getHandle().addFreshEntity(this, CreatureSpawnEvent.SpawnReason.COMMAND);
loc.getWorld().getPlayers().forEach(player -> {
player.sendMessage(spawned + "");
});
}
}```
I have another thats a shulker bullet but doing the same thing
@pseudo hazel
yeah im reading the book your wrote
does someone know if it's possible to make a crops change only on the client side?
Probably packets

can you show me like some of the best way to do it?
lo
I guess my next question is why do you keep remaking the plugin variable in each class over again? your inventoryGUI class already has the plugin
so just make a getPlugin method and use that
instead of creating a new variable in each subclass
uhmmmmmmmm i dont
i mean i do
but i only did that in OptionsGUI for testing purposes in case for some weird damn reason, that this is the issue
i originally used this.getPlugin in OptionsGUI as well
well you have one in AdminToolsGUI too
and do you have a plugin variable in paginatedGUI?
or wait i might be looking in the wong place
in any case, 1 variable with teh same value should be sufficient
yea i have one in paginatedgui and in admintoolsgui
bc admintoolsgui has no correlation with paginatedgui
right
but both are inventoryGUI right?
does inventoryGUI have a plugin variable too?
hmm doesnt look like from reading the code you sent
when does decorate get called?
aaaaa
yes
no
yeah thats where I got confuzed
@hybrid turret give me a tldr on the issue again and whats the code again
decorate gets called in each of these classes pretty much. it just always does something a lil different
do you have a plugin github repo?
as much as i want to rn, i gotta work tomorrow and its 10:22 pm
i do but i cannot make it public
bc my server is in there
and redistributing that would be vewy illegull
oh
yes but I meant who starts calling it
the "normal" classes
either PlayerListGUI, OptionsGUI or AdminToolsGUI
PlayerListGUI > PaginatedGUI > InventoryGUI
same for OptionsGUI
AdminToolsGUI > InventoryGUI
this is the resource this is based upon
i gtg now
gnight yall
okay gn
*its not even 12pm 😳 *
some people have whats known as a day job
ye
can someone give me a guide on how to use packets because i haven't found anything so far
i mean i have 6 hours of sleep dunno how much they have
already at the station at 7:50 am
6 is on the low end
None what?
Oh
well maybe if you worked at mojang
If you got any ideas
thought you were in bed
Jist tag me
Just*
Maybe i‘ll temporarily remove the server files and show u the repo
steaf, wjere is the code again?
discord doesnt really like scrolling, i always end up on the same place
I‘m going but i still got my phone, gf got mad so i had to hop off lmao
disc is ass when it comes to basic functions
atleast you can buy an animated picture in the shop, thankfully
reminds me i still need to work on my discord frontend
Since i‘m on the phone rn i wont look it up but you can search from:shi0ku in the channel and might find it quicker
look its amazing
damn screen capture on wayland is crazy
totally does not look like how its supposed to be lol
buddy you tell us what doesnt work
No wait what
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
still not in bed
my head is full of generics
give your gf a hug
it feels like im assembling the biggest generics puzzle I have ever made
my head is full of cells
I have this cursed class and intellij says the cast is unchecked, I asked a similar question a bit ago but might as well see just in case; There is no way to do a checked cast with the generic stuff right?
or any suggestions how to do this better are also welcome
your theme is cursed
I said a better one
catppuccin
default is better
hmm yeah thats better, thanks
anyways looks like my code is perfect then
good
is there a way to direct a bee in acertain direction?
no
wdym if it works, you wrote it
hi, i tried creating a custom dimension but when i start the server, the console is spammed by [23:24:00 WARN]: Ignoring heightmap data for chunk [x, z], size does not match; expected: 52, got: 37
cuz its important that it does stuff that works haha
also it should be Class<? extends NodeSerializable>
there is
in fact
a way
it is called
Class<T>
oh right
ideally I wanna construct a T ofcourse
but yeah
java 21 doesnt have new T() yet so
theoretically casting a Class<NodeS> to a Class<? extends NodeS> should work? ike?
it's against the core philosophy of the lang
yes works
or the other way around
wait sorry where do I fill this in?
NodeS extends Object of course, but iirc ? extends NodeS also allows NodeS
....
the Class<T> thing
it kind of does
classType
because ? itself extends Object and you can use Object inside of it
tell me
TypeToken
don't quote me though I'm tired
right, I now have Class<? extends NodeSerializer>
never touched those actually
I kinda forgot about ?
or never bothered to see how they work
u can capture the type with an anonymous subtype
(renamed NodeSerializable to NodeSerializer)
realized smth like that yes
do you have an example or link for that?
TypeToken<X> x = new TypeToken<X>(){};
the type is captured in the type param
so u can get it
and check if its a concrete class for example
and then instantiate
i mean does it use Class::getTypeParameters?
which asks filled in generic type to runtime
i mean u can use whatever u feel like
its just the fact that its able to catch types in type params
ofc it doesnt look great once compiled
since u get a ton of anonymous classes
oh fuck I just realized my code wont work anyways
ill see tomorrow, off to bed, gn
guys there is a way for make the bee attached to other stuff and not only poppy ?
iirc they go to all flowers?
no like another crop
hey, in my plugin I should to get some chunks to serialize them the problem is that I need to load/get 3x3 (9) chunks and it seem to make the server laging, may I retrieve the chunks in async?
do air bubbles trigger an event?
When a player hits a boat, the boat shakes. Is this something you can invoke?
Show code
isn't this just a fancy generic throwaway obj
Hey, I want to create a world that loads every time the server starts with these attributes:
- The world is void except for my prebuilt builds without block changes. Like a hub world
- I want to avoid saving garbage data over time in the world file
- I want to preload chunks when the server starts
I found the SlimeWorldManager plugin to avoid saving unnecessary data, but I think this is designed for worlds where blocks are modified. Would creating a new world file every restart be a good idea?
I’ve also had issues with void worlds getting corrupted over time, forcing me to delete them to avoid errors. Which wouldn't be a problem if I create a new world every restart but I still want to learn how to successfully create a world.
A tutorial link or recommended approach would be appreciated
Just unzip a clean copy of the world and add a chunk ticket for the chunks you want to keep loaded
SWM supports read-only worlds. The idea is that you can have a mutable world and create copies of it
search my name and VoidGenerator
I posted a void generator. Its very simple

lol
I get 8 results 🙂
mr choco
Magma is broken
you are so dum
Whats the name for the black particles that emit when you ignite a tnt or creeper?
Thank you all I will try these out 👍
How do you guys do to add gifs in your plugins description? (what platform)
I hacked choco's computer and infected his pc so he's now distributing my gifs
why is bro shitposting in helpdev
oh buddy hold on to your seat
I'm about to drop a hot one
☠️
@worldly ingot I want to apologize for going for so long without dropping a super hot track for you, you put in hours every day into the Spigot project and I have lost sight of the sacrifices you do every day. Please take this fresh new track a my apology and thanks for all of your hard work.

someone ban this guy
Someone promote this guy
and this, ladies and gents, is how you know you've made an impact within your lifetime
Someone eat this guy
if you shift while clicking the reply button, it automatically will turn it off for you
im using Eclipse IDE how do i make my Plugin a Spigot plugin
actually that guide is kinda bad
it'd be better if it told you to use maven/gradle
and the maven guide for eclipse is empty lol
I have an issue i've been stuck on for way too long now. So i've been implenting logout villagers as in when the player logs out a villager is spawned for 30 seconds then it despawns or the player logs in. this works perfectly when a player is nearby but nowhere else. My question is how can i keep the chunk the villages in loaded?
i should have mentioned im using version 1.8.9 for minecraft but this made me realize the chunk has a load method so ima try this
which hasn't seemed to work either
just give your villager cool particles, that should load it
acc i lie i think it worked perfectly
i will infact still add particles tho 🙏
i lied again bloody hell
How can I make a text display be on top of another? I want to make a text system that is under the player's name, but it doesn't work for me. I tried it like this.
why not just join the text by newlines into a single text display?
it doesnt work
I assure you it does
i think you think using \n
but i tried 🤔
line_width: Maximum line width used to split lines (note: new line can be also added with \n characters). Defaults to 200.
Plus I’ve used \n before
ive tried with string builder and \n to split them, but ill try again
how do i see the code mojang used for their commands?
You dont

That mojang doesn't release the code for there servers?
I'm using AlessioDP's fork of libby to download dependencies at runtime (I know that Spigot now has a feature which solves this problem but that wouldn't work in Bukkit and other servers unrelated to Spigot). Someone has any idea on how to use this library? I can't find much detailed information on how to use it and some examples confuse me
im 99% sure the plugin will still work you just havent downloaded the external library
(im new to makling plugins so this might not be true)
Do i need a Command Handeler
it seems like you havent got the bukkit api either installed or configured with your ide. Which IDE are you using?
eclipse
icl im not 100% sure in eclipse as i have never used it but if you follow the steps in this guide it should be good 🙏 https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-eclipse/
or if youre not the reading type im sure videos exist for eclipse but i would recommend giving intellij a try but its up to you
You can see mojangs commands if you look at the decompiled server
Bukkits command system is quite different though
When i try to add The Spigot api 1.20.6 It Closes The File explorer And Doesent Add it
i can Reinstall it if it helps
i mean are you able to use intellij instead? imo it just seems easier to get things working
nahh get the community version
how
alr
is htere any like minecraft names that are skulls of mob heads>?
like all animals
i remember there being one
i think it was MHF_x like MHF_Skeleton or whatever
thank you
or be clever and get an isic id
imagine
cheap af
gives so much good stuff
LIKE ACCESS TO ALL JETBRAINS PRODUCTS WOHOO
what does ultimate even do anyway
allow you to publish projects without getting sued
isnt that only if youre making a profit tho?
huh
if you use the free version for when you have an isic id
you agree that you wont publish anything for commercial purposes
so its actually worse
?
I dont think i can do anything right
any1 know how i can make my own like levelup variable
a player variable cause each player will have one
will you need this information when the player is offline
Shouldn’t
It’s like a rankuo system
Rankup
what if you wanted to create a level leaderboard down the road
I don’t
if you are sure you won't ever need it offline, then just use PDC
What’s a pdc
PersistentDataContainer, all entities have it
Alright thank you
public static final LEVEL_KEY = NamespacedKey.fromString("level", MyPlugin.getInstance());
int currentLevel = player.getPersistentDataContainer().getOrDefault(LEVEL_KEY, PersistentDataType.INTEGER, 0); // The last parameter is a default value
player.getPersistentDataContainer().set(LEVEL_KEY, PersistentDataType.INTEGER, currentLevel + 1);
example usage
Thank you very much
Hey guys how can I set items durability in 1.20.1?
/** @deprecated */
@Deprecated
public void setDurability(short durability) {
ItemMeta meta = this.getItemMeta();
if (meta != null) {
((Damageable)meta).setDamage(durability);
this.setItemMeta(meta);
}
}
this method is deprecated
Damageable#setDamage
declaration: package: org.bukkit.inventory.meta, interface: Damageable
how can I get damageaable?
You can get it from ItemMeta, check if the ItemMeta is a damageable with instanceof
oh, thank you
if (itemMeta instanceof Damageable damageable) {
// Do your stuff
}
```Don't forget to set the item meta after changing it.
private void decrease(ItemStack itemStack) {
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta == null) return;
if (itemMeta instanceof Damageable damageable) {
damageable.setDamage(1.0);
}
}
like this?
oh thank youuu
Yes that's correct!
you made my day! Im very appreciate
Ah glad to hear that!
Is there a guide to uploading paid plugin to spigotmc? How is the author supposed to add in authentication for each paid copy?
This is the guidelines https://www.spigotmc.org/threads/premium-resource-guidelines.31667/ and you can't have like a license system on spigot.
I got my resource leaked a lot, at this point I'm just ignoring it, like there's no point.
what is it?
My resources? ItemSkins, PlayerCosmetics, NextGens.
The people who used your leaked product are never your potential customers anyway, so just ignore them.
Well, someone who bought it leaked it, right?
Yes, usually someone that owns a leak site, and they sells membership on their site.
So it's like an investment for them.
what is the fastest one-pair collection for contains() function?
this is what i tested so far
(for 1m elements)
use a parallel stream for collections with millions of objects
you got a point
Do you have to send spigotmc staff the unobfuscated plugin for them to verify it?
Yes you have to do that.
parallelism just made it take way longer
that doesn't make any sense
I think HashSet is the fastest.
holy cow
Hashing is meant for that. For any other structure you basically need to look out the whole structure in order to know if the element is present. HashSet uses HashTables that makes the looking out O(1)
mornin yall
if i set a new name for a player in their gameprofile, how do i reset it? to i need to cache the uuids and map them to the custom name?
since i'm at work i cant test anymore :(
maybe you can regenerate game profile (it probably take the name from mjoang api with the uuid)
but it probably better to map uuids
because for client world dont exist, in witch case exactly the client open load screen?
i don't understand the last message but what i got from that is i should map it lol
Why would you want to give the GameProfile a new name ?
The HashSet implementation basically uses a HashMap internally, and is as good as your hashes are
wait what
The more hash collisions you have, the less efficient the hash collections are gonna be, in the worst case being O(n) for a lookup
What confused you?
The fact that it uses a hashmap internally, how is that supposed to work
HOw can I generate a void world properly?
It just inserts your element as the key with a dummy value
Create a new ChunkGenerator that just creates the chunk data and no blocks, then use WorldCreator class with your ChunkGenerator to generate the world
to make a player have an actual different name. A /nick command
and not only the chat name
Hey
How can I run something before respawn & after respawn event?
Is there something like PreRespawn?
Like this? I'd like to send chunk packets to the customer, but in this world they don't apply
public class VoidGenerator extends ChunkGenerator {
@Override
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) {
return createChunkData(world);
}
}
// main class
public void generateVoid() {
VoidGenerator voidGenerator = new VoidGenerator();
WorldCreator wc = new WorldCreator("void");
wc.generator(voidGenerator);
wc.createWorld();
}
This is the way to do it. But what do you mean by chunk packets ?
Aren't you trying to just create a void world?
yes its complicated to explain why but I want to make a void world where I can send chunk data packet (load a chunk for a player)
it's just a packet that loads a chunk by providing blocks and other things
well, there's PlayerDeathEvent and I suppose this will always happen before PlayerRespawnEvent
i for example use this to "revive" a player. using /revive adds the players inventory and the id and the death location to an object and if the object is not null the player's inventory is cleared on death, and when clicking respawn they're teleported back to the old location as if nothing happened
i never tested it tho, it might not work lmao
especially the Inventory part
well it seem that it dont wokr because in nether and my generated world the max is (0-319) (inworld its -64 - 319) how can I change that?
simd is fucking mad. 80% improvement????
HashSet is just a wrapper for HashMap
and a HashMap has a lot of space, gets an index from the inputted Object::hashCode and either knows exactly where something is or just has to iterate through a few (at most 3 elements, otherwise it creates another LinkedHashMap within itself)
while an ArrayList just checks every single element
I think I once had a scenario in which a HashSet for some reason was slower than an ArrayList
I believe it was a simple for loop
lists are faster for insertions
Hi, TabCompleteEvent doesn't work for me because my commands are sorted by alphabet but what it's supposed to do is shown in the code. Can you help me? ``` @EventHandler (priority = EventPriority.HIGHEST)
public void onTabComplete(TabCompleteEvent event) {
// Überprüfe, ob der Sender ein Spieler ist
if (event.getSender() instanceof ProxiedPlayer) {
String cursor = event.getCursor().toLowerCase();
List<String> suggestions = new ArrayList<>();
// Wenn der Cursor nur / enthält
if (cursor.equals("/")) {
// Befehle in der gewünschten Reihenfolge hinzufügen
suggestions.add("/support");
suggestions.add("/help");
suggestions.add("/discord");
} else if (cursor.startsWith("/")) {
// Wenn der Cursor einen Befehl gefolgt von einem Leerzeichen enthält
if (cursor.matches("^/\\w+\\s.*")) {
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
suggestions.add(player.getName());
}
}
}
// Lösche die aktuellen Vorschläge und füge die neuen hinzu
event.getSuggestions().clear();
event.getSuggestions().addAll(suggestions);
}
}
}```plesse help
Quit message not appearing
yeah that makes perfect sense
since ArrayLists just use an array, for loop traversal is much faster
Makes sense
while a HashMap uses a Node table array
At the end I ended up using a BiMap for that program lol
And it still isn't completely efficient
the hell is that
oh guava
stuff
it is only disallowed to have the server.jar in a public repo right?
Or more like, you can get the key by the value and the value by tbe key
Basically yeah
But it's way faster than when you iterate over the values
I was writing a little handler for mappings so it was the ideal thing to use
I'm getting the following error message when enabling my plugin: https://paste.md-5.net/agemesamam.cs
Code: https://paste.md-5.net/hihuyakutu.cs
I have no idea why tf it is telling me that serverDataManager.get(obj) is null?! wtf
makes no sense
wait
does the PluginEnableEvent get called after the onEnable method is done???
if so, is there any event that is called before it's enabled? :' )
i know it wouldn't make sense bc to register a listener the plugin has to be enabled :/
wait
i could instantiate the stuff in the event instead of in the onEnable
right?
yep worked apparently :D
onLoad maybe?
onLoad runs before onEnable
so it should be used for things that need to get done before its enabled
mhh no bc i have to load the serverdata using an event
(bc of the way the data stuff is built)
i mean it's working fine apparently. I just used setters and getters to set the VaultManager
so that the loading happens before the event
But on my server, all orders are still sorted by abc and not as in the event
hi, im currently working on a mingame and i am facing a little problem with the death handling, currently when a player dies in the minigame world:
-inside the deathevent listener, i cancel the death message and calculate a custom one and send it to all players participating
-i call p.spigot().respawn
-i tp the player back to his original position ouside the minigame, and give him his inventory/xp/heart count/potion effects back
the thing is, everything works fine, except that once the player is tped and gets his items back, i still see a respawn menu where the button is kinda jittered and only works after a couple of seconds but after i press it i dont get tped or get a new inventory the player has the data he is supposed to have
Call player.spigot.respawn 1 tick after death
Imma go try it, thnx!
No 1.20
Other way would be to never have the player respawn.
Listen to any damage event and if the health would drop below 0 do your custom logic and whatever and mainly cancel the event and heal the player.
Ye I thought of that but I would have to manually set up all the death messages
Ohhh that makes sense
Thnx!
which is pretty simple tbf
and you can call player death event yourself
so that other plugins dont bug out
Hey I added an API library through maven, and I got access to the imports while coding, but for some reason when I compile it says cannot access 'import'.
Does someone know what could be causing this?
did you restart the ide?
.
I just did but it didn't fix it
oh damn xd
Will changing this give me a new java or do I need to download something?
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>```
configure your IDE to use teh correct java JDK
currently its using "C:\Program Files\Java\jdk-17\bin\java.exe"
Class file version 65 is Java 21
Thank you I will try to find it
It solved the error thank you 🤝 Now I got outdated remapped mojang tho so I will search the tutorial again
java.lang.IllegalArgumentException: Unsupported class file major version 65```
Updated the maven plugin everything works now https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/ thanks jeff
since bukkit seems to be doing the exact same thing
Just wondering is this available in 1.8 or no
just store it on your own
NMS or NBTAPI
or that too, but I'd just store it on my own rather than deal with NMS
Define store it on my own
have a Map and write it to whatever flatfile format on server close
or whenever you feel it is necessary
Im gonnna use a hashmap
no im just dumb
just didnt register the listener
thanks tho
public void quit(PlayerQuitEvent event) {
Player player = event.getPlayer();
PlayerLevelManager playerLevelManager = this.levelManagerHashMap.get(player.getUniqueId());
if(this.levelManagerHashMap.containsKey(player.getUniqueId())) {
this.getConfig().set("PlayerLevels." + player.getUniqueId() + ".level", playerLevelManager.getLevel());
this.getConfig().set("PlayerLevels." + player.getUniqueId() + ".xp", playerLevelManager.getXp());
this.saveConfig();
}
}```
anyone know why my level isnt saving?
Could it be UUID having - in it ?
Add a debug message inside the if block and check if it actually runs
Speaking of the if block, do a null check over the playerLevelManager instead of containsKey
And probably don't forget to cleanup the hashmap when the player leaves ?
public class PlayerLevelManager {
private int level;
private int xp;
public PlayerLevelManager(int level, int xp) {
this.level = level;
this.xp = xp;
}
public int getLevel() { return level; }
public void setLevel (int level) { this.level = level; }
public int getXp() { return xp; }
public void setXp(int xp) { this.xp = xp; }
}
i have it does
i did then i removed it because i thought that was the problem
ok
wait, you're doing player.getUUID()
that is an object that will be stringified
How does the save file look like
this.getConfig().set("PlayerLevels." + player.getUniqueId() + ".level", playerLevelManager.getLevel());
this.getConfig().set("PlayerLevels." + player.getUniqueId() + ".xp", playerLevelManager.getXp());
this.saveConfig();
this.levelManagerHashMap.remove(player.getUniqueId());
saved* file
yes
nothing shows in the cfg
nothing at all ?
Try saving with player username as a test
player.getUniqueId().toString()
where does this go
does this replace the uh
yes
getUUID
It should already do that automatically
replace player.getUniqueId()
ok
yeah I remembered that later
can you send the whole class?
yeah
there are a couple things unrelated to it
message too long
please try this
?paste
wdym
instead of the unique id use player name
I suspect the UUID having - being the culprit
alright ill try
so player.getName or whatv it is
ye
oh no
i cant
AS A TEST
my things require a UUID
Ah alright then I got no clue :D
thing is
what exactly is not working?
i think the tut i watched
levels dont save on leave
i think the tutorial didnt include a saving part
but i thought it did
from the code you posted it looks to save an xp and level at login
you only update teh config on player quit
Line #80 is wrong
Should be !hasPlayedBefore no ?
oh it is aswell
But that does not fix the not saving problem I guess.
need some math help
i need to simulate generating a random between (lowerbound, upperbound) but I need to do it many times and then sum them all up
I remember from stats class that I can use a normal approximation
if you are doing a sum at the end just calculate teh single random
mean is obv the avg of upper and lower bounds
Is that not effectively the same as one random
nope
it is, though
Lmao
i overthought it
wait no
1 dice roll 1-6 evenly distributed
2 dice rolls is 2-12 but not evenly distributed
since there's 1 way to get 2 and 12
but many more to get other values like 7
anyhow, so the mean will be the midpoint
that's a special case
it isnt?
it is
nvm, you have a point
mistake
So you want a logarithmic random basically?
here if each mob has a prop% chance of dropping something, you can calculate how many mobs should drop something by doing the normal approximation to the binomial distribution
Do you really need that precision though?
but thats not going to be a percentage chance of a drop
yeah, central limit theorem
i use the %chance of a drop to calculate how many mobs should drop sumn
YES thats what it's called
ok
found it
ty @grim ice
np

i tried it but aint working
same for this
the game rule most certainly does work
i still get the menu thing
i tried setting the game rule thing and calling the respawn and not calling it
both cases it didnt work
server and client versions?
hey guys is there any way to paste building adjust as around environment?
1.20.4
then something is preventing the gamerule from changing because it certainly works on a clean server
or you have some absurd mod/client but yeah idk
the thing is, i am setting the game rule only for the minigame world only
maybe thats the problem cuz he gets respawned in the main world ig
or does he respawn in the same world?
respawn point is global, you can change it either permanently or dynamically in the respawn event
but game rules should be per world I believe?
idk how that works exactly
ye, i set the do immediate respawning for the mini game world
but the minigame world is different from the main world
and like maybe its cuz when the player dies he respawns in the main world?
How do i make Code Run Everytime a Player Joins
PlayerJoinEvent
show code
PlayerJoinEvent
emm xd
;-;
im bad at coding
first time codder
ohhhh
good try but you need a few pointers
yee u cant just jump into plugin making
well i started with a Few Skripts
Plugins don;t use a main method
maybe go learn some basics of java would take u around 2 weeks
what IDE are you using?
ye but u need to learn complex stuff bout java
alr
i mean if u really wanna write plugins u can but its always better to write scripts u actually know how they work
Man i just want a Simple Player Welcoming Message
i dont think he can understand what extends and implements mean to use listeners T-T
follow that tutorial, it will show you how
u saw how he placed that method
yes, so follow the tutorial, he can learn
ima Just watch a yt video
;-;
💯
even if u finish the video and fully understand what bro says
u needa actually use those concepts
maybe what Elgarls linked could help u start out
try it out
but first understand a lil bit of the syntax
how methods/variables/classes work
well i have adhd and its harder for me to just read text rather then watch videos
we all used to say that 😭
get the tutorial plugin working. then you can add a welcome message to it easily
small steps will get you there
just scientifically not true
ok well personaly for me its easier to watch videos
isn;t adhd becoming super focus on a thing?
you just don't want to read 
Yeah
its the morning
i dont want to do school basicly
you will asume later that reading docs will be more usefull
but at some point we all start
guys i say we chill on bro, he still doesnt know how basic stuff works the link ouwld be so confusing
so you want to learn java, but you dont want to put in the effort?
ye
well last night i was seeing what code chat gpt would make
just let him do whatever he thinks is better for him. We are just giving advise
Everything Gave me errors
yeah chatGPT is not good unless you give it very specific instructions
listen before u go out following tutorials using chat gpt just understand how basic stuff works u dont even know what a method is from the code u sent
probably cause your project wasnt correctly setup
If your gonna use chatgpt, use it well
But I don't recommend it
crackma relax xd
Just a Small Insert
'''package com.example;
public class EnhancementChangerPlugin extends JavaPlugin implements CommandExecutor, Listener {
private final Map<UUID, Long> cooldowns = new HashMap<>();
@Override
public void onEnable() {
// Register the command and event listener
this.getCommand("enhancementchanger").setExecutor(this);
Bukkit.getPluginManager().registerEvents(this, this);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("enhancementchanger")) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can use this command.");
return true;
}
Player player = (Player) sender;
if (!player.hasPermission("operator")) {
player.sendMessage("§3You aren't allowed to do this");
return true;'''
Because your gonna be in a loop of "fix this bug pls"
Do you acc change the package com
Or leave it
yeah GPT doesn;t understand that JavaPlugin already has a CommandExecutor
i changed it to not give me a error
What the colors don't even work in this
guys before talking about packages have we noticed his return statement at the end 😭
did you add any dependencies?
don't think so because he even knows how methods work
btw how do you get it to show up like code inside of discord
balls
So like this
Yes
learn java, but if you want to go straight to plugin development - dont ask for help here
Before using chatgpt please learn booleans
And the pom xml
👍
Hey
I'm getting this error: ```
[23:09:03] [Server thread/WARN]: java.lang.ClassCastException: class net.minecraft.world.effect.MobEffect cannot be cast to class net.minecraft.world.effect.MobEffectList (net.minecraft.world.effect.MobEffect and net.minecraft.world.effect.MobEffectList are in unnamed module of loader java.net.URLClassLoader @4f8e5cde)
[23:09:03] [Server thread/WARN]: at UltraHide-1.1.1-4.jar//dev.eymen.ultrahide.nms.NMS_v1_20_4.refreshSelf(NMS_v1_20_4.java:193)
[23:09:03] [Server thread/WARN]: at UltraHide-1.1.1-4.jar//dev.eymen.ultrahide.data.HidePlayer.hide(HidePlayer.java:85)
[23:09:03] [Server thread/WARN]: at UltraHide-1.1.1-4.jar//dev.eymen.ultrahide.commands.PlayerCommands.onHide(PlayerCommands.java:97)
This is the piece of code that gives error: ```java
connection.send(new ClientboundSetExperiencePacket(serverPlayer.experienceProgress, serverPlayer.totalExperience, serverPlayer.experienceLevel));
for (MobEffectInstance effect : serverPlayer.getActiveEffects()) {
connection.send(new ClientboundUpdateMobEffectPacket(serverPlayer.getId(), effect));
}
New code
public class Main {
public static void main(String[] args) {
String name = "Hello";
System.out.println(name.toUpperCase());
}
}```
am i doing better
I think the Mobeffectlistener is being incorrectly casted to Mobeffectlist
Not sure though
it looks to want a list not a single instance
try sending serverPlayer.getActiveEffects()
Don't name your class main
what do i name it
class Main is correct for Java
It's a collection tho
not for a plugin though
then look to see if there is a way to pass all effects to MobEffectList
possibly a static helper method or constructor
Yeah
Please watch a tutorial
i am
i can decide rn between a boolean in PlayerData (which is loaded when a player joins) and a Set<UUID> in ServerData (which is loaded when the plugin is enabled and is kept for the whole session)
downside for the first one is: i would have to get the EntrySet onJoin for a check. which of these is better or are they the same?
I linked you a full plugin tutorial
Is that from Kody Simpson?
ima watch every one
yea
And uh try to stay organized w packages
alr
oh god
Yes, things that are fun
wait, it should be the same, no? bc the entry set is also a HashSet
I believe it doesn't apply to things they don't find fun
should i use the newest version of java
boolean with what meaning?
yeah I'm adhd too then 🙂
or lazy
not so fun fact: 1/3 clinically diagnosed adhd patients, in fact, do not suffer from adhd
OpenJDK Runtime Environment Temurin-21.0.4+7 (build 21.0.4+7-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.4+7 (build 21.0.4+7-LTS, mixed mode, sharing)``` this shows up when i do ```java -version```
its alr
yeah for sure
so if they're not suffering from adhd are they benefitting from adhd
is your goal to study programming?
no
or to simply make one or two plugins?
i wanted to see how many errors it would make
What do you mean?
When i used it every line of code had a error
why are you trying to code?

