#help-development
1 messages · Page 1049 of 1
its 100% not empty in resources?
in resources it's 0 kb
then fix it. your original is bad
I mean, the file in jar is empty but the file in Idea project is not
remove teh maven jar plugin and test without it
like how?
delete teh profile section from your pom
that makes no sense at all
I've done .nbt file packaging and Schematics myself
you got no errors in the mavan logs during building?
no errors
if you deleted the profile section and are not using filtering of resources your .nbt should be fine. Even if you were filtering it would be corrupt but not empty
filtering causes the .nbt file to have a corrupt header identifier byte
Well it's 0 kb
an empty .nbt file makes no sense, unless you have a messed up file structure for your project and are really looking at the wrong location
I oppened it using note
Well, it could be
show the full project structure
It's too much time... I mean, I didn't even install github
wait..
for some reason saveResource() doesn't work
the folder appears only because of new File(plugin.getDataFolder(), "Schematics/Electricity.nbt")
Still doesn't appears
I commented the code of new File()...
and the folder, file doesn't really appears
OH
I did something
and it works
For some reason the problem was in the path
Like this it works without errors
java.lang.IllegalArgumentException: Cannot find net.minecraft.server.v1_20_R3.PacketPlayInUseEntity
Hello - any ideas on that?
have you run build tools for that version?
otherwise you won't be able to access nms
try \\ for path delimiter
i tried that on my minecraft server
(1.20.4)
How can I order the teams tab?
you almost certainly don't want to do that
https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/PacketPlayInUseEntity.java Where can I find that nowadays?
Since the path delimiter in jar files is /
Nah, still doesn't work
avoid using non-lowercase directory names at all costs
from what I have heard, this may sometimes cause issues on certain OSes like Windows - although that is not something I have seen yet.
Regardless, you might want to look at the compiled jar file and look whether all files are at the place where they should be
windows does?
actually has to do with the FS
the case insensitivity goes back to MS-DOS days and is one of the primary things touted in making windows easier to use
in the original FAT filesystem, file names and extensions are stored as all uppercase making it case insesitive however not case preserving
since then its been improved but the defining feature of being case insensitive has remained in all versions of windows
understood
since linux doesn't do anything in regards to the upper and lowercase characters, they are just treated as being different since they are different in terms of character points
and that concludes historical history

wouldnt powershell Get-Content care about the casing of the filename?
i dont use windows so cant tell
don't see why it would
get-content gets the content of files
whether its textual or binary
as for the name of the file and its path, the casing doens't matter because of how the FS stores references to it as well as the OS being programmed to treat upper and lower casing as being the same character
didnt know that was the case on windows
I'm new to NMS, how do I use the USE_ITEM packet to detect which item the player is currently right clickng with?
package net.minecraft.network.protocol.game;
import java.util.function.Function;
import javax.annotation.Nullable;
import net.minecraft.network.PacketDataSerializer;
import net.minecraft.network.protocol.Packet;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.EnumHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3D;
public class PacketPlayInUseEntity implements Packet<PacketListenerPlayIn> {
private final int entityId;
private final PacketPlayInUseEntity.EnumEntityUseAction action;
private final boolean usingSecondaryAction;
static final PacketPlayInUseEntity.EnumEntityUseAction ATTACK_ACTION = new PacketPlayInUseEntity.EnumEntityUseAction() {
@Override
public PacketPlayInUseEntity.b getType() {
return PacketPlayInUseEntity.b.ATTACK;
}
@Override
public void dispatch(PacketPlayInUseEntity.c packetplayinuseentity_c) {
packetplayinuseentity_c.onAttack();
}
@Override
public void write(PacketDataSerializer packetdataserializer) {}
};
...
}
java.lang.IllegalArgumentException: Cannot find field with type interface net.minecraft.network.protocol.game.PacketPlayInUseEntity$EnumEntityUseAction
Any ideas on that?
Yeah... that's just NMS lol
What do you need a packet listener for? The PlayerInteractEvent gets called when right clicking with an item
Which is called in the player's packet handler
You can use Player#getItemInUse() to get what item is currently being used
How can I prevent a timerTask from being executed or called after the plugin has been disabled? I always get that error on reload
"Plugin attempted to register task while disabled"
int taskId = AnimationUtil.getAnimationRunnable(customGui).runTaskTimer(
instance,
0,
customGui.getGuiDetails().getAnimationInterval()
).getTaskId();
You can maybe use Bukkit.getScheduler().getPendingTasks() onDisable and cancel every task
you can't start a task in onDisable
The animation task is already running
Oh, I'll try, thank you
if it's under teh Bukkit scheduler you can ignore it
it will be stopped by the scheduler
Yeah but it throws an exception
It's not so cute
show some actual code. just a task running will not throw a can;t register error
Maybe you don't get an exception if you use /stop instead of /reload
Yeah but it's going to be a public plug-in
It's a taskTimer, I get the error on reload
even a task timer will not throw a can;t register error on relaod
show actual code
anyone?
use PacketEvents
That code will not throw teh error you are saying
Any ideas why that fails? That used to work
yeah, but how do i get the ItemStack from the PacketEvent
We don't know what you're doing
You showed us an NMS class
public class PacketListener {
private final Class<?> packetPlayInUseEntityClazz = Reflections.getNetworkClass("PacketPlayInUseEntity");
private final Class<?> enumEntityUseActionClazz = Reflections.getNetworkClass("PacketPlayInUseEntity$EnumEntityUseAction");
private final Class<?> packetPlayOutMapClazz = Reflections.getNetworkClass("PacketPlayOutMap");
private final FieldAccessor<Integer> entityIdField = Reflections.getField(packetPlayInUseEntityClazz, "a", int.class);
private final FieldAccessor<?> interactTypeField = Reflections.getField(packetPlayInUseEntityClazz, "action", enumEntityUseActionClazz);
private final FieldAccessor<Integer> mapIdField = Reflections.getField(packetPlayOutMapClazz, "a", int.class);
...
public static Class<?> getNetworkClass(String name) {
return getCanonicalClass("net.minecraft.network.protocol.game" + "." + name);
}
There u can find the code
I changed the register case of some folders, like "Schematics" to "schematics", and trying to package it, but the files still has the same case, and code doesn't, so my code doesn't work how to update case?
Its for cancling you to break the frames
@Override
public void onPacketReceive(PacketReceiveEvent event) {
if (event.getPacketType() != PacketType.Play.Client.USE_ITEM) return;
if (!(event.getPlayer() instanceof Player player)) return;
WrapperPlayClientUseItem packet = new WrapperPlayClientUseItem(event);
ItemStack itemStack = player.getEquipment().getItemInMainHand();
if (packet.getHand() == InteractionHand.OFF_HAND) {
itemStack = player.getEquipment().getItemInOffHand();
}
}```
or just use PlayerInteractEvent
https://paste.md-5.net/igodusaful.cs
Inside the block that checks if the player has the 'break.admin' permission I reuse the cupboard variable that was previously allocated a value and will no longer be used. Should I do this or create a new variable inside this block?
How to place the structure without any random? Like Structure.place() uses some random parametres, but I don't need any Random
So I kinda fixed it - for some reason it is not "action" - but "b" - how do I know that its b?
I used BuildTool and it says: private final PacketPlayInUseEntity.EnumEntityUseAction action; -> action, not "b".
It found it out via getDeclaredFields()
Do you use remapping?
where do i check the list of data the player seonds to the server?
Hello guys, How can I connect minecraft server database to my own website. I mean I started with html. But I want to show like Player Stats on servers or playtime, Login System BUT with in-game nickname and password. Also and skin of the player (you know what I meant, Like if it's cracked to show Steve, and if it's premium to show their own skin) Anyone can give me ideas how can I make that?.
What data
Well you can get up from the Player object
The structure doesn't spawn
If anyon knows You can dm me :)
Believe it’s #getAddress
Are you filtering resources?
That’s an async event, the game might be unhappy about that
something like this:
- Choose the database you want to use
- Learn JS,HTML,CSS / PHP
- Learn Java
- Create plugin and backend that pushes and updates data to your database using Java
- Create your site
- Use JS to send http requests to your backend and get data from database
I mean I know Html css and I created website
it changes the var names idk how thats called, but i guess yeah
But php, i have no clue.
Now learn JS/PHP and Java, it's not like the easy task.
You can learn javascript
Use java spring or jetty to make a rest server
then make your website query that rest server
and use the returned into and display it
that takes a lot of time. Like how can I. using youtube videos :D?
Yeah
it just means you're trying to make something bigger than what you can
(learn before you try)
I know, doesn't mean i can't find one
Nah, it's still doesn't work
No error, no exception, no problem with packaging
Oh
with v
it works
thanks
Finally I understood how to make the basic things that I wanted 😢
But I still need some api to create npcs. Is there any API to create npcs? I don't wanna have a deal with nms
Citizens has an api
Well.. I don't know where to look ,_,
or build it yourself
you want the kyori one
what is the issue here
also
you do want the adventure bukkit platform
ow it has a different one for bukkit?
also, import those static methods as that will make it way more readable
the api is only the text components which you can't directly send to players
didn't understood
nice thanks
wdym
import what?
because this makes it way more readable
but items like compass or playerheads dont trigger that event, because they dont have a "real" right click usage
huh
I assure you they do
nah, imma do it this way, i already tried it
Error
pointing to this
public static void registerLib(Plugin plugin) {
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(plugin, PacketType.Play.Client.USE_ITEM) {
@Override
public void onPacketReceiving(PacketEvent event) {
if (event.getPacketType() != PacketType.Play.Client.USE_ITEM) return;
Player player = event.getPlayer();
ItemStack currentItemStack = player.getItemInUse();
if(player.getWorld().getName().equals("lobby")) {
if(currentItemStack.getItemMeta().getDisplayName().equals(ChatColor.GOLD + ChatColor.BOLD.toString() + "GAME SELECTOR")) {
Inventory navigatorInv = GUIUtils.getCompassInv();
player.openInventory(navigatorInv);
} else if(currentItemStack.getItemMeta().getDisplayName().equals(ChatColor.AQUA + ChatColor.BOLD.toString() + "MENU")) {
Inventory inventory = Bukkit.createInventory(null, 54, ChatColor.AQUA + "TestMenu");
Inventory menuInv = GUIUtils.getLobbyCosmeticInventory(inventory, event.getPlayer().getUniqueId());
event.getPlayer().openInventory(menuInv);
}
}
}
});
}
you don't have protocolLib on yoru server
now i do and it still isnt executing
when i click into the air with the compass nothing happens
Hey ElgarL,
I've encountered an issue where my inventory caches are twisted/intertwined. As a result, the Plugin#initInventories (that firstly loaded them) method does not clear the cache properly unless the entire plugin is reloaded.
Would it be acceptable to avoid spending hours troubleshooting this and instead just handle a language reload when executing /myplugincommand reload?
Btw, I would inform users with a message like "To update your inventories, you need to restart the server or reload the plugin"
What do you think about this amazing approach?
is this a band aid solution
singleton or something
a cache shoudl only ever store reuseable instances
clearing a cache should be as simple as object.clear()
I think you have a shoudl problem
I have a finger/angle of keyboard problem
understandable
Well, a GuiConfigRegistrar instance is recreated on /mypl reload. However, when the PlayerJoinEvent calls an instance.getGuiConfigRegistrar().getPlayerInventories() on join, the data inside is the same as before...
On reload & init
this.guiConfigRegistrar = new GuiConfigRegistrar(
this,
this.getCustomConfig().getConfiguration().getConfigurationSection(Section.GUIS.getFieldName())
);
this.guiConfigRegistrar.register();
(And I've already tested, configSection is up-to-date)
On-Join
Bukkit.getScheduler().runTaskLater(instance, () -> {
instance.getGuiConfigRegistrar()
.getPlayerInventories()
.getInventory(targetUUID, fallBackIdentifier)
.show(target);
}, 1L);
GuiConfigRegistrar constructor
public GuiConfigRegistrar(IdentityPlugin instance, ConfigurationSection section) {
this.instance = instance;
this.section = section;
this.playerInventories = new SetupMap(instance); // (!This should reset it!)
this.inputMenuLoader = new InputMenuLoader(instance);
}
(Sorry for the long message, but it was a few lines of code for each class)
How to get permission of the command? Like I want to know if the player has permission when executes whatever command. I used something like
@EventHandler
public void onPlayerCommand(PlayerCommandPreprocessEvent event){
String command = event.getMessage().substring(1).split(" ")[0];
PluginCommand pluginCommand = Bukkit.getPluginCommand(command);
if(pluginCommand == null || pluginCommand.getPermission() == null || !event.getPlayer().hasPermission(pluginCommand.getPermission())){
event.getPlayer().sendMessage("§7Unknown command");
event.setCancelled(true);
}
}
but Bukkit.getPluginCommand(command) is always null
why are you passing an instance and a Section?, then using instance to read a new section? section will be a cached version
Well, initInventories (which contains the first piece of code I sent before) is executed after reload. This correctly happens since the System.out prints the newest value correctly. Passing that section means passing an updated one
Reload method:
https://paste.md-5.net/ewaleyugap.cs
initInventories method (works, just doesn't clear the cache when re-executed)
https://paste.md-5.net/uvofehojux.cpp
Why are they so arrogant there? 🤣
cuz they are lunatics
why the lambda on setInventoryMap?
Very good question, just removed that Supplier annnnd... same problem 😛
I don't really want to ruin the joke, but
I have to ask out of curiosity as a European, what does that mean? lmao
i meant not
you just asked an european, explicitily as an european
whats the issue exactly, i like design questions
yeah, a citizen of the best empire of the world
germania?
Pizza, mafia and mandolino
ew
Oh, it's half-fixed fortunately. ElgarL found two problems in a row. Now, I'm looking forward to fixing the inventories being empty and unclickable after reload
Hamburger, gang, drug
after a regular reload?
usa be like:
no, internal https://paste.md-5.net/ewaleyugap.cs
I'm not from usa
exhausted, wbu
Nicen't
what
high
Yes
Me too
was org.bukkit.Material removed in 1.20.6? seems to not exist on a 1.20.6 project but on a .2 project it does exist?
Update Intellij
And the jdk to 21
is it a intellij thing?
yeah
Ive try-catched the whole project and found the exception!!!!
java.lang.IllegalStateException: Asynchronous player kick!
I'm about to cry
nothing worked due to this
lol yeah dont fuck around with the world async
schedule it as a sync task
ban doesn;t kick
you still need to kick em or they stay
Well... I was working on presets and can't imagine unzipping sync ahaha
Why not just getting their IP addresses and pushing them into a public repo?
they will leave sooner or later
How to create dimension?
int[][]
why is this not working?? when i right click it doesnt work
?notworking
"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.
@Override
public void onPacketReceiving(PacketEvent event) {
if (event.getPacketType() != PacketType.Play.Client.USE_ITEM) return;
Player player = event.getPlayer();
ItemStack currentItemStack = player.getItemInUse();
if(player.getWorld().getName().equals("lobby") && currentItemStack != null) {
if(currentItemStack.getItemMeta().getDisplayName().equals(ChatColor.GOLD + ChatColor.BOLD.toString() + "GAME SELECTOR")) {
Inventory navigatorInv = GUIUtils.getCompassInv();
player.openInventory(navigatorInv);
} else if(currentItemStack.getItemMeta().getDisplayName().equals(ChatColor.AQUA + ChatColor.BOLD.toString() + "MENU")) {
Inventory inventory = Bukkit.createInventory(null, 54, ChatColor.AQUA + "TestMenu");
Inventory menuInv = GUIUtils.getLobbyCosmeticInventory(inventory, event.getPlayer().getUniqueId());
event.getPlayer().openInventory(menuInv);
}
}
}
about to sent the code, relax
yet ?notworking stays
Why did you use nms?
You can use PlayerInteractEvent lol
3rd time i have to explain this: Because right clicking a compass wont trigger the Interact Event from spigot
NOO
getItemInUse is not what you think it is
i am pretty sure it does
it does, if it doesn't you've found a bug
^
ive now changed it to getInventory.getItemInMainHand
Yes it triggers
now your code will break if the compass is on the secondary hand :^)
thank god the event has this information 🙏
nobody needs that anyways
updated code?
only changed line
ItemStack currentItemStack = player.getInventory().getItemInMainHand();
well too bad this doesnt work
if(event.getItem() != null) {
if(event.getItem().getItemMeta().getDisplayName().equals(ChatColor.GOLD + ChatColor.BOLD.toString() + "GAME SELECTOR")) {
if(event.getPlayer().getInventory().getItemInMainHand().getType() == Material.COMPASS) {
Inventory navigatorInv = GUIUtils.getCompassInv();
event.getPlayer().openInventory(navigatorInv);
}
} else if(event.getItem().getItemMeta().getDisplayName().equals(ChatColor.AQUA + ChatColor.BOLD.toString() + "MENU")) {
Inventory inventory = Bukkit.createInventory(null, 54, ChatColor.AQUA + "TestMenu");
Inventory menuInv = GUIUtils.getLobbyCosmeticInventory(inventory, event.getPlayer().getUniqueId());
event.getPlayer().openInventory(menuInv);
}
}
nah
Well I think display names is not too bad
tells solution which would fix the problem - "nah"
using display name is quite idiotic imho
this doesnt fix it
even if i set the displayName to a simple string and rename the item, it doesnt work
this "solution" is an unneccesary overcomplication
yeah no shit sherlock, probably its not the exact same name
therefore your code does not run
therefore use PDC
mhh
also called "best practice"
would be pretty emberassed saying that
XD
if ur help is shit, im not gonna implement it, sorry ive hurt ur feelings miss
i agree with emily, good luck tho
except it isn't shit
ChatColor.AQUA + ChatColor.BOLD.toString() + "MENU"
your code is, however, given it doesn't work
there is a item given to the player upon joining the server
dont care what is standard or not
thats much of an opinion for your lack of knowledge
dont even know what i know
Just try debugging lol,
plugin.getLogger().info(event.getItem().getItemMeta().getDisplayName());
plugin.getLogger().info(event.getItem().getItemMeta().getDisplayName().equals(ChatColor.GOLD + ChatColor.BOLD.toString() + "GAME SELECTOR"));
plugin.getLogger().info(event.getPlayer().getInventory().getItemInMainHand().getType());```
etc..
can tell, try harder
you cant even tell when an egg is boiled medium, so please refrain from this
to understand in which case something breaks
but equals is false or true?
or just accept that i wont
don't need to -> shouldn't
not main language -> dont care about ur oppinion
no idea -> what you just said
Just chill out, or go dm if you want to have an argue, wth are you doing it here?
bruh
im not trying to have an argument, if someone talks BS though, imma tell them that
pls help i cant punch with hand or sword and when i hold normal item the crit bar loads long
i was just reading and is there any alternative to pdc for 1.8.8?
It's not the chat where the people care about your opinion about what they say, if someone wants to help you, just accept help, or say "I have already done this" or "It didn't work so, I don't wanna do that". Or no one will help you, just because you're acting like this.
Be polite
yeah, but im not accepting being forced upon a "solution" i dont want
and being called basically an idiot when not doing it
Then just say, I don't wanna do that, and ignore
Goksi, grow up please
ur just showing us you havent passed the age limit for discord yet
damn someone stood up with the wrong leg today
cant happen 2 u
wont continue this
dont wanna get in trouble, but i could say soo much rn
It's not the chat to swear
thats why im not continuing
rather leave the server
we dont need that behaviour here
what did bro do to you
says the one bascially calling me an idiot because i wont use pdc
I gave an honest reaction
What Bukkit.getPluginCommand() accepts? The command with / or command without?
🤷 i use the command map/a command framework
or i need a new account
wrong guy
yeah but you should be using pdc 
me the entire conversation
if you compare by displayname and you make one small typo you're gonna be sitting there debugging for hours, they're not final and can be changed easily (e.g. via an anvil), make no sense to do, and litearlly just why
wont explain myself and frankly dont need to
arent mistakes like that the reason why some plugins are exploitable these days
well you're not gonna get support when you use NMS for basic event stuff and use the display name to compare
then im just gonna remove that part of my code next time 😸
ah yes where you could just change every settings and deactivate it completely lol
yeah that's literally what you're supposed to do
- use an event
- use the pdc
nah remove the part of the code, because i know thats not the cause of the error
using nms for that makes zero sense and is just stupid
and then add it later
currently working on using Interact event
Is there a way to get vanilla command by it's name? Like command /plugins or command /stop /reload etc
command map?
And how to get it?
Bukkit#getCommandMap
what version are you developing for
1.20.1
Maybe CommandAliases?
Don't you need reflection ?
That was never a thing I'm pretty sure
what's reflection?
i only have the paper jd in my bookmarks pls don't hurt me
when you look into a mirror
._.
Does reflection count as basic java
yes
never needed it
imagine using reflection
basically stuff you really never want to touch except youre making a framework or whatever
I didn't until I started doing pluginas
if this keep happening even with a clean reinstall it means its not my fault anymore? 😭
clear your ~/.m2
already did
looks like something is corrupting your jars then
Stuff that you will use all the time when doing anything with dynamic types and dynamic instanciation stuff (those two together)
I still need the solution of my problem ,_, (I need to get a command using it's name)
invalidate intellij caches, delete target directories, delete the .m2 folder
listen man
light the house on fire
ASHCTUALLY
For me deleting .m2 would be tragic
i use paper on my servers
kill your neighbours cat
already did but i dont want to talk about that
the fix is the higher purpose
He looks happy
May you help me pls? How to get vanilla commands by it's name? Like command reload, plugins, help, etc
command map
cant you just iterate over the command map
Only 1 of them is a vanilla command (and overriden by bukkit anyways)
And how to get the command map?
But, actual vanilla commands are not in the command map
reflection
They are registered directly at the brigadier dispatcher by mojang
so how to block them?
why is System.getenv nullable and throw an exception when it's null
wtf
o7 pink name
can i uhhh, unmaven a plugin?
what 😳
uh what
Doesn't it have a has method
do you wanna use gradle (my beloved ❤️) instead
rewrite it to use gradle
Gradle is great
cuz im a great maven nojoyer
you can just change the build system and change it manually
WHERE IS YOUR PINK
based
but there is no way to switch it automatically
gone 💔
Thanks
oh yeah i know
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
but yes, you can just switch to gradle
ask chatgpt gradle init and add your stuff
Lol
its probably going to snuck a sudo rm -rf in the middle
What bout I make one
make a maven to gradle converter
Yeah
no point
i would star it
Sounds pretty doable
have fun with multi module shit
Besides marvin plugins
but shouldnt be too hard actually
the process is always the same
except when some gradle users have custom code in their build configs
Well, I can add some hardcoded behaviour when it comes to those, like when the shade plugin is used I add the shadow plugin and configure some stuff if needed
what the fuck is a marvin
maven
oh
already failed the first step, im doomed
lmao
.kts please
👀
basically the same
doc I thought you were a gradle kts user
damn who doesnt like olivo
based

...
whats the name of the api for storing metadata key value pairs again?
to not use NMS directly
pdc
ty 😄
all fun and games till the person who thinks this has an army 💀
Does anybody know how to make DeluxeHub give items to players. I'm trying to make a deluxehub kit menu. But I don't know how to give items to players.
Is better to work with player uuids or full player instances
for example for a queue or something similar
UUID as they won't leak
okay thanks
how to get Plugin from class?
JavaPlugin.getPlugin(...
thanks
anyone know how to set a chest blockstate to single?
idk if the api's not flushed out here or something but i cant get it to work
You're using the wrong chest
You need the BlockData chest not the BlockState chest
theres like 5 different chest types
this is a bit confusing lol
hold on lemme try that
anyone else working with these dependencies on 1.20.6/1.21?
wait which one needs to be the blockdata chest?
the second line or the third line
I have a listener for inventory click event, its necessary to use it in other plugin to handle the inventories created on that plugin? I mean, both plugins will work on the same server
First line
The chest import
?
org.bukkit.block.data.type.Chest
OHH
wait
i get what you mean
holy crap okay
wait
this is really weird then
ive been using the wrong type but its worked
this was earlier when i used the blockstate chest
BlockData doesn't have PDC
and it worked
The state does
wait the blockstate can cast to both blockdata chest or blockstate chest?
blockstate can only be cast to blockstate chest
blockdata can only be cast to blockdata chest
so blockstate chest is a superclass of blockstate
but doesnt have the update() method,....?
wait wait
im casting blockstate to blockdata
this doesnt seem right
yeah that's wrong
yes
just put the data back
ic
fuck man
my code is now a frankenstiein of blockdata and blockstate chest
wait so this is correct 💀
yes
Which one is nicer?
@CommandAlias("mycommand")
public class MyCommand extends BaseCommand {
private final IServerManager serverManager;
private final IUserManager<?> userManager;
private final IOtherStuff otherStuff;
// More stuff ...
@Inject
public ChatFilterCommand(
IServerManager serverManager,
IUserManager<?> userManager,
IOtherStuff otherstuff,
// More stuff ...
) {
this.serverManager = serverManager;
this.userManager = userManager;
this.otherStuff = otherStuff;
// More stuff ...
}
// ...
}
or this:
@CommandAlias("mycommand")
@RequiredArgsConstructor(onConstructor = @__(@Inject))
public class MyCommand extends BaseCommand {
private final IServerManager serverManager;
private final IUserManager<?> userManager;
private final IOtherStuff otherStuff;
// More stuff ...
// ...
}
I prefix >:c
not my fault
I am trying to make a bingo plugin and as one of the options that the players can choose before the game i would like to have smaller Biomes as a sort of fun option to make the game quicker.
I have tried my hardest to implement it purely through my spigot plugin, but I have sadly failed as most sources have just recommended to write a custom BiomeProvider for the WorldCreator but I am just unable todo that (technically i could do that and i have tried, as i would have liked to make a simple wrapper around the default BiomeProvider and just modify the input x and z chunk coordinates by a number larger then 1 to decrease the Biome size, but I was hindered by the lack of a default BiomeProvider anywhere.)
So now I have used a simple Minecraft Datapack that influences the minecraft noise (? tbh that is how i read that it works by working through the files, the datapack itself was downloaded from planetminecraft). And I would like the Datapack to be toggleable on newly generated worlds, is that possible? Or any other suggestion to how I could resolve my issue?
former imo
i mean i still barely like guice, spring di, dagger etc but former communicates the usage of a DI framework clearly
org.bukkit.block.data.type.Chest chestData = (org.bukkit.block.data.type.Chest) block.getBlockData();
chestData.setType(org.bukkit.block.data.type.Chest.Type.SINGLE);
still isnt doing anything
💀
You have to do setBlockData
oh wait it creates a copy?
true. I also don't like guice but I have to use it 🥲
crap okok
thanks
pls tell bukkit to refactor org.bukkit.block.data.type.Chest to org.bukkit.block.data.type.ChestData
this is killing me
😭
wawawawawa
You could at least use var to make your declaration simpler lol
The type is very clearly outlined on the right hand side of the expression so nothing of value is lost
There are times I do wish Java had typedefs though
def wtf.choco.Choco as bad
Well no but this would be nice:
import org.bukkit.block.Chest;
public class MyThing {
using ChestData = org.bukkit.block.data.type.Chest;
public void updateChest(Chest chest) {
ChestData data = (ChestData) chest.getBlockData();
data.setFacing(BlockFace.NORTH);
chest.setBlockData(data);
}
}```
Convenient! :D
bad api
ur bad API
OKAY
ya get gud
knowing the java lang designers, they'd probably want to reuse an existing keyword, lol
import to or import with
I meannnn, they did introduce when recently
They also added yield not too long ago
They're definitely not against new keywords
and they considered the chance to not do that and use && instead, which is odd
fwiw I still really don't like yield lol
it's alright, i don't mind
ANYTHING ELSE YOU WANNA DISAGREE WITH ME ON TODAY, EMILY!?
waffles or pancakes?
I could go for both I have no preference, I switch it up each time I go to a breakfast place
I appreciate a good waffle, I appreciate a good pancake
okay then no, nothing else
okay :)
Oh dear
const x.y.z goto a.b.c
You know what? I regret my initial proposal
Don’t give up hope Choco!
does anyone have experience working with ClientboundAddEntityPacket?
I am trying to spawn in a fake ItemEntity, and I understand that I have 2 basically useless objects, but it's the only method I've found... i'm fully prepared to get flamed for this lol
public void sendDropPacket(ServerPlayer breaker) {
net.minecraft.world.item.ItemStack itemStack =
CraftItemStack.asNMSCopy(new ItemStack(block.getType()));
ItemEntity itemEntity = new ItemEntity(breaker.level(), block.getX(), block.getY(),
block.getZ(), itemStack);
int x = block.getX();
int y = block.getY() + 1;
int z = block.getZ();
Prisons.getPlugin().getLogger().info(itemEntity.getId() + " itemEntity.getId()");
breaker.connection.send(new ClientboundAddEntityPacket(itemEntity.getId(),
UUID.randomUUID(), 54, x, y, z, 0, EntityType.ITEM, 0, new Vec3(0, 0, 0), 0));
}
ignore the logs i was making
You could also use protocol lib / packet events for packets @spice burrow
yea i probably will..
i doubled checked the docs to make sure the values were right and they seem like it
Does anyone know how to make a /hub command for bungeecord?
Def better to use a wrapper lib than straight nms haha
Hello guys, I am creating a anti dupping plugin, what can be the best play to do here?
Depends what dupe you're trying to fix
no, I am trying to try to alert the staff for possible duppers
yea true lol
i like overcomplicating things for some reason
The packet has no idea of what the item is
There's an Entity#createSpawnPacket method iirc
I believe the item is also part of the metadata so you might need that
guys i have question
ahh makes sense, I think I'm gonna try to replicate it with protocollib and work from there
Now I want to create a perk system in one hash map and I want to allow the player to buy all the perks but when the player buys one perk and wants to buy another one it shows that you already bought the perk, I don't want to create a hashmap for each perk, it looks ugly xd.
xd sry
ahah no worries
why do perks even need a hashmap in the first place 🤔 I think your approach to a perk system doesn't really make sense
why can't you just do this with Data Objects and a list
so what's wrong with a Map<String, Perk> inside of whatever Player data object you use
the fact that they already have the perk is on the front end it shouldn't really touch the actual perks the players have active in their playerdata
honestly after thinking about it I'd just use a Set rather than a map
my issue is if the player buy one perk and wants to buy the others the player can not. i think because the hashmap.
wait
you just have a naive data implementation then
each player should have their own perks individual of all other players
and your menu should be regenerated for each player so they see which perks they do and don't have
I can't figure out how to edit Minecraft's original code for the life of me, like adding more enchantments without replacing what's there, same with fishing etc
Oh snap
Fishing loot is also data driven iirc
No more need for reflection with enchantments then?
Ah ok so still needed in that sense
if only there was a registry modification API 😏
🔨
I love construction
there was always the loot tables
http server in c
Wtf
Perhaps bukkit related? kek
Any suggestion of what I can suggest to you?
kek
just throw stuff and see what sticks
I wanna work with some more abstraction so lets think what could benefit most
Make registries editable in the api
That's like coll's job or smthn kek
To insert custom enchants without reflection
I mean the reflection method for enchants isn't that bad
lil hacky but not bad imo
55% of my neurons don't believe that
Have you done it before?
Eh I think you just set "acceptingNew" field to true, then register your enchantment
Look at this
spigot needs to do a shit ton to their plugin loading
tbh
not only does it need a rewrite it needs some way to interact before registries freeze
We went from changing a single field to be accessible using reflection to having to do this, fucking amazing. The first comment on the thread is kinda unfair
its not spigots fault mojang decided to make enchantments data driven and the hack people used no longer is acceptable
Ah snap gotcha
I don't think who wrote the comment explicitly was referring to spigot
Get the big brains on it
@worldly ingot you heard the man
I wouldn't be surprised if they were I mean the bukkit Enchantment Wrapper was recently removed
then enchantments went data driven
I imagine people will get upset the more stuff goes towards data driven and some other unsustainable API breaks

No thanks, no big PR for me xd
Man I'd do it if I knew how
just go for it
There is no better way to learn than to subject yourself to the burning fires of despair
Learn about the damage in minecraft with the PR of DamageSource... So many rewrites xd
damage is so delicate, I would not touch it and any PRs that touch damage should be under very high levels of scrutiny
there are some things I am not looking forward to doing with my server software damage API is definitely one of them
Yeah my changes broke a few things a little but now is more consistent :3
as well as world gen have got to be my top 2 most unwanted to touch
WorldGen and Registry are things i dont touch xd
All I know well rn is menu
When do we start getting dev logs and update notifications for CabernetMC?
I should do dev logs that would be funny as hell
Would love to see it
Is working with the HandlerList directly considered okay? I'm not sure if this is conventional.
I want to use it to register events
Im really trying to use it to register events of certain event types, but you cant register for PlayerEvent type. Ive tried using the plugin manager, so Im just wondering if using the HandlerList is conventional
just copy paste papers 
I mean I feel like this is a try it and see question, if it works it works you can refine it later
yeah, I suppose. In that case, I need to figure out how they work, but Im unsure of how they work
`@EventHandler
public void onInventoryOpen(InventoryOpenEvent e) {
if (e.getInventory().getLocation() != null) {
Player player = (Player) e.getPlayer();
Block chestBlock = e.getInventory().getLocation().getBlock();
if (chestBlock.getState() instanceof Chest) {
Chest chest = (Chest) chestBlock.getState();
Inventory inventory = chest.getInventory();
if (!chest.getPersistentDataContainer().has(NamespacedKey.minecraft("opened"), PersistentDataType.BYTE)) {
if (!isChestEmpty(inventory)) {
if(databaseManager.isKiemTu(player.getUniqueId().toString())==1)
{
List<Integer> emptySlots = getEmptySlots(inventory);
int tiLe = random.nextInt(100);
String tuVi = databaseManager.getNextTuVi(player.getUniqueId().toString());
int tuViConvert = Integer.parseInt(tuVi);
if (tiLe < 5 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapTuyetPham());
player.sendMessage("TEST 5");
} else if (tiLe < 10 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapCucPham());
player.sendMessage("TEST 4");
} else if (tiLe < 20 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapCaoPham());
player.sendMessage("TEST 3");
} else if (tiLe < 30 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapTrungPham());
player.sendMessage("TEST 2");
} else if (tiLe < 50 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapHaPham());
player.sendMessage("TEST 1");
}
}
}
chest.getPersistentDataContainer().set(NamespacedKey.minecraft("opened"), PersistentDataType.BYTE, (byte) 1);
chest.update();
} else {
}
}
}
}`
- I created an event when a player opens a chest and it will add items to it at a custom rate. Chests will be tagged to avoid items being re-added when opening the chest multiple times. But the item is not added even though the message is still showing.
- I tried replacing it with inventory.addItem(itemCongPhap.CongPhapTuyetPham()); but it also has no items in the chest
- Here is some related code.
private boolean isChestEmpty(Inventory inventory) { for (ItemStack itemStack : inventory.getContents()) { if (itemStack != null && itemStack.getType() != Material.AIR) { return false; } } return true; } private List<Integer> getEmptySlots(Inventory inventory) { List<Integer> emptySlots = new ArrayList<>(); for (int i = 0; i < inventory.getSize(); i++) { ItemStack itemStack = inventory.getItem(i); if (itemStack == null || itemStack.getType() == Material.AIR) { emptySlots.add(i); } } return emptySlots; } } - This is the code of the item section
public class itemCongPhap { public static ItemStack CongPhapHaPham() { ItemStack item = new ItemStack(Material.PAPER); ItemMeta meta = item.getItemMeta(); meta.setDisplayName("§8TEST"); List<String> lore = Arrays.asList( " ", " " ); meta.setLore(lore); meta.getPersistentDataContainer().set(NamespacedKey.minecraft("TEST"), PersistentDataType.INTEGER, 1); item.setItemMeta(meta); return item; }
I don't know where I'm wrong, can anyone tell me where I'm wrong?
Somewhere
Can you say it more clearly somewhere?
Whats the go-to way of making holograms follow an entity now?
it more clearly somewhere
I just know it's an error in adding items to the chest because when I get the ratio right, the message sent to the player still shows up but it doesn't have any items.
Can you send your code with triple ` code block
the single one makes it unreadable
so like ``` code ```
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
okay
@EventHandler
public void onInventoryOpen(InventoryOpenEvent e) {
if (e.getInventory().getLocation() != null) {
Player player = (Player) e.getPlayer();
Block chestBlock = e.getInventory().getLocation().getBlock();
if (chestBlock.getState() instanceof Chest) {
Chest chest = (Chest) chestBlock.getState();
Inventory inventory = chest.getInventory();
if (!chest.getPersistentDataContainer().has(NamespacedKey.minecraft("opened"), PersistentDataType.BYTE)) {
if (!isChestEmpty(inventory)) {
if(databaseManager.isKiemTu(player.getUniqueId().toString())==1)
{
List<Integer> emptySlots = getEmptySlots(inventory);
int tiLe = random.nextInt(100);
String tuVi = databaseManager.getNextTuVi(player.getUniqueId().toString());
int tuViConvert = Integer.parseInt(tuVi);
if (tiLe < 5 + tuViConvert) { inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapTuyetPham());
player.sendMessage("TEST 5");
}
} chest.getPersistentDataContainer().set(NamespacedKey.minecraft("opened"), PersistentDataType.BYTE, (byte) 1);
chest.update();
} else {
}
}
}
}```
I have a character limit so I can only send 1 paragraph like this
private boolean isChestEmpty(Inventory inventory) {
for (ItemStack itemStack : inventory.getContents()) {
if (itemStack != null && itemStack.getType() != Material.AIR) {
return false;
}
}
return true;
}
private List<Integer> getEmptySlots(Inventory inventory) {
List<Integer> emptySlots = new ArrayList<>();
for (int i = 0; i < inventory.getSize(); i++) {
ItemStack itemStack = inventory.getItem(i);
if (itemStack == null || itemStack.getType() == Material.AIR) {
emptySlots.add(i);
}
}
return emptySlots;
}```
public static ItemStack CongPhapHaPham()
{
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§8TEST");
List<String> lore = Arrays.asList(
" ",
" "
);
meta.setLore(lore); meta.getPersistentDataContainer().set(NamespacedKey.minecraft("cong_phap_ha_pham"), PersistentDataType.INTEGER, 1);
item.setItemMeta(meta);
return item;
}```
Here are the related codes, it is not possible to add items to the chest even though the correct ratio and system message have been sent
You are not canceling any event so i dont see what you mean by adding items to the chest?
Also getState() returns a replica of the chest meaning that every single time you call that it will return a different object meaning setting persistent data to it wont work
I just want when a player opens a chest to have a percentage of items added to the chest. But this only applies to pre-existing chests, which are generated when the world is loaded instead of being the player's chests
Apply some pdc to player placed chests
Apply the pdc to the actual block rather than the captured state of the chest
You can't apply pdc to a block
Does PDC mean PersistentDataContainer?
Yes
Iirc you need to get the blockmeta and apply pdc to that
Or something like that
the code I provided I think it used PersistentDataContainer right.
Don't use NamespacedKey.minecraft
So what should I use?
new NamespacedKey(JavaPlugin, String)
I will try it now
if(databaseManager.isKiemTu(player.getUniqueId().toString())==1)
``` wtf does this do now
it is used to check if a player is a specific role or not. Because I interact with Mysql through wamppserver with my plugin
but constant interaction leads to my server having lower tps if there are too many players spamming. I don't know how to fix it
Well, you are fetching stuff from your database syncrounosly so, understandable
Is that so NamespacedKey opendKey = new NamespacedKey(plugin, "opened");
Yeah
okay, so, wait, what exactly was your issue?
The item cannot be added to the chest even though it falls into the correct ratio
yeh
Hmm
I'm thinking about putting it in the player's inventory instead of the chest, but it doesn't really fit with the server's mechanics
What if you don't call chest.update(), does that change anything
I haven't tried it yet, I will try it now
wth, When I turn off chest.update(), the same thing appears again
what thing?
Oh I mean items
I'm struggling to understand what you mean
But when turned off, it won't attach the NamespaceKey to the chest, so players will take advantage of this. But it's okay, I understand how it works.
First attach change the inventory, AFTER changing it get the blockstate and do things as before
I think the blockstate is from before you changed the inv
Thank you very much
Thank you for your support
Can someone help me get things to resolve
nothing wants to resolve when updating to 1.20.5+
You can to the chunk
same thing since everyone uses it for blocks within the chunk
Yes you need to create references like this now since they changed a bunch of enums for fun
how do I do that
Like this: ```
public class VersionUtils {
private static Enchantment sharpness;
private static Particle block_dust;
private static Particle block_crack;
static {
sharpness = Registry.ENCHANTMENT.get(NamespacedKey.minecraft("sharpness"));
Integer[] version = Arrays.stream(Bukkit.getBukkitVersion().substring(0, Bukkit.getBukkitVersion().indexOf('-')).split("\\.")).map(e -> Integer.parseInt(e)).toArray(Integer[]::new);
if (version[1] > 20 || (version[1] == 20 && version[2] >= 5)) {
block_dust = Particle.DUST_PILLAR;
block_crack = Particle.BLOCK;
} else {
block_dust = Particle.valueOf("BLOCK_DUST");
block_crack = Particle.valueOf("BLOCK_CRACK");
}
}
public static Enchantment getSharpness() {
return sharpness;
}
public static Particle getBlockDust() {
return block_dust;
}
public static Particle getBlockCrack() {
return block_crack;
}
}
Its annoying ik
Dont do sql calls on sync, instead use an async task which just means another thread to handle those calls
Nothing at all is resolving
Store the results of chests in a map of some sort and have the calls async which store it in the map for immediate access
Do you use maven?
Gradle
?whereami
also update Intellij if you haven't
my intellij is up to date
But you can apply pdc to tileentities
Which a chest is
is there a way to use identifiers in a spigot plugin?
I assume you mean NamespacedKey
yes
bukkit has namespacedkeys, identifiers are called resourcelocation (in mojmaps at least)
Why
I want it for my custom items class
im making custom items and i want them to have unique identifiers and i dont wanna use integer id's
yeah then use namespacedkeys
ty
NAY
not again
I'm going to lose my gourd with how intellij doesn't save my WIP changelog
seriously the hell
I have like 14 different features I had fully documented and it's almost all gone
I actually hate this
I just make my changelog in a separate md file
that's something a crazy person does
they are not going to fix it if you don't report it
and I didn't see any open tickets about it
cool now I rewrote the entire thing and I'm not sure that I covered every change
java.lang.IllegalArgumentException: Cannot find field with type class com.mojang.authlib.GameProfile
Any ideas what to do?
sounds like you're using the wrong mc version
can we see your code
always good when a changelog is so long it blows past the discord character limit
this is how my changes look as well, the only difference is that i name them all as bug fixes
Is there a modern version/way of doing translateAlternateColorCodes
I dont wanna sit and build a text component for every message I have
no, why would there be?
oh, for text components
hmm, i'm not sure
you can don't really have a choice with text component as far as i know
is that free use?
Translates for & vanilla colors and hex in the format (hex:#ffffff) and auto converts to closest vanilla color for bukkit users
Yes it returns the colored string
ah
is that what you were looking for?
no :(
then what do you mean by modern approach?
a way to put "§cHi" in and get a TextComponent out
if you just want raw string to component you can just split it by each colour code then translate and append to the component
I tried that, my approach was very messy and i couldnt get it to work
What? This is already a constructor
new TextComponent(translateAlternateColorCodes('&', "&cHi"));
what
The modern way would be using MiniMessage
no like legit
i did that
and it didnt work
Instead of using legacy text colors
but now it does!??!?!
How is this modern? It does the same thing no?
No
How can you get more modern than the basic one method call?
Instead of using magic color values it properly converts the colors in to components
How is this useful?
So instead of a string containing §c it will a component set to the color red
Game already converts it no problem
They aren't going to change it because no one uses § ever for anything else
wait can i pass it raw still?
Users can easily add hoverable text, clickable text or whatever they'd like
Besides the mini message format is much more readable
<red>Red Text
§cRed Text
so it still allows for §
Why open a tag and never close it
<red>Red Text</red>
That's fine you can do that
Yeah I just llooked at it
redundant
Ik but imo closing tags are great for readability
testing it rn
its like html but without the wasted time of closing it, I like it
return (TextComponent) MiniMessage.miniMessage().deserialize(input);
Can't cast it like that
Your html would be fucked without closing tags, you do know that right?
That's like player.sendMessage("yes"
MiniMessage deserializes to adventure components
ofc I use html all the time
oh well
i dont need textcomponent
it works fine as component
so i dont need to cast
for what i need
oh
it didnt work
Not always
i was lied to
There are html tags that don't need closing tags
Yeah, depends on tags
Does md5 chat color library even remove magic characters?
I use it and the strings still contain them
Not automatically
So how does minimessage bypass this?
It is handled client side the color codes by magic values
MiniMessage serializes the tags in to components
components can have color without magic values
which is the way the game has been doing it for years now
what is a magic value
§ colors are only still there because they haven't bothered to remove them
Yes but arent the components anyways translated to magic values on the server? Since vanilla clients can join spigot
haven'
No
it died
The client can understand components just fine
Legacy formatting codes have been detected in a MiniMessage string - this is unsupported behaviour. Please refer to the Adventure documentation (https://docs.advntr.dev) for more information.
Minecraft has used a proper component system for ages
BOOO
What version did they start that?
Spigot has been behind for like years




