#help-development
1 messages ยท Page 1003 of 1
I am comparing 2 ItemStacks and i need to compare item metas, if one type is null it wont work as intended so i need to get its default item meta somehow
Objects.equals accounts for null
Lets say i want to compare an enchanted itemstack and an unenchanted one and i want it to ignore the enchant part and consider it equal, i csnnot do that if one is null, it will just return false
If one meta is null then that means that the item you're checking has no support for an item meta
i.e. AIR is one of the few that doesn't have it
If that lol
Fairly certain it's an O(1) operation
Yes. It's just a switch statement. I knew it was either that or a Map#get() call
what is the way to write into chat that isnt deprecated in 1.20.4?
what are you using rn
nothing, i tried to look online but all i find is mega old forum posts
Iโm not sure #chat works anymore
rly?
Because message signing
this one default void sendMessage(@NotNull Identity identity, @NotNull Component message, @NotNull MessageType type) ?
damn do they really change that much stuff
also you shouldn't need to look online for these kinds of things, just try writing something in your ide (e.g. sendMessage is quite intuitive) and it'll suggest you the available methods, or look at current javadocs
arent paper plugins able to run on spigot servers?
if they use paper api, no
ah i see
spigot plugins are able to run on paper
so it only works one way
not vice versa
i see
paper adds to spigot
well ill prob just make a spigot plugin then
current javadocs
well i'm on the spigot server so i'll be advocating for it
true I guess
Shut it. You need to pipe down resident paper rep
anybody wanna go solve some parametric equations w/me?
sendMessage("ยงxยงfยงfยงfยงfยงfยงfShut up miles")
Laughs in pineapple chat
Speaking of which I need to improve my insertion feature
find all values of a so that the equation has at least 1 solution
That's not possible
You have 2 variables and 1 equation
Is there a way to get a textureValue and textureSignature from a textureURL?
I currently use this to get a PlayerProfile from an url, and it works for playerheads, but if I want to use it on an NPC I need to set its properties with a value and a signature.
I could just save the value and signature but I was hoping I could use the url for everything so I have to save less and I assume these values are somehow integrated into the link cause how else does it get the head texture.
public static PlayerProfile getProfile(String url, OfflinePlayer player) {
URL urlObject;
try {
urlObject = new URL(url);
} catch (Exception e) {
return Bukkit.createProfile(player.getUniqueId());
}
PlayerProfile profile = Bukkit.createProfile(UUID.randomUUID());
PlayerTextures textures = profile.getTextures();
textures.setSkin(urlObject);
profile.setTextures(textures);
return profile;
}```
They are base64 encoded, yes
The signatures are from Mojang
what are you trying todo?
I donโt think you can derive them from the texture value
I want the value and the signature from the link
You can generate a value, you cannot generate a signature. That's done by Mojang's servers
and the link sends me to an image of the whole skin so it has to be in there right
oh
That's the reason services like MineSkin exist ๐
I think MS has an API as well, so you may be in luck
It does
Citizens uses it
hi friend, i'm running into some stupid error, and i'm not able to figure out y heres the code:
System.out.println(growable.get("material").toString()); // prints "cactus", "sugar_cane" which are a valid imput to
Material.getMaterial(growable.get("material").toString()) // which the function returns the same thing, it gives me error saying the param is null
i addition to that i use the same method in another plugin to do other stuff and they wotk perfectly fine
use matchMaterial not getMaterial as your names are not formatted correctly
also ensure you have api-version set in your plugin.yml
no they are
they are not. ALL Materials are upper case
I believe getMaterial accounts for that
haha
thank you, but I think I will just save the value and the signature cause this sounds like way too much effort for the time and storage I save copy pasting 1 link instead of 2 strings ๐
Idk I always use matchMaterial
getMaterial() is an exception-safe valueOf(). matchMaterial() will do some string manipulation to turn it into a key and pull it from the registry
Ah
matchMaterial() > getMaterial() every time
yes yes
Or Registry.MATERIAL.match() if you want to be fancy, but the former existed long before lol
Deprecate getMaterial when

Deprecate choco when
so... is it possible to generate/get an URL from my value and signature, so I can use it for heads. Or do I need to save all 3 strings if I want heads and NPCs
Thread.sleep(10000) is also O(1)
Yeah so for skulls you should be fine, but for NPCs you need a signature
And to do that you have to use a service like MineSkin
You also need a signature for tab list entries :/
Or you can upload it to Mojang yourself by setting the skin of a dummy account, but why do that when MineSkin has a reserve of like 20 accounts to do it for you
yeah, but can I convert the signature + value to a link or PlayerTextures so I can use it for a skull too. Or is the only "simple" way to give a playerhead and npc textures by saving all 3 strings
rn I get textures for a skull like this textures.setSkin(url);
and textures for an NPC like this profile.setProperties(List.of(new ProfileProperty("textures",value,signature)));
not spigot api !!!!
there is no setProperties or ProfileProperty in spigot api
ic
i guess I will just have to copypaste and save 3 strings. pain
but thanks for trynna help
or
what if
there is an API that gets the URL, value and signature from mineskin using the mineskin url
alright
I still dont understand why encoding skin data is locked behind a key
idk. Ask Mojangles
All skins are hosted on their servers, so y'know
Might be a good way to identify a skin quickly
mojankles
Or even just an api endpoint to encode an img to their b64
Mineskin shouldnt need to exist
i said exactly what i was trying to do
i left to get coffee and now i'm back so i'll now solve it and show the solution
Try with a=-1, not sure if that's what you want. Basically just a cos-curve but with higher amplitudes. Not sure if that's what you wanted
idk we don't have a word for calculus in russian
usually like idk derivitives, limits, other dealings with infinity, etc, etc
is calculus
is this a ridel or are you looking for a solutioon?=
this is a math problem ๐ญ
i thought someone would be down to solve it alongside and we'd compare solutions but apparently not so i'll just send my solution in like 10 minutes
yea what i mean is: if you just wanna know the anser enter into a solver
not sure how you're supposed to solve without a guess and check or a loop of some form
no fucking way
i'm preparing for an exam
how would that help me
bro he knows how to solve it xD
why do you post it in the spigot developer chat thogh XD
haven't done this stuff since scool XD probably forgot how to do that
I have a problem I am not sure if it is solvable (about Spigot, not math XD):
GriefPrevention (I use the API) has an event handler that cancels an event and sends a message to the player causing the event.
Plugin B (mine) wants to allow it under certain circumstances.
Now I can just allow it with higher priority, but I still get the error message from GriefPrevention.
Is there a way I can suppress the message or prevent the event from reaching GriefPrevention?
The problem is that GriefPrevention does not use "ignore canceled" so I can't achieve this by just canceling it beforehand and allowing it again later.
If possible, I want to avoid using ProtocolLib to delete the packets.
Is the grief prevention event itself cancellable?
solveee what?
^ @ivory sleet
i'm like halfway done so far
omg i spend hours on this yesterday -_- thanks ๐
i assume x can be any real number as long as the equation holds?
x is the unknown value, a is the parameter aka any real number
we need to find all values of a so that the equation has at least 1 solution
yea
this was the "easy" one, i now need to do this ๐ฅฒ
find all values of a so that the equation has no solutions
well let's go
i'm not mentally ready to add multiversion support across versions that have and don't have material
as soon as it gets marked for removal i stop supporting any versions lower than that
Hey, Material decompilation is better now without all the switches
Hello how can i make command that has multiple names
like if you type /spawn and /teleporttospawn it does the same thing
Just add aliases to your command in your plugin.yml
You're looking for aliases
how to do this
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
commands:
spawn:
# ... all the other stuff for the command ...
aliases: [ teleporttospawn, gotospawn ]
Have a look there
THANKS
fuck me, i'll have to consider 4 cases
all this time I was registering the command twice ๐
actually 6 because i don't consider D = 0
but i can clamp that back into 4 if I think of II and III as D >= 0
When I add permissions from code, do I need to define each individual permission with their full paths?
Or do something like:
pluginManager.addPermission(new Permission("myplugin.*"));
Not sure how it's supposed to work.
Well, I'll just register all of them.
Actually i never programaticaly registered permission. If i remembered correctly you can still check if a player has a permission that isn't registered and it will work
Really? That's weird, but ok.
^^
yes you can
yes
you can't use .*
this feels SO good to solve
right bottom is the answer
Sorry thatโs incorrect
No it doesnโt, the answer is incorrect as well
Youโll just have to try again next year
which program do u use?
How does that quadratic equation relate to Spigot plugin development? @icy beacon
Projectile motion? Particle effects? Custom terrain generation?
heck yeah maffs
neat
Meth
Why do you need some?
WTH is this?!!
And why is it in russian?
Well, is there a way to imitate a container inventory in new created inventory? I just added something like "custom blocks", and after that "custom inventories" but the thing is that custom inventories are new inventories created every time the player clicks on block, so it doesn't update when player changes something there. How to fix it?
Is there a command for countries to form alliances with each other?
???
Uh in my experience you have to serialize / deserialize contents every time a player needs their specific inv
Then I map those serializations to a player
that draw.io?
land claim?
Towny?
yes
Then go to towny discord lol
I've been doing some research and it led me here. haha
This is spigot development chat, we don't offer support for specific plugins and such but we have #help-server if you need stuff in regards to server sided info and what not, but there is no vanilla teaming / claiming system in minecraft
Towny is the most popular iirc
So go seek support in towny discord, they'll actually be able to give you the correct info as not everyone here may be an expert on towny
ok thx
Is it bad if, in a realistic banking plug-in, I randomly generate (and display) a credit card number and then use UUID to manage data? ๐คฃ
Do you need their discord?
pls
thankyou
Mapping uuid's to your credit card system sounds like valid approach in terms of "credit card ownership"
I'd say keep a backup of those mapping as well but it depends on your system
But. Then what's the point of registering any permissions at all - from code or via plugin.yml - if that's not even required to check for the permissions?
Is there some benefit to registering?
Or am I just making my code more complex by doing so?
You're really just making it easier to manage permission related aspects when it comes to your plugin, ie: Luck Perms might have an easier time finding your nodes although I've never had an issue in those regards when not actually "registering" the permission
Okay, so it's yeah. Maybe useful. Maybe not.
More context dependent imo
Are there any good PDC enchantment libraries or would I have to create something on my own? Just don't feel like dealing with the whole lore display and such.
?pdc if you wanna do a bit of scouting you might be able to find something here
might I am not too sure
It does go over how to work with your own data types, given you decide to just do it yourself
Yea I'm actually working on a pdc system that stores enchantments. I just wanted to see if I was reinventing the wheel though
I think the AdvancedEnchantments is pretty popular.
Not sure if it's what you're looking for. But check it out.
Gotchu. Thanks
They have web interface and everything for people who are not comfortable working with MC data files.
Well, I wasn't necessarily looking for a plugin to use. I'm developing a plugin that is going to use custom enchantments.
I wanted to use some sort of library that didn't require me to depend on another plugin (I've got a lot of dependencies already. Would rather not depend on another plugin).
I may just bite the bullet and make my own system though.
If that's what it takes to make you happy.
A lot of dependencies don't make your plugin bad, rather just gives off a bit of laziness imo kek, not to say that's bad or anything because truly there is no point in like you said, reinventing the wheel
I just remade the functionality of a hat plugin. Because I wanted better control over how it works.
Took most of the day to iron out all the bugs.
Like @worthy yarrow wrote, LuckPerms has a feature to help you autocomplete the permissions when edditing them. Or in their web editor they list all registered permissions. Those who are unregistered will not appear there. So if you have permissions that you know you need it makes sense to register them, but if you have generic permissions wich will be created or deleted during runtime it isn't necessery to register them all. (for example.: in a Lootbox plugin a custom permission per lootbox) At least i only know of LuckPerms that uses a mechanic like that ^^
Ok, well that's actually helpful information.
That's the nice thing about source code (so long as you're not just copy/pasting), it really helps put the structure into relatable terms
It's hard to really say when it's useful from our pov since we're not the ones designing the project
I mean. I didn't know that LuckyPerms has that kind of auto complete feature.
But as mentioned if they are permissions that need to be clarified outside of your plugin, then for sure register them
I used PEX before.
Oh dear
That was 8 years ago.
Feels bad
Imo they just have a lot of usable methods
It's a lot to take in but after about a week I got pretty much a complete handle
does location.getChunk().getX(); load the chunk?
PEX, have't heard that name in years
I don't think so... But you could alternatively just getBlockX() and do some bit shifting fuckery
wdym
i have it like this
oh nvm
wrong question
location.getX()
does this load the chunk it is in?
Location#getChunk() will, Location#getX() will not
If you want the chunk's x coordinate, location.getBlockX() >> 4 should get you it
How do I get the CommandMap with spigot? I understand that it often needs some level of reflection?
I just want to register my commands in the CommandMap directly
I am mainly doing it to allow admins to add their own command aliases directly in my plugin - I am aware they could just use the commands.yml file but would like to be able to give nice tab completion on the aliases
how can i set a custom metadatakey on an itemstack item? (example: CustomBlock_1)
You'll want to access the persistent data container on the ItemMeta
will i have any problems getting location object from config if storing so?
If you #set(Location), you can getLocation()
will that always work? i somewhy remember that i had issue with it but i dont remember details
It should always work unless someone goes into the config and fucks up the format
But that goes for any data. You can't read key "x" if it doesn't exist
.getLocation doesnt load the chunk right?
How to check interact event each tick?
From the config? No it doesn't load the chunk
No clue what that means
If you're holding down right click, the event will continue to trigger but I don't think it's every tick
check if player is holding down right click each tick
I have done a work arround in bows, where it adds you to a map if you have interacted with it and rmeoves you if you shoot, but i noticed that if you just click once without holding the button, it will still count but wont remove you because you did not shoot
so maybe if that's possible to check than it would be good
What's the reason for listening for a recurring interact event though? Is there something about EntityShootBowEvent that doesn't suit your needs?
there's nothing wrong in it, i actually did use it
but when you just click, it does not fire it, so it wont remove you from the map i use
:thumb:
uh
i placed a \ before the : thumbsup: to show that it's thumbsup and not thumb
i thought it wouldn't convert to an emoji
somehow, it did
How do i check if player stops pulling bow without shooting it
\๐
wasn't 1.20.6 implementing entity size options? or did I they just abandon that? or is that nms?
oh its an attribute
how do i put here a custom metadata key to recognise this specific block?
ItemStack obs = new ItemStack(Material.OBSIDIAN);
ItemMeta itemMeta = obs.getItemMeta();
itemMeta.setDisplayName(Color.Colorize("&Custom OBS"));
obs.setItemMeta(itemMeta);
?pdc
does it work in 1.8 plugin?
ItemMeta dosn't have anything called getPersistentDataContainer
so is there a way to give an item a custom meta data key in 1.8?
You'd need nms to attach nbt tags
yes but realistically please switch to a modern version you're missing out
ocp
I saw ur post
what post
Wait i meant y2k
ah kk
anime pfps
they look very similar
You know each other?
well he doesn't yet know but i live in his basement and steal his stuff
@river oracle ๐ง
watch it you punk
weeb shit
Are you trying to uncover the secrets of the universe
OCP code can predict every particle in the universe
it's the laplace's demon
Guys did you know that enums dont comply with the open closed principle
fuck enums
๐ณ
I cant use enums ๐ ocp is too overpowered
parametric equations bring joy to my life
Holy crap lol. That makes absolutely no sense to me
they are difficult
and that is what makes them fun
(most often) not some easy shit that you can solve in your head
The answer is 42
So there is no way to save inventory in some type of PDC? Only items from it?
well actually not a name
serialize items
-> save string on pdc
add other parameters you need
If you use MorePersistentDataTypes you can just save it as a byte array
Or maybe spigot already has that I forget
yeah byte[] is a built in type
Oh I didn't even know that was a thing
hey i have this in my config.yml, how can i get everything ?
i try getMapList but i didn't get aythin or maybe i'm dumb
config.getConfigurationSection("Settings").getValues() and it returns a map
or config.getConfigurationSection("Settings").getKeys(false) if it's about keys
Hey, can I figure out a player ip (the ip he connected to my server like play.minecraft.net) in Spigot API or i should somehow handle it using bungee messaging and a Bungee/Velocity plugin?
You could also put these in an array then if it isn't present in the array set it to false. Would make it a lot easier on end user if you're using almost every material in the game
everything work fine but i keep this in my mind thx
Np, would make things a lot easier for you and whoever downloads the plugin
I mean as far as the Spigot server is concerned, the player is either connected to the server or its not :p
is it very expensive to update /replace like 36 items max in a menu every second?
You can get the IP address of a player connected to a bungee network using the plugin messaging channel. There are 2 messages you would have to use. The GetPlayerServer and ServerIP messages
Check if they're actually online first though because if they're connected to your current server, then, y'know... they're on the current server
Probably not. Maybe network traffic might be annoying. I'd advise not updating an item in an inventory if you don't have to. Always good to throw in an ItemStack#equals() as a sanity check
Or maybe devise some system that would require a method call to actually invoke an update in the inventory for a specific slot
Trying to remove the armor increase of an item but still there?:
itemMeta.removeAttributeModifier(Attribute.GENERIC_ARMOR);
itemStack.setItemMeta(itemMeta);
Are you on 1.20.6?
yeah
Latest version? (/version)
lemme update
Oh, well, actually, I guess the issue is that you're removing attribute modifiers, which the armour doesn't have
Those are the base attribute values
Correct
Does ItemStack#equals involve cloning the meta
no i mean i've my public ip like 69.69.69.69 and there is a domain like play.minecraft.net & mc.minecraft.net which they both redirect to my VPS ip (1.2.3.4 for example), can i figure out the player is connected with 1.2.3.4 or mc.minecraft.net or play.minecraft.net
Oh, no. Because x.y.z is gonna redirect to 69.69.69.69 because that's what a domain does
I wanna put a timer string in the item lore, that updates every second, its like an expiring item
69...?
placeholder
D:
so how velocity figures out Forced hosts? for example i config my velocity to send mc.minecraft.net to send to server-1 and play.minecraft.net to server-2
Placeholder?
I mean yeah if you just want to update one item and you know it's one item, update that one item :p That's fine. Don't need to update the whole-ass inventory if all you're doing is wanting to update one item
but every item has its own time
Different ports, possibly? Unsure
What about hashcode?
so I wanna make a task that updates all items in one go
no i'm sure both addresses just redirect to 69.69.69.69 for example
Oh, well there's one packet for each, so you're kinda SOL there. Can't bulk update items
shit outta luck
lemme explain why i want to code something like this
me and another server are migrating and i've to redirect all of their players to my server, for example my server is server1.com and his server is server2.com, i want to send their players to a server first to explain this migration to them then send them to my lobby
so anyone with my ip (server1.com) should be sent to lobby and server2.com to another server
just put a different server behind the different ip adress
why not
i suppose you could have 2 servers on a bungee, same ip but different ports. If they join from the old domain they go to the informational server, from which they can go to the main server (although this whole thing seems like a whole bunch of extra confusion)
dunno
so this is the main problem
how can figure out which ip he connected
server1 which its mine or server2 (old server)?
from what I said you dont, you point each domain to a different server
server1 points to ip:1234
server2 points to ip:4321
ip:1234 is the informational lobby
ip:4321 is the actual server
yea this is a good solution too, nice thanks
but i'll wait for someone to answer this too, if it was not possible i'll do that
the downside is you have a "useless" server that is wasting resources (the informational one)
a whole server just for forwarding
well domain resolution is done on client side (the client goes through the whole dns resolution process to get the ipv4), as far as i know the actual request to connect is done through the ipv4, not the domain
Good afternoon, an error is happening in my plugin, where everything that comes from config.yml is null, only in Main.java which is the main class that is not. I pass an instance with getInstance() in the main class to the other classes but it still doesn't work.
you need to pass the plugin instance
through your listener
add a constructor
Main plugin;
public ServerEvents(Main plugin) {
this.plugin = plugin;
}
also
you shouldnt name your main class Main
?main
mb
how many times is chunkloadevent fired?
i see it spamming while standing in a chunk
unless the server just started
im also checking the chunk x and z
should only be passing all my checks exactly one time
then you code is bad or your math is bad, or both ๐
Yep it was both ๐
That way you say?
yes
mb
well it is printing alot of times
and same name
Still giving the same error.
show me your config
show code
im pretty sure this two do the same thing
just call saveDefaultConfig
that looks correct, sysout plugin.getConfig().getValues
Is it much of a problem if I am calling an async method inside of async code block?
Common.getInstance().getDataStorageController().getPlayerDataStorage().loadData() returns CompletableFuture and at the same time being called async
estranho
Thatโs fine, if you want to wait for it use .join
muito estranho, tรด a 3 dias nessa
mano, tenta usar as aspas duplas
ao invรฉs das aspas simples
"configblablabla"
sรณ de teste
se nรฃo for
coloca System.out.println(plugin.getConfig().getValues());
English only please
why is it spamming?
Sorry ๐๐ผ
oh, so I could do mongodb.loadData((UUID) key, (AbstractPlayerData) defaultData.apply(key)).join() inside of supplyAsync?
Ah I see, thanks
look at you being a big mod boy
Stay the same kk
this is still spamming
,,๐คจ
its loading all surrounding chunks too
and why was my checks spamming?
shows as null ๐ซ
ok
try to put the loadConfig method
in onLoad method
@Override
public void onLoad() {
this.loadConfig();
}
ok
He has locations in his config so hitting the config in onLoad will throw errors as the worlds are not loaded.
have you try to set your on off key to something else?
im saying to @zenith rain
that's boolean in snakeyaml format
ah okies
Try changing the config from "on" to "active"
this is probably just a java question but might as well ask here. I have a Map<ChatColor, Float> called colors and I am trying to sort teh keys based on the float value. is there a better way to do that than using this ? List<ChatColor> sortedByPosition = colors.keySet().stream().sorted((c, b) -> Float.compare(colors.get(c), colors.get(b))).toList();
Also, is it fine that I am casting the return to (CompletableFuture<T>)? I have a feeling that it's wrong
Why do you need to cast
shouldn't I avoid using raw types?
why does it return CompletableFuture raw?
why is the executor being ignored
:dies:
My God!!! Thanks!
Finally it was
bruh
.stream()
.sorted(Map.Entry.comparingByValue())
.map(Map.Entry::getKey)
.collect(Collectors.toList());```
ah thanks
I knew the double lookup was feeling bad ๐
(this might still do double lookup I guess but now I dont have to worry about it)
this doesn't really do lookups in the same way you were doing them
yeah figured
That's what #hidePlayer() does
Wasnt 100% sure on that, thats why i left the option open
Is it possible to drop from a loot table?
Elaborate
yes
Well, something like:
private void createBirchLeavesDrops(Location location) {
// Get loot table.
LootTable lootTable = server.getLootTable(NamespacedKey.minecraft("loot_tables/blocks/birch_leaves.json"));
System.out.println("Loot table: " + lootTable);
// Get loot context.
LootContext.Builder lootContextBuilder = new LootContext.Builder(location);
// Get loot context.
LootContext lootContext = lootContextBuilder.build();
// Get loot.
var loot = lootTable.populateLoot(new Random(), lootContext);
// Drop loot naturally.
}
yeah like that
World#dropItem
Should I do foreach on the collection?
or dropItemNaturally
Yeah
Ok, so:
loot.forEach(itemStack -> location.getWorld().dropItemNaturally(location, itemStack));
?
Looks good to me
Ok, let's fire it up then and see if it works.
I might have gotten some detail wrong. I don't think it's dropping anything. Perhaps the path is wrong or it doesn't need the .json suffix or something.
Thank @glad prawn , he who answered above
here
Well. I can't get the loot table to work correctly. When I use the LootContext.Builder() it errors out with Missing required parameters: [<parameter minecraft:tool>, <parameter minecraft:block_state>] which are not available.
And when trying to use the LootContext directly it has private constructor. So the only way you can use it is via the builder.
Possibly it's not intended to be used like this.
It seems to have mostly things relating to living entities.
yeah, you need to add stuff to the loot context via the builder
That doesn't seem to be possible.
It only has stuff like lootedEntity, killer, luck, and lootingModifier.
yeah, that seems to be the case. that API has been broken for a while
I cannot provide it with the tool and block_state.
So I guess I will have to create the drops manually.
anyone know why this is using the cb-added restorePatch method instead of just clearing and then applying the patch as normal? https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java#639
anyone have any experience with the LootGenerateEvent? I don't think its being called when underwater loot is generated, specifically for underwater ruined portals
hello what is the best way to convert the string to compountTag
?paste
Hi there. Is this the best/only way to serialize itemStacks from a user-friendly config?
https://paste.md-5.net/sapoxamedi.js
I usually do mine like this
That's cool! Can I use your code and credit it?
Do whatever
why :: not .
Because it's a lambda not a method call
It's basically saying "this is the method we'll call"
and it gets called when the consumer.accept call gets called
๐ค
i have failed to grasp what you are saying
:: refers to the method
. calls a method
if he uses . he will enter the return type as a param
instead of the method
erm, techskcnically it's a method reference, not a lambda ๐ค
Shush it nerd go back to making paper airplanes or whatever you guys do
@simple schooner Why not get a Normal ryzen 5 or ryzen 7?
:pepetos:
Cuz I can't find any other good second hand desktops that fits my budget other than this
Uhm uh believe it or not 10k php or 200 bucks is all that I saved
for the cpu?
My old pc is broken l0l that's why I'm trying to find a good second hand desktop
:pepetoes:
Anyways is it worth it or should I just uhh find another one
I mean, i can't find the cpu you were refering to so idk how much it would cost if you could get your hands on it
Here
Itโs a lower end ryzen, but it was at least part of the Zen 2 refresh
If you had a bit more, you could try getting this one
https://www.ebay.com/itm/125532966557?epid=3042000955&itmmeta=01HY0MW73A8REFM68RHVF3EZ3M&hash=item1d3a590e9d:g:ZJ0AAOSwgZdg2ieo&itmprp=enc%3AAQAJAAAA4Fj%2F59JzZ657dHAt5UeKrtp%2FvlMJRHqkxxCZTbghICMboj6IRrj1fN1wIxgHmCeheMacL3xmRrRPBCqCfpzUmmzKGfezBquih9GGkc6PBadBJ5qQPDIms79SRTXYbPr9ZLMfJt1iNjUTPrQ9WcYB0Ny5AYIL95pI%2BUoqJ7QVm7CaGAaARxH%2BmI8oGGjAmSQPOcYTTvOsen%2B4wjKk69XxdxfJJaQH656QGGAze7rmhmA6hK%2F24wKsrnh4YEwESA6tO247AUXNsBqbDZkOtlPPSn4XI4bz7ml4GP7f15GogxAY|tkp%3ABk9SR_bx8JTwYw
Has 6 cores and 12 Threads afaik
Shit only if I could plug that in on a breadboard and hope that it will magically work
Arenโt AM4 motherboards cheaper now?
Unless, you have a breadboard, that manages ram + pcie + cpu, i dont think so...
Heโs working with 8-bit registers. He knows what heโs doing.
@simple schooner If you want a microatx you could get the ASRock B450M-HDV, its $60
I don't got the budget ๐๐
Whatโs your budget then?
10k php or roughly 200 bucks
Maybe even less inflation is crazy here
- AMD Ryzen 5 4600G 3.7 GHz 6-Core Processor - $91
- ASRock B450M-HDV R4.0 Micro ATX AM4 Motherboard - $60
THATS NOT 91 BUCKS AT ALL ๐ญ
?
4600G?
It's 6195 here
Retail price
I cant wait to escape this shit hole of a country
I spawned in the worst region of the map
Where are you from?
Philippines
Anyways is this good or not
fortunately it is rather easy for you to migrate to another country
Man that'll cost me a kidney and a liver
it shouldn't just have to be smart about it ๐
I'll also sell my testicles so I wouldn't be homeless when I migrate
Yeah I'm trying to find ways to crawl my way out asap
ayo wtf
Before we get invaded by the chinese
you won't get invaded by the chinese
hello ! I want to use the new FoodComponent (1.20.5-6) but do i need to write that much code ?
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.components.FoodComponent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@Override
public ItemStack build(int amount) {
ItemStack itemStack = new ItemStack(this.getMaterial(), amount);
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta != null) {
itemMeta.setDisplayName(this.getDisplayName());
FoodComponent foodComponent = new FoodComponent() {
private List<FoodEffect> effects = new ArrayList<>();
@Override
public int getNutrition() {
return 4;
}
@Override
public void setNutrition(int nutrition) {
}
@Override
public float getSaturation() {
return 0.3f;
}
@Override
public void setSaturation(float saturation) {
}
@Override
public boolean canAlwaysEat() {
return false;
}
@Override
public void setCanAlwaysEat(boolean canAlwaysEat) {
}
@Override
public float getEatSeconds() {
return 1.5f;
}
@Override
public void setEatSeconds(float eatSeconds) {
}
@Override
@NotNull
public List<FoodEffect> getEffects() {
return effects;
}
@Override
public void setEffects(@NotNull List<FoodEffect> effects) {
this.effects = effects;
}
@Override
@NotNull
public FoodEffect addEffect(@NotNull PotionEffect effect, float probability) {
FoodEffect foodEffect = new FoodEffect() {
private PotionEffect potionEffect = effect;
private float effectProbability = probability;
@Override
@NotNull
public PotionEffect getEffect() {
return potionEffect;
}
@Override
public void setEffect(@NotNull PotionEffect effect) {
this.potionEffect = effect;
}
@Override
public float getProbability() {
return effectProbability;
}
@Override
public void setProbability(float probability) {
this.effectProbability = probability;
}
@Override
public Map<String, Object> serialize() {
return null;
}
};
this.effects.add(foodEffect);
return foodEffect;
}
@Override
public Map<String, Object> serialize() {
return null;
}
};
foodComponent.addEffect(new PotionEffect(PotionEffectType.REGENERATION, 100, 1), 0.5f);
itemMeta.setFood(foodComponent);
itemMeta.setCustomModelData(this.getCustomModelData());
itemMeta.setLore(this.getLore());
itemMeta.getPersistentDataContainer().set(new NamespacedKey(HekaCite.getPlugin(), "custom_item_id"), PersistentDataType.STRING, this.getId());
itemStack.setItemMeta(itemMeta);
}
return itemStack;
}
Cause it's a lot of lines for a simple component lmao
yes, you do
Is that even valid code
yes it is
Why do I feel like there should be some generic impl
probably is
sad, gonna split it into Classes
Where is class declaration
thx bro
I thought components could work without setting every value as null entries just fallback to default behavior.
yes me too, but ๐คทโโ๏ธ
Welp ig only one way to find out (the dumbest mistake I'll ever make)
you can't just implement FoodComponent
ClassCastException cannot cast dumb.Plugin$1 to CraftFoodComponent
This looks so wrong
fine
not that you clown
What about #getOrDefault()?
then wat
Still creates the instance for no reason
There should really be a getOrDefault(String, Supplier<T>) ngl
get from the cache, skip the containsKey entirely
Why would i re-init it tho if its already existant?
oh
you mean that
that flew over my head like a plane
So this?
the idea is that you'd put it in a variable to not perform the lookup twice
just use getOrDefault
that would clash if you have a Map<K, Supplier<?>>, although easily solved by naming it getOr or smth instead
Map<UUID, Splayer> cache
?
lol
what was that for tho?
and you wrote splayer wrong its SPlayer and not Splayer
isnt my code
leave my static cache alone
๐ค
You should be doing Map<X, Y> map = new HashMap<>();
Some principle or something, idk
It litteraly is
.
That just sounds like pain tho
Thats how I imagine my cpu feeling
Is Map<X, Y> more efficient cus its the origin of HashMap or smth?
Nah, has to do with hiding impl details and being able to change implementations quicker
Good ol' dependency inversion
There's the naughty word
So this is easier to change?
private static Map<UUID, SPlayer> cache = new HashMap<>();
Let's say you want to replace HashMap to ConcurrentHashMap
Now you only need to type it once rather than twice
If you pass the variable around, also use Map<X, Y> ;)
Never thought about that, should probably add that to my norms
Yep, the 3rd thing i think
Avoid repeating collections calls:
So instead of something like this
this.getEffectivePermissionsStartingWith("skypvp.max.homes").forEach(perm -> {
String[] split = perm.getPermission().split("\\.");
if(split.length == 4) {
int homes = Integer.parseInt(split[3]);
if(homes > maxHomes.get()) {
maxHomes.set(homes);
}
}
});
I should use
this.getEffectivePermissionsStartingWith("skypvp.max.homes").forEach(perm -> {
String[] split = perm.getPermission().split("\\.");
if(split.length != 4) return;
int homes = Integer.parseInt(split[3]);
if(homes > maxHomes.get()) maxHomes.set(homes);
});
just put all teh code in the try, so none of it runs if there is an error
no point in trying to set zero if it error
I forgot, the atomi ints default value is 0
Or you can just use a regular for loop
instead of .forEach
and avoid abusing atomics
setPlain/getPlain :chefskiss:
Hello! I'm currently developing a Bank Plugin and handling transactions, and I'm considering an optimization to minimize database queries by storing transaction data in a session format using a Map with player UUIDs as keys and sets of transactions as values:
Map<UUID, Set<Transaction>>
However, I've encountered a challenge regarding the structure of the Transaction POJO. Each transaction involves two UUIDs, one for the receiver and one for the issuer. This presents an issue where the same transaction can be associated with both UUIDs, leading to duplicate entries and potentially redundant queries. How would you address this problem efficiently within my implementation??
Use Interable instead of fully loading all transactions
Do you mean an Iterable for each Player, stored in a Map?
Like the Set<Transaction> to Iterable<Transaction> but you need to implement it
I don't think you understand what they're asking lol
Set is iterable I don't get the advantage here
It is irrelevant to their question too
Is there a reason you're associating these with UUIDs to begin with?
Why can't all transactions be dispatched in bulk? I don't understand the benefit of separating by involved UUIDs
Or, probably the better question, why are these being submitted in bulk to begin with? I can't possibly imagine you're handling thousands of transactions per second
I think it'd be smart to submit in bulk regardless to prevent the possibility of a third party maliciously submitting transactions en mass to lag the server. (Especially if it's public)
I really don't think it's gonna matter
Database engines are meant to handle that kind of heavy load
There are times where bulk operations make sense. I don't really think this is one of them tbh.
Not really. There's a UUID for the transaction, one for the issuer, and one for the receiver. When looking for a transaction, I want to be able to do it by comparing the issuerId or the receiverId. At the same time, I want to prevent double-querying (if the issuer and the receiver search for the same thing) and prevent making the cache enormous, in certain cases
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Transaction implements SerializableMapConvertible<Transaction> {
private UUID uuid, fromUuid, toUuid;
An example of a valid situation for bulk transaction insertions would be if the bank wants to give every online player $100 or something. In that case you can collect all the transactions and then push them all at once. But this is on a case-by-case basis so I'd argue it's just better to have an insertTransaction(Transaction) and insertTransactions(Collection<Transaction>)
Thank you
Do you think I should avoid caching and just use the database? You were right, I'm not handling thousands of transactions per second for sure ๐คฃ
That also depends and should apply on a case-by-case basis. If you're just doing quick transaction lookups via command or something, you're probably fine to query the database, maybe cooldown the command to only be executable once every 0.5 seconds or something to prevent bad actors
Thank you so much
The only significant issue could be querying hundreds of transactions for a player. Each query doesn't come up as a POJO but needs to be converted, which could be expensive
Should be okay. You should only need to use one query for that, then it's just a matter of doing some very simple data conversions (e.g. from string -> UUID)
And that's all local, relatively quick, dependent on your hardware. But probably not to the extent that it would ever matter
Yeah, something like that ๐คฃ
@Override
public Transaction fromMap(Map<String, Object> map) {
if(map.get("uuid") != null) {
this.uuid = UUID.fromString((String) map.get("uuid"));
}
if(map.get("fromUuid") != null) {
this.fromUuid = UUID.fromString((String) map.get("fromUuid"));
}
if(map.get("toUuid") != null) {
this.toUuid = UUID.fromString((String) map.get("toUuid"));
}
this.amount = (double) map.get("amount");
this.description = (String) map.get("description");
this.timestamp = (long) map.get("timestamp");
this.bankOperation = BankOperation.valueOf((String) map.get("bankOperation"));
return this;
}
Oh yeah you're totally fine
Perfect! Thank you again!!
@echo basalt
Would the Map thing also apply to this?
private ArrayList<OfflineItem> offlineItems = new ArrayList<>();
instead of that
private List<OfflineItem> offlineItems = new ArrayList<>();
Yes
why does this call changeDimension and the portal events? all you are doing is adding the entity to the world. what is happening here? https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java#418
who exactly are you asking
anyone, idk. it's the development questions channel
cc @young knoll I guess
Did I miss a better way to move the entity to the correct world?
I'm just saying, PRs are welcomed
Think of it like you're contributing to Paper. It makes its way down there anyways :p
it just shouldn't be allowed. you create the entity via a world anyways, you should require the world be the world you created the entity from the snapshot with
fair enough
there is no changing an entities world, it just re-creates the entity in a different world inside changeDimension
Are Minecraft bedrock behaviour packs and Minecraft bedrock plugins the same?
Well, this is the wrong server to ask, but
Behaviour packs are like datapacks in java, plugins are usually nukkit or pmmp plugins, so they are not the same
hi guys, i started programming today and i'm trying to write my first plugin like:
package firstPlugin;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin{
}
when i try to import the class, Eclipse told me "The package org.bukkit is not accessible"
but i have import the .jar of the server so i don't understand the ploblem, can anyone help me? thanks
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Is there a way to exclude a specific class from relocation using gradle shadow. I am including adventure-platform-bukkit in my plugin for spigot compat and relocating adventure, but if I reference an adventure class that another api uses, stuff will break as Jabba thinks I'm referencing a different class
I guess it wouldn't be an issue if I was using the libraries feature since no relocation then, but I'm using a snapshot version that isn't on central...
how do i log to console? i know its the most basic thing, but, how im just starting out
is it this? getLogger().info();
Bukkit#getLogger#log(Level#someLogLevel, โmessage you want to send to logโ
thats pretty long
If youโre doing it in main class ith you can just do getLogger
ah okay, but what does the # mean?
Bukkit.getLogger() for example
do they do exactly the same or are there cases where they arent the same
# is just a notation for an instanced method. It will not be understood by your IDE. It basically means .
okay
Anytime you see someone do #someMethod just replace # with .
its clearer to read/type than .
SomeClass.someMethod as opposed to SomeClass#someMethod,
what am i doing wrong here (with the command)
public final class ManaCore extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("ManaCore enabled");
}
@Override
public void onDisable() {
getLogger().info("ManaCore disabled");
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
};
}
Your main class isnโt defined as a command executor
JavaPlugin extends/implements CommandExecutor iirc
Extends javaPlugin, implements commandExecutor
It actually is
Where?
its the default registration for commands
so long as the command is in your plugin.yml
His command is not in his plugin.yml
Ah I thought you had to implement commandExecutor for any class with a command
isnt this enough? commands:
discord:
description: Sends the server's discord link
Oh you should probably make sure to actually register the command
should not need to
Shouldnโt, but if thatโs in plugin.yml then I canโt think of anything else causing an issue
default is all commands will go though the JavaPlugin unless registered elsewhere
Hmm
I just use the install every time and itโs yet to break
oh, i forgot importing the things
are you updating yoru jar on the server with it still running?
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
is this how its supposed to be
?tas
Iโm confused because if it default runs through the javaPlugin class, without registering it anywhere how will the server know what string equates to that executor?
is this how i would do it? im just assuming as i thought the command argument represented the command sent
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.equals("discord")) {
getLogger().info("Command thing");
}
return true;
}
}
i have no idea what im doing
oh its command.getName()
whats the difference between
pluginname.jar, pluginname-shaded.jar and original-pluginname.jar?
its workong!! [18:13:52 INFO]: [ManaCore] Command thing
first plugin lets goo
Youโve just started on a long road sir!
player#sendMessage()
thanks
So youโll have to get a player variable, then simply player#sendMessage(โmessageโ);
would it be sender.sendMessage in this case?
Keep in mind if you want colorful messages youโll have to implement a gradient system or use ChatColor#translateAlternateColorCodes(โ&โ, โ&6 your messageโ);
Yes
what about links and other components like hovering and such
I never got such encouragement 
So you can derive the player from the commandExecutor but make sure to check that the commandExecutor is in fact a player before declaring a player variable from it
Well I try man Iโve had a couple public outbursts on some mean fucks
fuckin wild, i wonder when / why this choice was made
Thatโs what I thought lol, I never knew given the executor was in the main you didnโt have to register it or even at that point implement commandExecutor
Since existence of bukkit
Will be great if we can define plugin class path just by annotation
Thatโd be pretty lit man
Elgarl sometimes I wonder if you got a spigot api book or genuinely have just spent all this time learning the docs
lol, I've been at it a decade or so
Obv the experience lol, but damn wish there was a spigot api book
Too bad it changes too often for that to occur
Itโs not part of spigot api ๐ค
no, it's a library
Damn it should be
how can i make text that people can click on which sends them to a link?
Text components
Player#spigot().sendMessage(...
You can attach a hoverable to a message to achieve this
No fcking way this works
Thereโs a message level for that?
Donโt you still have to attach a hoverable or am I just being blind?
yes, thats the ...
Gotcha ok you almost broke my mind again
lol
I thought there was a message level for sending hoverables based off that first one I was gonna be pissed
oh i found out it wasnt required, when i just added the link as a text i could just click it automatically without adding something
but i dont think im good enough for this, cuz i only understand like 10% of the words that you guys send
Whatโs your overall coding experience?
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingโgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! ๐
Those are all pretty good sources
OOP is OOP so c -> java is just quality of life imo
i know programming concepts very well tho, but its just java specific things like oop i dont understand
Go through some of those links and learn man, I made the mistake of learning java through spigot api so now my Java experience is strictly applied to spigot, that being said youโll still probably pick up enough to get out of spigot api
isnt this gonna take a lot of time if im gonna need to learn it very well
i dont even like java, i just wanted to optimize my server
if you don't have the motivation it's pointless
I mean unless you want to hire someone youโll have to learn enough to be able to optimize what you want. Although optimizations arenโt going to be easy if you donโt actually know java
This as well, youโre not gonna get far if you donโt even want to do it
my motivation is to optimize my server
Well then this
i think im gonna try
It just takes time man, if youโre truly motivated then you will learn
well what do i do then
You learn the basics of Java
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingโgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! ๐
Learn man, weโve got that command for a reason
?isspigotdown
How can I check Boolean value?
like
if (FAKE_MSG == true) {
//code
}
(Im new dev for Java)
@vague grove These are some good links
What is the FAKE_MSG even supposed to do?
you don't need to check if its equal to true, just
if (boolean) {
//boolean is true
} else {
//boolean is false
}```
Ohhh Thanks Ill try
Seriously? Had to spoon feed?
that's extremely basic dw
FAKE_MSG is
Boolean FAKE_MSG = getConfig().getBoolean("Fake-Message");
this may call for another learnjava command...
sorry but if you don't know how booleans work in if statements good luck using spigot API
okay thanks for advice ill practice more
why your var is constant
i should remove "Boolean"?
hey someone know how can i just delete this
like when i hover an item nothing show?
not sure what the issue here is, those red glass panes are just for visuals
red background
ah you want just the wool?
nope
(it's without item tooltip ON)
i don't want the ugly black square when i hover the item
oh the empty description box?
yep
no way to remove it
honestly not sure if you can disable that
ripperoni
i would suppose no
i'm sab bruh
maybe a texturepack but wouldnt bet on it
i'm too lazy for this x)
maybe you could do it via client side mod? i doubt thats what you want tho, assuming its a public server
overkill XD
dunno how else they'd do it lol
i doubt texture pack can do it
since it'd be the same background of the info card thing for every item
coping mechanism
๐
there was a new item flag for that recently iirc
hmm?
HEYO??
maybe with nms?
@young knoll whats the new flag called
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ItemFlag.html didn't see anything
declaration: package: org.bukkit.inventory, enum: ItemFlag
he wants to hide the display name
Would removing the tag with nms work?
public org.bukkit.inventory.ItemStack hideItemInfo(org.bukkit.inventory.ItemStack itemStack) {
// Convert the Bukkit ItemStack to an NMS ItemStack
ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
// Get or create the NBT tag of the item
NBTTagCompound tag = (nmsItemStack.hasTag()) ? nmsItemStack.getTag() : new NBTTagCompound();
if (tag != null) {
// Remove the display tag
if (tag.hasKeyOfType("display", 10)) {
tag.remove("display");
}
// Remove the ench tag to hide enchantments
if (tag.hasKeyOfType("ench", 9)) {
tag.remove("ench");
}
// Set the modified tag back to the item
nmsItemStack.setTag(tag);
}
// Convert the NMS ItemStack back to a Bukkit ItemStack
org.bukkit.inventory.ItemStack bukkitItemStack = CraftItemStack.asBukkitCopy(nmsItemStack);
// Ensure the item meta is cleared as well (optional, for good measure)
ItemMeta meta = bukkitItemStack.getItemMeta();
if (meta != null) {
meta.setDisplayName(null); // Clear display name
meta.setLore(null); // Clear lore
bukkitItemStack.setItemMeta(meta);
}
// Return the modified Bukkit ItemStack
return bukkitItemStack;
}
thank god we have item components now for this stuff ๐
You can hide tooltip?
yes
you cant
the best you get pre 1.20.6 is a space
I need to upgrade to 1.20.6 right?
If you want to enjoy the features
to have no tooltip ye
Im pretty sure there are data driven paintings too?
ye
1.20.6 is so good
Is it okay to upgrade from 1.20.4 to 1.20.6?
yeah
Okay
Its always okay, but sometimes methods are being removed
that's why you read the changelogs ;)

