#help-development
1 messages · Page 1125 of 1
ok didn't saw that alr ty
I hope all these create operation won't do more harm than good
Looked at the source it should be fine
at least the copy location part
Initial setup of the states could probably cached
explode
Hi how can i open news GUI without moving my cursor
Like hypixel menus profile
Cuz every time i open menu my cursor moves
wdym
Open a menu without manually closing the old one
(Don't call closeInventory)
So delete p.closeinventoryxh(): and just open news invenotry
New
yes
OpenInventory closes the old inventory
Sooo that won't work
What version are u using @timber mason
In older versions it resets ur cursor
What u can do is just modify the current inv instead of opening a new one
The cursor does not get reset if you simply open a new inventory without manually closing the old one
but what about 1.6 clients ???
@lost matrix hey Smile, if I use redisson with an Rmap and access it/modify frequently, I have to do it on another thread, right? I mean if I am trying to make executions on bukkit thread in first place, I have to switch to another one or it's fine
am sowy, but any ideas why even debug doesn't work? class is imported in main class
@EventHandler
private void onBreak (BlockBreakEvent event) {
Player player = event.getPlayer();
player.sendMessage("@"+player.getInventory().getItemInMainHand().getType().name());
player.sendMessage("dxNX");
you didn;t register the listener
dead chat lol
mornin yall
is there no way to get the vanilla food component for an ItemStack/Material
I know how to do it using internals, I'm asking if there's an API way to do it
I feel like there was a way to get the default item meta for a certain material, but I don't remember what it was
get the nutrition value of a default food in mc, say, an apple
mess with the item factory
or hacky FoodLevelChangeEvent lol
that was the class, I was looking at UnsafeValues and forgot about it somehow lol
oh wait, the ItemFactory has createItemStack(String) does that mean i can give the player an item based on input? (basically like /give)
yes
Which event is triggered when using a totem of undiying? The EntityDamageEvent?
mhhh EntityPotionEffectEvent if i had to guess?
maybe not
wait
oh yes it is
declaration: package: org.bukkit.event.entity, class: EntityPotionEffectEvent
EntityPotionEffectEvent.Cause contains TOTEM
so i suppose that's what's applied
ohh okey thanks!
np ^^
@quaint mantle apparently i lied lol
declaration: package: org.bukkit.event.entity, class: EntityResurrectEvent
np :)
well, I just got confirmation that there's no way to get the vanilla/default food component for a specific Material/ItemStack via API, sucks to suck I guess
interesting, the event is always calle when the player could be resurrected.
It's just cancelled. So if you were to:
@EventHandler
public void onRes(EntityResurrectEvent e) {
e.setCancelled(false);
}
it would always resurrect. That's kinda cool
i mean can't you like create a request on jira or sum?
?jira
I'd imagine someone already did, and I am not particularly interested in creating an issue without having detailed a possible implementation for that, so I'll just go for internals
Isnt... the imlpementation the spigot teams issue? :thonk:
why tf can i not use those emotes?!
i legit have free nitro this month wth
gotta boost
boost fr
shit cant remove boosts from other servers right? lmao
you can transfer em
you can only transfer it after like a week
ohh
yeah 7 days
well
wait a couple days then i'll boost for the rest of the month ig lmao
and half of them are active members
they should add more levels with more functionality
first server I see that takes advantage of the fact you can remove emote permissions
if you don't provide a sensible feature request, it's most likely that it'll just get added to the pile of ignored requests
yeah kinda sadge tbh
that's... rude
I mean, with how many people, or should I say how few, there are working on the software, it's just inevitable
Yes, Redis is considered IO, even when its in-memory.
netbeans devs are too busy at the nursing home to worry about updating ui
I still can't figure out how can I make this custom models ^ (its example). available for all versions of mc ie( 1.8-1.20 ex)
While we are at redis, I have question about redis spring. As far as I'm aware redis is KV storage, but in spring we have RedisCache abstraction which seems to have underlying map. Spring also have CacheManager which have list of RedisCache. My question is what RedisCache actually represent ? Is it one redis node or what
declaration: package: org.springframework.data.redis.cache, class: RedisCache
are you using a rendering library?
I don't use anything. btw i dont want to be the resource pack.. i mean this example is from the server. and that server didn't asked for download the server resource pack..
probably a bunch of display entities then
maybe have feature that automatically download the server res.. withot even asking
that is 1.19+
and that server works for 1.8?
yeah, its 1.8 - 1.21 i think
i dont see how they could do that wihtout resource packs
mind sending the server ip?
Isn't there forbidden?
dm
👋
is there a way to transfer a player with a cookie with more data than just 5120 bytes?
im serializing an inventory then sending that data over however some inventories are more than 5120 bytes
you definitely shouldn't do that
cookies can be spoofed
hey any one can help?
?ask
how to send pic
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
my goal is to do all of this within the plugin
oh
hm
ideally you want a socket between servers
is it possible to do this all within plugin
ask in #help-server
"incorrectly configured address/port/firewall"
also wrong channel
yeah definitely, the servers just need to have another port exposed and know eachothers ips'
but I really wouldn't rely on cookies at all
like for basically anything
alright
but what should i do instead
to send over the serialized inventory data?
over the transfer
ideally you would want a middle man like redis
which should be managing the two servers together anyway
but if not, sockets or some REST api on each end
either with some encryption or some sort of auth
erm i need help from someone with authority
i bought something of u web and i entered wrong email
?support
that i dont have access too
email that address
can u guys help no body helping
When a entity (evoker) drops a totem the events is EntityDropItemEvent yeah?
when killing him
Use some sort of database or caching layer
Don't store it in cookies because mfs are gonna figure it out and give themselves every item in the game
consider asking a question if you want your question to be answered?
?jd-s it should be, yes
You're using TLauncher? Good old malware
iirc TLauncher died some time ago and it's now malware
Use ATLauncher or Prism or sum. I personally like ATL
I use MultiMC as teh default launcher broke years ago
yep
He's in the wrong channel but his issue is he's also giving direct connections to each server in his bungee instead of localhost
it was the EntityDeathEvent because you kill him and then he drops
totems are only dropped via evokers yeah?
yes
oh yeah right
thanks!
I guess EntityDropItemEvent is for like villagers actually dropping items
Any entity, I was logging the ItemStack and It was logging EGG
and probably for players too ig
yea
jwt in shambles
Java Web Tart?
Java Web Token
Johnny water tillion
How can I get the totem or itemstack used in the EntityResurrectEvent?
event.getEntity().getEquipment().getItem(event.getHand());
Would be my guess from a quick look at the javadoc
event.getHand() is not there in 1.14
1.14 💀
PlayerInteractEvent -> check if right clicking a beacon -> remove beacon and spawn mob
Where can we find this?
Spawning a mob but it meant to be custom mob
This channel is for programming related questions. So our answer will most likely be: Write some code
Otherwise ask in #help-server
Yeah ig it was meant to be code related?
are you writing the plugin to spawn this mob
Crazy question, but maybe it makes sense. If not relocating a shaded library could cause conflicts with other plug-ins that are also using that library, the following is true, right?
I can create an add-on plug-in and avoid shading that specific library because I can use the one shaded in the main plug-in without relocating. Correct?
Since it causes a conflict, it means that both plug-ins can access that library. That also means I can avoid shading the library in the second plug-in and just access it directly from the first one.(<scope>provided</scope>)
I cannot test right now
yes
you can do that
That's how library plugins work
Amazing!! Thank you
if the dependency/library code isn't yours
i would leave it seperated
having a uber jar for all your dependencies which both plugins hook into
How do I make the player swing their arm and hit the target entity
James Webb Space Telescope
?nms
do funny nms stuff
where i got that from: https://www.spigotmc.org/resources/dualwield.82349/
(totally didnt decompile it, well it's java but yea)
how do you get custom playerheads in 1.21?
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
I have .mpet file for a model. how can i upload in server. which pet plugin i need to use and its free?
I'm saving an ItemStack seralizing it
config.set("key", key.serialize());
How can I serialize it without json in the lore or in the display name? like:
lore:
- fff
- ggg
why would you want to do that?
I'm saving a key (an item to enter in an arena) and I want it also editable in the file
And right now it is not editable why exactly? and what does this have to do with json?
I don't want to use json, I want to use color codes or minimessage
yeah that's what they're doing
they are calling serialize()
yeah, i know. that's what I did
oh that's what you mean. i mean i guess that's not that much off a difference
yes it is
I doubt you can store lore as a plain string as long as you don't serialize the data manually
you can't change that
when deserialized ItemStack will expect the json component
because components are json, and lore entries are components
you'd have to make your own deserializer
not really. ItemStack#serialize only returns a Map<String, Object> which it can also serialize afaik
What you could do is create a separate locale that handles the display and lore of the itemstack separately that allows minimessage
since we're talking components, should you always use components instead of plain color-formatted messages?
(to send to players)
Wdym by plain color formatted message
bc i recently found out that the logs get funky when sending colored messages to the console and idk rn if messages to/from players are also logged
so, from what I understand, do I have to create a class where I create custom serialize and deserialize methods? right?
Basically:
ChatColor.translateAlternateColorCodes("&aThis is green text.", "&");
relax i started my plugin llike 7 or 8 years ago
what do i know of legacy formatting and components lmao
wdym legacy
It’s legacy formatting now
at some point i switched from 1.8 to 1.16 and then to 1.19
a lot of stuff has changed lol
You shouldn’t use the stupid character
Chat has completely changed and that legacy format is something that was written years ago that wasn’t even that great
No use something like adventure
adventure??
They properly actually like handle the messages
what's adventure
Adventure actually handles and sends the component properly and not use the stupid character
I suppose the correct TextComponents are net.md_5.bungee.api.chat.TextComponent?
No I don’t recommend using the built in ones
oh
I mean it's so much more convenient with the color-char lmao
so much shorter than having to type ChatColor.GREEN or sum all the time
Yeah uh
Either create a custom serializer or you can specify the name and lore from like a minimessage locale file
for (ItemStack item : p.getInventory().getContents()) {
NBTItem nbtItem = new NBTItem(item);
if (nbtItem.hasKey("pets")) {
return item;
} else {
break;
}
}
}```
how do i make it so that it returns multiple items if the player has multiple pets
collection
?
?pdc
pretty much the same as nbt no?
?
private List<ItemStack> checkContents(Player player) {
List<ItemStack> contents = new ArrayList<>();
for (ItemStack item : player.getInventory().getContents()) {
NBTItem nbtItem = new NBTItem(item);
if (!nbtItem.hasKey("pets")) continue;
contents.add(item);
}
return contents;
}
I think that's what you want
YOOO you can just use hex numbers for custom colors? that's kinda cool ngl
minimessage already allows this
no idea what minimessage is
will this add all the pets to a list?
i was used to the preset minecraft colors lmao
or the other items
alr thanks
continue goes to the next iteration if the condition is met
the ! was throwing me off
yeah it's basically an early return but in a loop
it skips the current loop and goes to the next item without adding it
if the item does not have the nbt it continues the iterations and does not add the item to the list
it's prettier than
if (nptItem.hasKey("pets") {
contents.add(item)
}
otherwise you get this
oh i mean that's still adventure
like "<red>this is a red message</red>"
oh wait
this is "html" in messages
that's kinda cool
damn
nvm that's REALLY cool
thanks
i'll take a look
if we can call it that
wait til you find out about gradients
?
in paper adventure is already integrated, with spigot you should import adventure-bukkit
don't tell me you can set gradients to fucking minecraft text?
since when is mc so advanced??? i've been seriously missing out
you can indeed make gradients
gradient:#000:#fffmessage
like years now
i mean
for me text was always simple
but DAMN that's actually such a small thing but SO COOL
don't use /reload
Damn
?paste
so im facing problem which is really strange to me so i have scoreboard and for each line from the config.yml it formats color adn uses placeholder to check on any placeholders if they are used in line so basically only problem that i have is on %luckperms_prefix% line which is correctly transformed from placeholder but Color formating is not done it just gives out white text for example "&4&lOWNER" (without " " ofc) so does anyone know why could this be and have in mind Color.format() is just function in my class that uses chatcolor translateAlternateColorCodes
- click components, translatable components, hover components, url components, keys
and so much more
yeah, but with minimessage you can do this: "<blue><u>click:open_url:'https://docs.advntr.dev/minimessage'MiniMessage</click></u></blue>"
someone maybe ?
and you've done
the list is returning empty
Hey! I think that decorated pots are missing the setCracked method. I found some old posts stating that the property is not saved in the nbt but now it is and it's also used by Minecraft. Is there a way to actually modify it?
do you have those items in your inventory? However, I recommend you to use pdc
Okay that‘s cool
alright ill try with pdc
how would i use pdc on items
?pdc
so its the same as nbt?
has anyone ever tried to hide the recipe book?
im trying to do that but packets are not working as expected so im just wondering what am i doing wrong lol.
it is nbt, so yeah
for (ItemStack pet : pets) {```
anyone know why im getting a null error on this?
its not
well what is the error then
?paste
wait could that error occur if pets has nothing in it?
i.e. removing stuff when iterating over the list
no
it would occur if you modified the list inside of the loop
you can probably do the thing you want still, but just in a different way
hard to tell without code though
idk what i was doing tbh
At the PrepareAnvilEvent with just the .setResult() method I can just set the result item i want yeah? But when I click to take to my inventory it doesnt do anything
it does do anything isn't a very good description of said problem
Ohh nvm I see i need to put a repair cost to allow that
is there any way that i can like uhh this hard to explain
so i have pets that give a damage boost when they are in inventory
can i make it so that if a player has 2 "skeleton" pets in their inventory it only boosts 1?
sure I guess
keep track of each pet type you boosted
and the next time you find one , dont bosst it
do i actually have to check if meta == null, if im creating item myself with Material not being air.. ?
no
could someone tell me why this isnt working as intended? the command is supposed to create a firegem like it did with strength, but only the strength command is working
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can use this command");
return true;
}
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("givegemstrength")) {
player.getInventory().addItem(StrengthGemItem.StrengthGem);
} else if (cmd.getName().equalsIgnoreCase("givegemfire")) {
player.getInventory().addItem(FireGemItem.FireGem);
}
return true;
}
}```
you should also check if the sender is a player to avoid null errors
sorry i meant if the player is null
i mean sure, yeah but the command isnt showing at all ingame
Show how you're registering the commands
yeah also that lol
You also need to include the command in the plugin.yml
XD
ive been trying to find a typo for the last 10mins almost went crazy
@modest wing use a command framework or reflection into the command map registry, instead of having to manually add all those commands to the plugin.yml
will do, thanks for the suggestion
Can send some spoonfeed for the command map way if you want, lmk
i can probably find it somewhere online, ill do it later though as im bug testing for those two gems rn
It's quite simple, you're basically just making an extra command wrapper, but directly register it to the command map so you don't need to define those commands in the .yml
I wish I had the link, I forgot where to find it, though I do have some code that uses this so
import java.lang.reflect.Field; and import org.bukkit.command.CommandMap;?
yeah but extend bukkitCommand rather than command executor
?paste
https://paste.md-5.net/nelaxafiyo.java
Here this is how I do it, usage is quite simple as well, just extend the abstraction and do whatever the command requires
The super in the constructor for this method sets the command, aliases, description, and permission, when registering all you have to do is make a new instance of said command and it automatically registers itself
ie:
// Main class or wtv
private void initCommands(){
new TestCommand();
}
some kind of automation sure is nice
so no one? 😢
I have never tried to do this before
what packets did you try
why the reflection for registering a command?
seems like the recipe book being open is client sided
Eh tbf there's probably a better way now, used to get access to the command map though
why would you need to access the command map? to tab the command?
Hello, I was wondering why if I create a class
public class DeathmatchDragon extends EntityEnderDragon {
public DeathmatchDragon(org.bukkit.World world) {
super(((CraftWorld) world).getHandle());
}
and then simply spawn it:
Entity entity = new DeathmatchDragon(((CraftWorld) world).getHandle());
((EntityEnderDragon) entity).prepare(((CraftWorld) world).getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null);
entity.setLocation(spawnLoc.getX(), spawnLoc.getY(), spawnLoc.getZ(), spawnLoc.getYaw(), spawnLoc.getPitch());
System.out.println((((CraftWorld) world).getHandle()).addEntity(entity));
spawns an invisible dragon that has everything but is just invisible (if I die by it I get a message slain by unknown), but if I spawn it like that:
Entity entity = new EntityEnderDragon(((CraftWorld) world).getHandle());
it works just fine and it even has the bossbar unlike with mine, but why? this is so weird? I am in spigot 1.8.8
because accessing the command map is the only nice way to register a command
the plugin.yml is ass
^
why not do everything in code when you can with a couple lines of reflection
You don't have to do all the extra shit
tbh tho I think this is still a bad way of doing it
You should really use PluginCommand
it has extra backups for cases of clashing
ya know I've been using that snippet right there for like almost a year now kek
It works and haven't had issues so I just never tried anything else
just use acf idk
acf uses command map :O
Also I'm pretty sure that snippet came from a stephen king lecture
still better than rewriting it over and over again
are you okay? You don't need to rewrite if you make a wrapper
i mean for each plugin man
You write wrappers for stuff anyway... why is it an issue for a command wrapper
why would i made a central library to get a single reflection field
whatever man have it your way
you are just stupid kekw
in any case it would be convenient just having a getmethod
Do you really go raw on spigot without any libs?
i rawdog spigot man
I have like a 400kb library of general utilities I use for every plugin
because spigot has shit API in some places
gotta do it myself 💪
Isn't it like kinda your job to make spigot api better :p
why would you not want to normally register a command, only one time I registered it programmatically was when I had to make a plugin that could create custom commands
never seen a well documented general library and never felt the need to go make one so far
no external utilities of your own
its cooked
man idk everyone codes differently maybe he likes to code with so many utility classes and library to make java look like python or smth
oh yeah that's how I was 4 years ago too, but I think the point is that having your own utilities isn't stupid
as long as it compiles, works and is mantainable
This is getting subjective
utilities are just that, you need them in some places, others you don't
ok lets start talking about kotlin now that it is subjective
and there is no difference, like just writing a plugin vs taking longer to write the same plugin but being able to reuse some parts in the next one
i sleep
Don't get me started on kotlin
by utilities I mean stuff I probably need for all plugins
like saving data or menu stuff
or things that are similar
for funcional stuff and utils it is just too good i am sorry
same here? Idk what they are really on about tbh
#general message
Why would I not have a centralized way to do my commands or Menus if I use them every time
I also use my lib to trial new spigot API
but I guess its preference
Spigots new MenuType and InventoryView stuff literally has been derived from my library originally
I tweaked it to fit better into spigot but that's where its from
MenuType subject to merging still
basically InventoryType is really fucking stupid
MenuType is going to be its successor
right so it will be an inventorytype that will work
so that I can finally cast my fucking anvil
kinda but different
i just now saw your message lmao, sorry
I'm thinking of getting rid of Bukkit#createInventory completely or atleast bringing it in a very different form
there is no Unlock recipes wth
idk, just read a lot of forums and all lead me to that protocol
that link takes me to the top of the page
huh?
dont you mean Update Recipe Book?
yeah that one lmao
okay and in what way does it not work currently
anyways for an idea of how it might look given MD merges it in its current state. Which i think is probably likely
val view: AnvilView = MenuType.ANVIL.create(player, "My fun title")
view.setItem(0, ItemStack(Material.PAPER))
player.openInventory(view)
i can still click on the recipe book, i managed to disable the recipes
but i can still click on the recipe book
and same with like GENERIC_6 or whatever? looks nice
and I assume that AnvilView is an InventoryView?
val view: InventoryView = MenuType.GENERIC_9X6.create(player, "My fun title")
player.openInventory(view)
You can see information regarding the view derivatives here
Also a reminder that views are not inventories so only the player you created the view for can open it.
how would you sync it with other players
views are different so you don't. Inventories are what are synced with other players
views themselves can not be
so there is no built in way to like have a shared anvil inventory? (if you somehow wanted that)
Not nicely, basically view data can't be synced easily. You end up with something like this https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java#11,23
I had to do this for legacy support and its ugly and fairly volatile
I see
I guess in like most plugins shared inventory views are like an exception, not the rule
shared InventoryViews are nolonger allowed in modern API
I added a precondition to HumanEntity#openInventory(InventoryView)
it was merged because its a bug fix and not an API regression
shared InventoryView's lead to dupelication glitches full inventory desync full item loss and other horrible things
yikes
basically its possible to permanently lose items in your inventory if you're lucky you get to keep them otherwise they are gone gone
no getting them back
I guess for most purposes its good enough to just copy over the state of the inventory to other users, esp with like menus that players cant put items into etc
Inventories are mutable
so its updated globally as far as changes go
right
this is why you can have multiple players view 1 chest etc
I mean like the view
copying over state is usually how you'd do it without causing issues
alr
but how
anyways I gotta get back to my stupid serialization stuff
you can make a set for example
and save all types in the set that you come across
and for the next one check if its in the set
I already made some stupid global serialization API it was painful
I sympathize
I'll go back to replacing Bukkit ItemStack with something from my own lib because ItemMeta is blegh
yeah I started on something that just writes byte arrays, but then I found out I basically made nbt to a T, so now im just making an nbt serializing stuff, at first I was trying to make it cross compatible with configuration api, but its really hard since that allows you to put in Objects, and the types are ass to manage, like not all serialization types might have the same datatypes
and a bunch of other issues
fun...
yeah dealing with the information loss but keeping each serialized version of the data looking like the thing its supposed to serialize into (configuration file vs valid nbt file) is the hardest part
so its probably gonna be some type conversion / registry stuff
but its gonna be awesome when its done
how would i do this?
kinda depends on how your pet types are stored
but just Set<PetType> pets =new HasSet<>();
who was use hibernate for plugins? hibenate can use async ?
i have no clue what that is im ngl
then youll have to learn some more basic stuff tbh
i.e. look up what a set is and what you can do with it
rn im just using PDC on the items but im not checking which they are because its all configs
either the pets give multiplier boosts for damage or tokens
so no need to check which it is
you said you only wanted up to one pet of any pet type to get a boost
you could probably use a filter on your pet list and see if there are any pet types that give some boost, and if there are, give that boost
so list the boosts instead?
maybe
I mean idk what you really want yet
but just using the pets themselves seem like it would be good enough to determine what boosts to apply
depending on how the boosts get applied, you could just loop through the list normally
they get applied by taking the event damage and multiplying it
is there a way to run through a loop and remove dupelicate names?
yes
if so ill just do that
just put them in a set
oh alr
Set<ItemStack> petList = new HashSet<>(pets);
petList.clear();
petList.addAll(petList);```
found this online
will it work?
petList (not a list) will just be empty
you are creating it from an existing collection, clearing it, and then.. adding no elements to it lol
where did you get that from
Pretty sure you only need the single new hashset() line
No reason to clear it and then add the now empty list to itself
Set<ItemStack> petList = new HashSet<>(pets);
petList.clear();
petList.addAll(pets);```
this is what i have but it doesnt work
it still has dupes
pets will have dupes, petList will not
you are clearing petList instead of clearing pets
then addAll to pets from petList
each time i generate a pet i add a random num from 1-10000 so that they arent stackable
can i just add an unstackable feature on them?
cause i think thats why
it thinks its 2 diff items
it is
why are you making them unstackable?
because
if they are stackable it might bug out
i just dont want them to be
either
is it not possible
In 1.21 you can
im in 1.21
why? all you are doing is adding a buff if one is present
Set the max stack size to 1
it loops each pet in their inv,
checks each pet to see if its passive or clickable,
then checks if its a damage pet,
then adds the damage
but it does it multiple times for each pet
annoyingly
what was that library for having per block PDC again?
maybe its
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
no like
someone in here made one to give you pdc for block coordinates
oh yea its alex' thread lol
? why should i shade stuff?
so that people dont need to download the deps
aint that just 'include file in plugin'?
yeah
uh isnt that a 'included' in the dependency? why is there two ways to do this?
the thread talks about relocations
im used to doing scope = included or whatever it is
i am making a bukkitRunnable to execute async as i want to do something very resource expensive, but there is a problem, either the code got faster after i closed my eyes for half a second (impossible) or it fails silently and tells me that it is completed, how can i check if a bukkitRunnable is failing silently and why
i legit took 10s and almos crashed the server when executed on the main thread and how it executes instantly seems like bs to me
you might be able to debug it? i dont recall if that works off-main thread
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
code is huge but sure
?paste
i mean i prefered it if it exploded and gave me an error but if it fails silently i have no idea where to start fixing it
no shift tabbing AAAAAA
might just as well share the whole class
starts at claimCannonsInBox
iirc async reading blocks is fine modifying them is not, and i don't remember editing blocks anywhere
you generally can, but its safer to use a chunk snapshot
you have a try/catch with an error debug so it can;t be failing if you get no stack trace
If it were a Future it could fail silently but not a BukkitRunnable with a try/catch

then how is it possible that it gets completed on the spot, spark detects no activity on something that before took 100% cpu usage and 10s seconds
(it catches nothing btw)
you would need to add debug. check if it actually finds anything
yeah lemme enable debug
spark by default will only report the server thread
the profile command has a flag to monitor all threads
not that measure threads from the bukkitscheduler is very helpful, since the names aren't much useful unless you're using your own thread pool or something
I have .mpet file for a model. how can i upload in server. which pet plugin i need to use and its free?
is it --thread?
oh it does show, like, the per plugin call stacks view, that's more useful
that is way more realistic
i think it is doing its job, but is it possible that sends to me the completed message before actually doing the operation lol
ok yeah the message is sent in a sync block of the code and no in the thread alr ik the issue now lol
thats from spark?
yeah
public class Node<T>
{
T data;
Map<String, Node<?>> children;
}
``` if I have this code, does it make sense to store the data like this? like the children is a map of nodes potentially, which are looked up with strings so i can create a similar tree lookup to that spigot api has for configurations (i.e. "branch.branch.variable_name") but idk if it makes sense to add a data field to this class, since this would mean I have to write code that would make sure there can only be data or only be children, not both
like is there a smarter way?
a wat
what does the char part mean
right so just looking at what a trie is, mine would be similar, except for the whole alphabet thing
so I guess its normal to put both the potential data and potential children in the same class like this
but the insertion needs additional logic to clean up data on nodes that get children
which I guess isnt too hard to do manually
is it just me or does this just look like a weird Trie
yes
how do I make it look not weird
but still keep the things I wanna do
like inserting data, inserting nodes and removing both too
usually Trie's work off the character unless you make a compressed trie to save on memory
well the point of the tree is to save each key as a whole string word, not a single character
unless the character just refers to the string as a whole?
I dont really care about the sorted nature or the lookup speed , since im using maps all over the place so its not horrible I think
A trie inserts data into a tree like this. E.g. if i put in the string
Taco
It inserts Taco$ $ designating the end of the string. So during lookup when you hit the $ you can grab your data
right
that way if for some reason you insert Tace it inserts Taces and can re-use the TAC characters or if you insert Tacos it reuses TACO but adds another child to o being s which then has its designated terminator with the data attached $
idc about the reuse of single characters
that wasnt really the point of my structure
I just care about how the data itself is stored and if its fine to do that alongside the potential children
I have an implementation of the Naive tree if you want to take a look. Generally the reason why you go off characters is to reduce lookup time
https://paste.md-5.net/vudefulaje.java
its fine I mean its just 1 extra pointer
instead of some oop style variant where there are branch nodes and data nodes
how does adding a node for every character reduce look up time
I guess this is for big tries
well the Trie is mainly used for mass string comparisson
you just are also able to attach data if you need
right
I just care about the dual nature of a node having data or children
but I guess ill keep it like it is now
thanks for the explanation
I also have an implementaiton like this https://github.com/PineappleDevelopmentGroup/PineappleChat/blob/main/pineapplechat-core/src/main/java/sh/miles/pineapple/chat/utils/ExecutorTrie.java
which attaches functions to each node
well not functions but that's what i use it for technically you could use it to attach arbitrary data
pineapple 🗣️
I think you mean, PineappleChat 💀
right, im just unsure what you would do with the data already attached to a node when you want to change the children
this is why you attach the data to the terminator for example $. That way if you remove that word and your node is still used to host children you just remove the terminator
now your attached data is gone, but you still can host the children
e.g. you have some data like one.two = v, and then you wanna add children to one.two, like one.two.three, like is the data at one.two still valid?
if you use terminators yes its valid
in my case I need it to not be valid
for context im making some sort of config style tree
then you'd need to write a walker for the tree to kill a terminator child
like you set a string path to a value
that value is either just like a number or its a sub tree
as you walk down to add a node you can kill terminators on the way
tho personally I think I'd throw an exception because you're trying to add a value to a non section or vise versa
so a lookup for a string path only has 1 proper value it returns, either a child node or the data
but writing this out makes me question my idea..
like how do I even return either a node or data xD
how would I go about making a sendBlockUpdate to a Sign persistent, I want to make per-player sign placeholders and I assume the block update gets invalidated once the player goes in and out of the chunk
I could do it on chunk enter but that sounds janky tbh
listen to outgoing chunk data packets and change them there, or - easier - just send them a block change for all nearby signs once every few seconds
if you don't wanna use OOP create an Either structure
couldn't I just use the PlayerChunkLoadEvent or whatever it was called instead
would rather not resort to packets
a what now xD
if that exists? but then you'd also have to check for the block being changed meanwhile by players or whatever
Either<Left, Right>
either.left() either.right()
when(either) {
is Right -> either.doSomething
is Left -> either.doSomething
}```
```java
if (either instanceof Right<Right> right) {
right.doSomething()
} else {
((Left<Left) either).doSomething()
}
ig I'd also have to cancel the physics event for the sign, yeah
oh I see
hmm
now I have something to think about haha
wouldnt it be easier to have a common superinterface for child node or data?
I think it'd be easiest to just attatch a pointer to the Node object and check for null
i think oliver stinks
have you never noticed?
sure that can work too, but in this case the interface would just be empty and I guess just used as the pointer type for the purpose of passing a valid type
my first iteration has a Node which has a map of datanodes, and a datanode is either a node, or data (wrapped in some other node type),
which would essentially be that
also Either reminds me of a C union
Someone can help mi with messages bungee - spigot?
https://www.spigotmc.org/threads/spigot-message-received.662184/
yeah agree
and he told me to go play deadlock
but it's just the valve logo screen
oh it's frozen
fun
How much is known about 1.16.5 world generation? I'm trying to make a blacklist of biomes that wont generate in a world.
How do you run code after you place a item into a custom gui? When i place my item in the gui nothing happens, when i take it away from the gui the function runs, this is reversed. the code should be checking my item when i place it in
I've upgraded the jdk version in my project and now I have this issue: Unsupported class file major version 66
Anyone?
Who has their own project?
JDK 21?
22
switch to 21
same thing
Who has their own project?
if (draggedInventory == null || !event.getView().getTitle().startsWith("Enchanter")) return;
you are checking when the player clicks on the inventory that starts with "Enchanter". Instead you have to when a player clicks in their inventory, from what I understand that's what you're trying to do
same error with 21 but the version is 65 now
When i open the custom gui, must place a tool into the empty slot. the slot is returning null because of being empty, i would like it to register that i placed a tool into it without having to click a random other slot
which IDE?
intelliJ
already changed in project structure
and in build.gradle
Are you using gradle shadow plugin?
Check the InventoryAction and current item
whats the difference between relocation and <scope>included</scope> ?
ye
relocation has to do with shading and it's used to change the package that an included library uses. The included scope does not exist
I assume you mean provided and that just means that you will provide it on your own at runtime
Hey there peeps
Has anyone been approached by Surf Hosting before? Does anyone have any experiences with them?
Since this is a developer's chat, I'm just looking for any personal experiences with them in your plugins
I've been approached recently and I wanna make sure it's not dodgy
if (event.getAction() == InventoryAction.PLACE_ALL && slot == 11) {
if (isTool(clickedItem)) {
ItemStack upgradedTool = upgradeToolEnchantments(clickedItem);
clickedInventory.setItem(15, upgradedTool);
}
}
```Thanks for that idea! Which event would work for placing a pickaxe in the slot? this one does not
I would stay away
Go for a more trustworthy host like bloom or get yourself a cheap dedi from Hetzner
depending on your needs
You misunderstand
I'm just asking if you have any experiences with them partnering up with you, I'm not looking for any hosting solutions
I self-host everything in my setup 😛
Oh is that so?
but again how much that matters is up to you
Is there anything in particular that they have done?
i meant the scope thing that makes the library part of the resulting file. i thought it was include that did that
You need maven-shade-plugin for that
yea that'd do it
but again shade isnt relocation, so how does it differ?
You define the relocations in the plugin configuration
hi, how do I check if a player's body has touched a certain block? 1.20.1
Joining servers and then trying to push you in to switching to their host
I see
There's a little bit more than that you should take a look at trustpilot for a more detailed write up
i believe minecraft doesnt keep history of that unless you define 'touched' as 'mined'
Looking at it now, thanks!
I really wish there were a better platform than trustpilot. I really hate how sites can just remove your review if they just claim you aren't a customer
their appeal system is also completely broken, so you get your reviews removed and then no way of restoring them
yeah I've seen that happen
infact the main review I was mentioning was disputed that way
It appears to be back now so I guess it didn't work out
i just got a random ass client join my server say 'hey this minecraft server is exposed' which kind of was the whole point and leave
lol
probably a bot
Don't really need a botnet
well it certainly will take ages on a single 1600 line lol
true but time really isn't much of an issue
also true
Who needs a Minecraft-style fashion designer - write
f do u mean fashion in minecraft??
Hi, i'm trying to send a HTTP request within my Minecraft plugin, using Okhttp3 from the maven repo, i added it to pom.xml, built the plugin, everything is fine, but i get ClassNotFound error, saying the OkHttpClient class couldnt be found
sounds like the library youre using is missing
Yeah code that doesn't exist cannot run so you need to include it in to your plugin or tell Spigot to download it
with the libraries section of the plugin.yml
?u can do that second one?
how
ah i see
i thought that was still in development
It's been in Spigot since 1.17.1
i havent beeen here in a hot minute apparantly
adding it to pom.xml ain't enough?
no
Okay
yes, if the scope is correct
You need the shade plugin
and then the correct scope
or as mentioned the libraries section of the plugin.yml
btw olivio those libs stay downloaded, right?
how to add the lib
yes
in pom or plugin.yml?
Found online already
@young knoll any chance you could review this?
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1455/overview
its actually tweaked now to where it isn't a naive implementation anymore I just need someone who actually properly understands this area to look over it
does it work
Yeah I can't really test version upgrades
But the data fixer should do it's job and doesn't error on same version builds
bump
Ship it!
I rather have MenuType shipped
So I can enter phase 2 of MenuType PR
ooh fancy
ship it
Multiple phases
You wanna see what it looks like if you don't 😈
It's peak java code
btw, any reason this isn't a ReferenceObjec2ObjectMap or something
those ifs sound rather annoying
Never used fastutil didn't know such a thing existed
Can you explain pls
Yeah true
I should prob switch over to a map but what's the benefit of the ReferenceObject2ObjectMap
it avoid equals calls
Just create minecraft 1.22?
Gosh
that's why you use Forge 1.12.2
Ahhh
best version
Does it use == instead
Yea
Nah it uses isSimilar
Object#isSimilar isn't real it can't hurt you...
@eternal night I remember why its if statements now
if I reference MenuType it'll stack overflow lol
I'll just use mojangs and hope for best :3
I could make it even faster if we really needed by using else
but yk I cbf
it looks beautiful
so you gonna approve now right 😈
everything is an object if you're brave enough
@river oracle you are an Objectg
I want to say something but I'm affraid it would far extend beyond the PG-13 limit of this server
so for that reason you'll get a smiley face instead
🙂
(Class<List<T>>) (Object) List.class
nah already done with paper work 
Spigot PRs are spigot work
get in shape bucko
I've got like 20 PRs in queue

not all player input
just their movement 💪
Also happy birthday 
And jump sadly only if they have space bar pressed
Not if they just jumped
miles bday? :o
for their bday?
Yes
oh wait nvm
yeah it was about an hour 31 minutes ago for you
its still today for him
i think ur an hour ahead of me anyway
1:30 for me rn :P
lol well let me come up w something
coll will tell u how old he is for real
:^)
wait how did you know??? Did I say something and not remember lol
Is it possible with an api to retrieve list of customers? trying to make a bot to sync customer role with customers upon verification and i don't like the idea of using paypal to do so
Anyone know ihow i can access the instance of Netty Runnign on a minecraft server I need access to it for my plugin
happy bday in any regard ^^
a math formula or a fixed list of XP required for each level to levelup
and then some sort of storage to store how much XP a player has, e.g. PDC or mysql or a file or whatever.
does anyone know why my intellij is having errors importing bukkit?
Cannot resolve symbol: bukkit
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
?paste
thats my pom
import org.bukkit.plugin.java.JavaPlugin;
public final class PlayerSkillLeveling extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
thats code
its fresh code
Looks fine, post your maven log
doesnt give errors
did you already try the classic; close and re-open IntelliJ?
plus either way sometimes maven will tell you other things, ya never know
I think intellij you often have to reload the maven project too
only if you change it in my experience
you kinda sorta have to reload maven anyway when you add something so it can resolve/download deps
@river oracle I was thinking about inventories, and how people want to create them to share between people. The only inventories that can be shared, are ones that are backed by some tile entity, like a chest or a furnace. What should be encouraged then, is creating a blank TileState for the block type, and using that inventory to share between people. Instead of just trying to create an inventory via InventoryType
so like
Chest chest = (Chest) ItemType.CHEST.createBlockData().createBlockState();
Inventory inv = chest.getBlockInventory();
players.forEach(p -> p.openInventory(inv));
// inv is now a shared inventory between the players
There should be no way to create an instance of AnvilInventory or EnchantmentInventory as a standalone thing, those inventories/nms containers only exist in the context of a full view (AnvilView or EnchantmentView)
pretty sure this, plus MenuType then completely replaces all functionality of InventoryType. So that enum and associated methods could just be deprecated in their entirety
Also been thinking about something similar, I really struggle to see how AnvilInventory etc can fit into the model properly. And it really just can't as you said. As stands with the large PR that you reviewed I actually made it possible for the inventories that really shouldn't work for multiple players, but I don't really think that is a good longterm solution. As you proposed here seems much more intelligent of a solution instead of continuing to duck tape things together and praying they don't break
does this mean Bukkit#createInventory would be deprecated in favor of this?
Bukkit#createInventory's days are numbered regardless of what we go with
the case where an API user wants an inventory to be shareable is rarer anyway so I wouldn't personally mind it
that trash system needs to die




