#help-development
1 messages · Page 1245 of 1
I mean like manually
who knew List.strings would be a compound list 
minecraft:diamond_sword[max_damage=1943,custom_data={PublicBukkitValues: {"redacted-core:attributes": {"redacted-core:armory_modifiers": {"redacted-core:implicit": {"redacted-core:attack_damage_t2": 0.77615064f, "redacted-core:attack_speed_t1": 0.852396f, "redacted-core:durability_t1": 0.905921f, "redacted-core:order": [{}, {}, {}], "redacted-core:slots": 4}, "redacted-core:prefix": {"redacted-core:chaining_t1": 0.32566094f, "redacted-core:horde_damage_t1": 0.7768043f, "redacted-core:order": [{}, {}], "redacted-core:slots": 5}, "redacted-core:suffix": {"redacted-core:attack_range_t1": 0.10402691f, "redacted-core:chilling_cloud_t1": 0.2019844f, "redacted-core:order": [{}, {}], "redacted-core:slots": 2}}, "redacted-core:level": 10}, "redacted-core:item-id": "4886632e-1394-4675-b1bc-8cd060a55594"}},lore=[REDACTED],attribute_modifiers={modifiers: []}]
PDCContainer is definitely a name
hmmm, I have 0 idea how it would emit empty compound tags
ItemStack startPlate = new ItemStack(Material.LIGHT_WEIGHTED_PRESSURE_PLATE);
ItemMeta startMeta = startPlate.getItemMeta();
startMeta.setUnbreakable(true);
startMeta.setDisplayName(ChatColor.AQUA + "Parkour Start");
startMeta.setLore(Arrays.asList("Place this pressure plate on the location where", "you want the parkour timer to start counting"));
startPlate.setItemMeta(startMeta);
I have this code, but whenever I place the block (with or without OP), I can still break it. How come? setUnbreakable is on true?
At least looking at the code, it doesn't seem like it would.
list should look something like ["attack_speed_t1", "attack_damage_t2", "durability_t1"]
Yea
but yeah this only started happening in .4
we've been on .3 for like 3 months and I developed the entire server in .3
unbreakable is for the item not the block
when is .5 coming out
whenever mojang release it
specifically for items with durability

^^
w
okay so
What's the exact difference?
who's up to violate some ndas
.4 had some SNBT changes
.3 is cool
and no it's not dfu
I believe
ohhh like the hp of the item?
yes
I know the latest previews are changing components
how do i make sure that it cant get destroyed?
if you want something unbreakable listen to block break event
do i need to cancel a blockbreakevent
yes
nun about snbt
oh alrighty, thanks!
fwiw someone showed up yesterday with the same error in paper-dev but on .1 (?)
.5 has some (s)nbt changes afaik
it wasn't even paper paper but aswm so i told them to repro on up-to-date paper :pepelaugh:
i dont think ive seen much good from asp
.5 snapshots def have nbt changes but I don't recall .4 having as many
Hmm, yea ListTag only had changes in 25w09a
dont think theyre even updated to hf or publish any dev bundles for anything
anyways is there any stupid solution I can use for now
I can throw a big //FIXME: Mojank fault and just save it as a string
split by , or something
I guess
🙏 gotta push an alpha by next week already got enough to deal with
I'll put it on my ever growing issue test 
time to get back to IA -> Nexo conversion 😔
omg?
@echo basalt are you running latest via version or something
running 5.2.0
git-ViaVersion-5.2.0:488a6b691
your original stacktrace was on the creative click
I am in creative yeah
mhm
but this happens in survival too iirc?
I update the item when i throw it down and some other triggers
error happens when I pick it back up
I'll try to find some dumb replication yea 👍 I sadly don't have much time (as emily said, thesis is crushing me) but, I'll have it on my pile
if someone else runs into it with replication steps, I'll poke ya with the issue
I can write something up for replication
that'd be great if you can find like, a minimal example
not sure if it's list related, component-in-component or what
again I gotta push an alpha in like a week (gonna travel after that) so I doubt they'll let me poke at the issue for longer than I need to
All good yea, just go with the hack for now then 👍
Hey Devs, I struggle with some commands. First I spawn 100 drowned with trident in hand and than I kill them, but they won’t drop there trident.
I have a command to make this damage as player attack, but it won’t work anyway:
/execute as @e[type=minecraft:drowned] at @s if score @p drownedKill matches 1 run damage @s 1000 minecraft:player_attack
what am I doing wrong? They got all killed but none drops a trident
last sanity check, what version are you connecting with
1.21.4
I can get you a plugin list or whatever
what if you have multiple armory containers or whatever
armory-1 armory-2 armory-3
shouldn't really matter. the compound tag works, it having multiple values is w/e
a plugin list would be good tho
so I can cross reference that with the next reports, if this is actually a paper issue
/execute as @e[type=minecraft:drowned] at @s if score @p drownedKill matches 1 run damage @s 1000 minecraft:player_attack @p
you may have to specify the damager (player) there
also, this is server for plugin dev, not commands. For commands go to Minecraft Commands discord server
Also, depends on how you spawn those mobs, maybe you set the drop chance to 0 or something
is there any quick command to make a versioned plugin list?
don't really need versions tbh
Cool
most of the time, the cross section is so minimal, it is only 2 or 3 possible culprits
Paper plugins:
- HuskSync
Bukkit plugins:
- Essentials
- FAWE
- my custom core
- LuckPerms
- MEG
- MythicHUD
- MythicMobs
- Nexo
- PAPI
- ProtocolLib
- Vault
- VentureChat
- ViaVersion
danke 
I tried having my custom core as a paper plugin in the past but it had a lot of plugin loading issues for absolutely no reason
not sure if that's worth looking into
it'd just not respect depends
The only time I've seen that is when the person typo'd depend/depends
yeah in my case it was paper's plugin loader thing
it'd detect the depends but still load my plugin before anything else
pretty sure we split clossloader joining and loading in paper plugins
you need to define the load order explicitly
I did
I did join-classpath and explicitly set the load order
it didn't give a fuck
so neither did I
fair enough xD
core is meant to load after Dungeon?
#setUnbreakable refers to an item's durability(e.g. any tool).
In order to prevent players from breaking a block, you'll have to listen to PlayerBreakEvent and disable it accordingly.
Thanks!
I'm making a parkour plugin right now, where the player needs to place down a start and end pressure plate, they can't be broken either.
But how do I make sure these pressure plates are distinguished from other pressure plates in the game? I've read the PDC page on spigot but it seems a little complex to me
guys, apart from the miserable code written, the plugin compiles but the IDE gives me these annoying syntax errors, how do I solve it?
please just take a screenshot
I'll start by saying that I had to deal with the .m2/repository folder before, having to delete it due to "Malformed \uxxxx encoded" issues.
Ok
I try
remember this
well, I solved it by restarting the IDE, until now it gave me this 🤷♂️
You don't have to use that even though it's not difficult as it seems. You can add the plates' locations to a Set and every time a player breaks a block whose location is in the set, disable the event.
Just beware that when the server is shut down or reloaded, the set will be empty.
?blockpdc alternatively
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
IIRC this resource just wraps the PDC without adding anything useful, so I don't understand why anyone would recommend it.
It seems that the guy is inexperienced so the best advice is to teach him the basics - which is simply using a collection(Set preferrably) to store the locations.
Yeah no, it does more stuff. It handles different block break events, I think it even does pistons.
even if it adds support for more complex stuff, the guy needs to learn the basics first.
event handling + collections
After that, the sky is the limit in terms of libraries
iirc it also listens to e.g. block explosions and piston pushing to update the collection correctly (and persists them, wouldn't be a __P__dc otherwise), but yes it is in principle just that
it gets recommended a lot because to do it correctly you need to listen to like a dozen different events and there are many edge cases you will mess up without trial and error
so rather than reinventing the wheel every time it's best to use something tried and tested
that said for the case of just pressure plates, which aren't pushable by pistons, and based on the description won't tick, only be interactable, writing it yourself shouldn't be too difficult
the biggest hill to climb is going to be figuring out when it breaks to drop the correct custom item, which is going to require listening to block physics and explosions and a few others
I'd rather they learn the basics while making their own logic rather than poorly trying to reimplement complex libraries like these
a lot of things in the spigot ecosystem are better handled by libraries so may as well start learning how to adapt to them anyway. Economy/basic permission hook? Vault, Scoreboards? FastBoard, block PDC? That one library, commands? CommandAPI or the other various command frameworks
it's a bit of that and a bit of this imo, trying your hand at reinventing complex things is definitely good practice, just, yeah, you'll want to get the basics down first, and the end result will usually be inferior to what's out there as a library
They don't need to reimplement complex things, they need to be familiar with the absolute basics of the API.
if he had no idea he could've listened to block break event, he has stuff to learn.
In BlockPlaceEvent, does event.getBlock().getLocation() return the location where the block has been placed?
Read the docs of the method. if no such information is provided, you can always test 😄
I'd assume that it does
I just read "Gets the location of the block"
So I suppose that means after it was placed
yeah, what else would it return? 😛
let me tell you something
Ive been working w java for a long time, but spigot is new to me
So just trying some stuff out
It took me 5 years to discover the existence of javadocs, and after I have done that, I felt extremely more safe working with libraries
because it contains everything, including edge cases(when written correctly)
True
So if I remember correctly, u told me to store the blockplace location in a set right?
no question is dumb.
yeah
when a block is broken, check if the location is in the set
What's the difference between a Set and a List? I don't think I've ever worked with Sets before.
we're reaching the pure Java territory 🙂 Both are implementations of the Collection interface, and you choose the appropriate one depending on your use case.
In your case, I chose set because their #contains is extremely faster than a list's.
Set is an interface, the most common implementation is HashSet
I understand, thanks for the information!
@eager hawk I'm encouraging you to go beyond my explanation and learn about the different common collections, and how they're implemented.
That’s a bit misleading, contains(Object) time complexity may prove better on a HashSet than on an ArrayList if you scale the size up it becomes noticeable, but Set itself doesn’t guarantee such a property
Focus on ArrayList, HashSet, and LinkedHashSet
they have multiple differences, so it can be tricky going for the correct one
LinkedList also
LinkedHashSet my beloved
Will do, thanks!
LinkedReferenceOpenHashSet
Never heard of Linked actually lol
Got some searching to do
They've never spoken of it in classes
Make it thread safe while we’re at it
It's not misleading, people usually pick Set due to the fast lookup check. Otherwise why would you pick it?
No that’s wrong
if you need collections that do not allow duplicates
right, I forgot
con how is that thing going btw
Oh don’t remind me
sadly i don't think fastutils has synchronized variants of each concrete class, you just have to wrap the impl in a SynchronizedReferenceSet, which is supremely sadge
you bet I will
all current set implementations do.
nuh uh
Enlighten me
ArraySet from fastutils doesn't
Your premise is wrong (respectfully), but please enlighten me Mazgani
my own set implementation does not, actually
🤦♂️
(I do not have my own set implementation)
sad to see trollers in a place meant for helping people
Yea there have been multiple issues on gh regarding atomicity, extremely hard to ensure nice atomicity and at least weakly consistent behavior on bulk operations while not over synchronizing on them
It’s not a troll, you’re wrong. Set#contains does not specify time complexity end of story
con are you a wrong
the "principal" reason why it's picked over list is that it doesn't allow duplicates, and in almost any case where o(1) contains is desired or applicable, there won't and shouldn't be duplicates
you're right in that people pick it for the fast contains but you're missing a step and putting the cart before the horse
in this case specifically, it would be simply incorrect to use a list, because that wouldn't make sense -- you can't place multiple pressure plates in the same location, i.e. you can't have duplicates
contains being faster then is just a natural consequence of the problem's nature
i could sound stupid but what are all the ways a player can equip armor
i know right click, inventory click, block dispense exist but is there anything else
a plugin can always decide to put armor in the armor slot
the only reliable way is to check the slots every tick, which is afaik what paper does for its ArmorChangedEvent or whatever it was called
in terms of vanilla gameplay yeah that's probably all of them
oof
spigot loves us ig
So I just wrote the following code to get a message whenever I walk over a pressure plate at a specific location.
@EventHandler
public void onPressurePlateInteract(PlayerInteractEvent e) {
if (e.getAction() == Action.PHYSICAL) {
Block block = e.getClickedBlock();
if (parkourPlates.contains(block.getLocation())) {
Player p = e.getPlayer();
p.sendMessage("Parkour plate has been pressed!");
}
}
}
But each time I walk over it, I get the message twice. How come and what's a possible fix?
probably once when the plate is pressed and another when it bounces back up? check the block state maybe
The thing is that the message comes at the exact same time
Like it gets sent twice
At the exact same moment
🤡
doublecheck that you're not registering your listener twice
apart from that it could just be some bukkit quirk
I mean the interact event is terrorizing
i also need to listen for when the player receives a new item, instead of looping every player every x ticks can i just get around it by listening for when the server sends set slot and window item packets
I wanna say "check hand" even tho it makes 0 sense
you can maybe bandaid it by adding a cooldown of one tick
or can it be somehow manipulated by the player
possible
everything is possible with the interact event
truly a try and see event
those probably get sent a whole bunch apart from just the contents actually changing
for example i think player.updateInventory resends all the slots with set slot packets
I uhm...
I don't think the event should be twice
😭
but if you qualify it with extra logic to check that the contents were actually changed, it should be fine
i checked and it definatly wasn't once every tick
no, updateInventory is an api method that a bunch of gui plugins etc. use
it won't be called every tick
i'm just saying that you getting a set slot packet doesn't guarantee the slot was actually changed in any way
oh
conversely, you're not going to get a slot set packet with an item that isn't there, so it should be safe to listen to in that regard
wait you got a point
no i could accidently run the code twice because the packet was sent twice for the same item or something
this is frustrating
i'm not 100% if a slot being changed always sends a slot set packet either; there is at least in paper a container-update interval that causes container updates (slot set) to only be sent every n ticks, but most things that manipulate the player inventory also proactively send updates instead of waiting for that interval
this one is tricky but is there possibly a way in java to check when a list or array is changed
this is going several alphabets deep into xy; what are you trying to do
check when the contents of the inventory is changed
it's stored as an array
that's the x, what's the y
tf is the y
oh i get it now
i want to run effects when the player gets a specific item in their inventory
listening to the set slot packets should be sufficient for this, alternatively (on paper where you have the armor change event) listening to inventory click/drag + armor change + item pickup should cover all cases
well. apart from plugins just putting shit in the inventory
^
i go about this by listening to the events and running a full check of all slots once a minute or so
a minute is too much delay
Then check 1 player each tick
how bad is that performance wise
it is very infrequent for plugins to just put shit in your inventory
Maximum delay = online players ticks
the idea is that you separate your logic into two parts; one part that looks at a slot and applies any effect changes if it differs from how you last saw it, and another part triggering those updates
that's where the set slot listener comes in; that can trigger an update when a slot has "probably" been changed
because there'd be 2 loops every tick and who knows how many each loop will be
individually, not very, at least if you're using (paper's?) live view persistent data container to identify your items
but yes it does scale directly with playercount
which is why i chose a conservative interval of 1 minute
so far i haven't had any issues with it
Are you checking all players each minute
If so you’ve just spaced your performance issues out
the worst case scenario is:
1000 players
across the 1000 players there's 20000 items to check which would be an average of 20 items per player in their inventory
i'd need to check each item's pdc to confirm it's the item
and i'd run that every 5 ticks for minimal delay
it's negligible when amortized
how bad would that be
it might take say 10% of tick; that's negligible and not noticeable if it happens once a minute
but i wouldn't want to spend 10% of all my ticks doing it
That’s why you do one at a time
run a benchmark with those specifics
what about the rest
i dont have 1000 alts
not worth the scheduler overhead atp
nvm i can simulate it im dumb
then run the check on doublechests
depends on how much you can afford
and don't measure tps, measure mspt, i.e. milliseconds per tick
can i just run a spark profiler for like 2 minutes and send it here
Well, except when it’s below 20
and u analyze it
when it's below 20 the game is already lost
or well 🤡 i suppose there's the tickrate command now so you can set it to 1000 and then measuring it would actually be useful
players would host a party if the hypixel tps hits 20 for a split second
Maybe if @worldly ingot wrote better code :D
wow, k, banning you
Someone had to!
you got balls of steel
This code ain’t gonna mock itself
Tbf he wasn’t the one who somehow turned a 1/10000 chance to a 1/1 chance when moving from alpha to prod
because he's preparing something worse :0
so like
how do i confirm it's actually looping
remember to place a reasonable number of complex (named, enchanted, etc.) items in the inventories you're benchmarking with
i'm not making 20000 items
it's going to be moot if it's just empty inventories, because your 1000 players probably won't all have empty inventories
i just generated random items
do that, but make sure to put enchants and custom names on some of them
through the api, programmatically, of course, not by hand
this is because comparing simple items without meta and items with meta are completely different beasts performance wise
Don’t forget to have a hasItemMeta check so you don’t create a bunch of metas for no reason
this looks bad
in my experience calling this is actually just as expensive as just calling getItemMeta to begin with; after profiling some pdc related code i ended up just removing the call and getting item meta blindly
i ran the goddamn test and the plugin was disabled
i'm a genius
it might allocate slightly less, i'm not sure, but empty item meta's are pretty lightweight memory wise so i don't think it's a large concern
It saves you creating one though
Since it’s just a null check iirc
Actually that might only be for the Bukkit itemstack
mmm not quite i don't think, iirc the item factory does some sort of comparison vs the "default" meta or something
looking at it anew it looks like craftstack at least just checks if the component patch is empty
which ought to be faster
it's 1 tps, it's running on prayers and luck now
means nothing without context; take a spark profile and see how much time your code is actually using vs the server ticking normally
it wouldn't even run the profiler in the first place
/spark sampler --start --interval 0.01
it's 2 tps
run for about a minute and /spark sampler --stop
but ok
and again don't look at tps, look at mspt
dunno why it says 9 tps though
straight up lying
huh are you getting ItemMeta a 100000 times or smth
pretty much
org.bukkit.inventory.ItemStack.getItemMeta() 77.55% 7462.06ms
and this is why itemmeta is evil
average item meta moment
so now what
highly flexible system
what if i just access the item meta with reflection
now you go back to listening to set slot packets or bukkit events
i cant
Why not 
you can't access it via reflection, that's not how it works
depends ™️
|| paper has pdc methods on the itemstack that skip item meta cloning||
if only there was a PersistentDataContainerView that didn't go through ItemMeta
you can access the pdc with reflection (or you can use paper, which lets you get the item pdc without getting the meta)
har har har
hear me out
imagine like an .editPersistentDataContainer method
it's using the 70% cpu or whatever because of the item factory thing
that you could use to edit the PDC on an itemstack without cloning and parsing item meta
what if i just access the meta field with reflection so it doesnt go through that
that's not really going to work for internal itemstacks lol
Phew well glad no server implementation made every itemstack an internal one
that would suck here
the thing is that itemmeta is purely an api construct; the inventory you are accessing has items which have their metadata in a completely different format
if you try accessing the itemmeta field through reflection, it's going to be null because it gets created when you call getItemMeta
like i said
you go back to listening to events
ok
because doing this every tick clearly isn't tenable at the scales you're testing it with
doing things on a tick based system also does not sounds particularily bulletproof
idk what this is but like, if you need to catch changes, this sucks, clients can work around that rather fast
wait
applying item effects based on equipped/held items
is the pdc in the nbt of the item
Yes
what if i jsut use an nbt library
What’s an NBT
to get the pdc
I only know of components
Well
which i don't think spigot has events for for the armor slots
Items don't have NBT anymore
lame
this is why i ahve mojang
you'd be serializing the item every call
it was perfect
so you're kind of stuck with ticking
(outside of rw, there they suck)
if it wasn't for components, your getItemMeta calls would be infinitely worse
components are the best thing that's happened since the netty rewrite
how do i get the slot of each item in window items packet
and how do i check if it's the player's inventory that's being changed
see the protocol documentation i suppose
wasnt that gone
?ptorocol
yes
Yep
exactly
?protocol
?ptorocol
consult the mappings
this is the ptorocol according to my local AI model, I hope you are happy.
or simply go through the table of contents
what
Maybe my GPU doesn't have enough vram for proper models
the wiki page has a table of contents
i got the name window items from protocol lib
leave me alone 
why is the screen on the other side
tf is table of contents
a toc
Set Container Content
which in the mojang mappings is ClientboundContainerSetContentPacket
listening for when the player inventory changes
That thing is spammed to death on every cancelled event touching inventories
great
soo
Well, the client does some slot predictions the server needs to fix
the only reason i wanted to listen for packets is to not spam it
it's still spammed far less than if it would be if you'd look at every slot every tick
wait a second cant the player just spam click it to crash the server
Hmm, actually it should honestly not be sending a SetSlot tho
no, that would at worst be equivalent to you looking at every slot every tick
the test i made was 5 ticks
it'll send a ClientboundContainerSetContentPacket, which is differnt.
if you don't want to listen to the packet, your only ticket is to listen to the various inventory events and then run a less frequent check that goes through every inventory
these are the options, basically
there is no perfect solution without maybe going into nms and implementing your own custom enchant
well, i wouldn't exactly qualify that as perfect either
you want a lot of things
custom enchants have been around forever, it just wasn't exposed via datapacks and synchronized to the client
i could give it a shot
and you want it to happen immediately and in every possible case and you want to do it without an infrequent timer checking all slots
that is a lot of things to want
I still vote for the MD merges the PlayerInventoryChangeEvent PR solution
- i dont want it to happen immediatly, but i dont want it to happen every minute or something
- you're right about that one
- i didn't say no, it just didn't work
i think you've misunderstood the concept i put forward
i'll try the custom enchants one if it doesnt work ill just use normal events as you said
probably the only way anyways
the idea is that you listen to events and update the effects immediately on a "best effort" basis; but some things simply can't be caught, like plugins inserting items into inventories
these things are typically quite rare
so the infrequent timer check is there to make sure a player doesn't get to exploit something like that permanently
that's a weird way of spelling spigot
im dyslaxis
for this use, 1 minute is good enough
olivo put that gun down
i actually love you lynx
My event is cooler
but- but its a paper event
Because uhh
no buts
I made it
Paper is short for toilet paper
WOAH
Cuz you wipe butt with it
shower thoughts
Gottem
I think there’s a server that actually has a fork called toilet paper
yeah
Yes 
I think it’s Origin Realms? Iirc
Well, the humor of a yaml developer
forks are named anything, there's literally a taco fork
not for a spigot fork
i have a taco fork in my cupboard
wait spigot is a spigot
What about Yatopia
Fuck

didn't we used to have a taco joke in our eula agreement
and someone got annoyed af about it
i forgot i had it running and it's screaming
POV: hypixel console
Im storing the uuid of my textdisplay in database. The text display is persistent. How can i retreive the TextDisplay by uuid after a restart ?
You need the entity to be loaded
Bukkit.getEntity
Then Bukkit.getEntity() iirc
declaration: package: org.bukkit, class: Bukkit
Its a textDisplay for each custom hopper i have and i load custom hopper when the chunk is loaded so is that good ? The entity should be loaded
if the chunk is loaded then the entity is loaded
typical z
obviously fucking kenny removed it
average german core team member
god complex paper dev
literally
in nearly 60 years I've never tried tacos
i prefer quesadillas but a good authentic taco is great
you've looked at papermc code, now you will no longer be able to contribute to spigot
🫡
mc dev imports looked very ugly back then
I heard you like ternary
nah paper love ```java
if (boolean)
condition();
else
otherThing();
Hi, i'm trying to set the physics of an CraftEntity to false with spigot nms but all the method are obfuscated, how can I find the right one ?
?nms
Wrong server. Adventure is a Paper product
?whereami
das a lie
well, I guess it was merged under the paper umbrella but it is available on fabric and minestom too 
(it could be available on spigot too if you wanted
)
NO thats a sin
we always use the half ahhhh version of adventure library if we want adventure
I couldn't get a BungeeChat component PR merged
why tho, it looked good to me
was it that issue MachineMaker pointed out
Anyone know the best way to use GetofflinePlayer stuff in codes for plugins without issues
?xy
What issues are you having and what are you trying to achieve?
I’m making a punishment GUI and vault plugin and want it so it has things for offline and online players but apparently someone said I might be using out of date ones but idk the current new ones
lol
?
You should probably just use uuids
Is that more ideal and easier for this situation
It’s ideal and easier for every situation
Ah okay in that case I might try it
except for user interfaces
but that's what the gui is for -- a friendlier user interface hiding the uuids and showing human friendly names instead
hi im trying to compile a plugin from github (first time working with plugins): https://github.com/SergiFerry/PlayerNPC
i want to first get the source code to compile, and then figure out how i can fix some of the plugin's bugs
i have been running into issues because the source code doesn't include a pom.xml or anything else to tell the IDE where to get the dependancies
does anyone know how to get com.mojang or net.minecraft packages? spigot api doesn't include them for some reason
What is the best way to prevent loading world beyond some area of chunks for my minigame? Probably to render air or just don't render anything at all. Smth like spectator allowed to load chunks gamerule.
You gotta spigot includes it, you'll need to run buildtools for that
to compile spigot api?
ohhhh i see
the version i downloaded wasnt the whole thing
because they legally can't distribute it for some reason
so i have to build it myself
luckily buildtools seems pretty painless
hmm, its still missing com.mojang.authlib and com.mojang.datafixers
also what does it mean when a plugin imports itself...?
IDE says it cant resolve the symbol, and the referenced package isn't even in this source code i think...?
Why PlayerLoginEvent is getting fired twice when i disallow the event?
without disallow
with disallow
i really dont understand why
?jd-s for me
is that for me or
i said for myself 😭
#bot-commands smh
but it was to help my development..
Does disallow call the event again or something? I don't understand, or is this a bug?
Hey in my custom target goal i am trying to access the level of a mob, but it is private
private final WitherSkeleton witherSkeleton;
@Override
public boolean canUse() {
for (Player player : this.witherSkeleton.level.players()) {
if (player.getName().getString().equals("A")) {
this.witherSkeleton.setTarget(player);
return true;
}
}
return false;
}
Was wondering if anyone had help about how to do this or if im doing it wrong
this is just a test, as you can see it is targeting players with name of "A"
It’s looking for the ServerLevel, you can do this from converting it from the Bukkit world using the Bukkit.getWorld(name) method, then cast it to CraftWorld, finally use .getHandle() to get the Level
I want to add that’s it’s likely easier for you to just get the players in the world by the Bukkit means then iterating over them, however if you need the ServerLevel specifically this is how I do it.
can we add and remove things, and clear a Chunk PersistantDataContainer in async ?
No
Looks like a bug at face value, but I've never heard of it and that code is pretty surely so idk
You can try reporting it
we can just read the container ? not write yes?
Reading would be unsafe in some conditions too, but shouldn’t be as much of an issue
in my case that's not a problem
I juste need to check if the container has a NamespacedKey
The thing is that PDC does IO, so anything in a different thread could trigger a race condition if you happen to access it on the same time as the server
damn
I am unsure of how much it does things on memory once the container is loaded (in this case, a chunk), it should be the case but I wouldn’t rely on it
Worse comes to worst, callback on the server thread to do pdc stuff and then continue async stuff
with dissalow
without
Is there a way from stopping the creaking heart to deactive itself when its not have the required logs?
Like BlockPhysicsEvent or something else (but that event didnt get triggered for the creaking heart)
bro is NOT running spigot
loool that is why i also first tested in paper 💀
do not mind that
Any spigot pages explaining how to use timers?
Like for exmaple when I walk over apressure plate I want a timer to start right above my hotbar
?scheduling
thx!
and Bukkit.spigot().sendMessage
Does that put the message above my hotbar?
amazing, thank u!
how does pterodactyl detect when the server is running?
It checks for the startup message
You can see that if you open the server egg
oh is that a docker feature?
i thought they were docker images
Internally yes, but eggs are more like a config for using that image
ah
So you specify the image and other things such as startup command and what to wait for ect
not 👏 spigot 👏
lol i tried in spigot also
could not re produce
consistently
spigot
correct
how did u re produce btw
this thing only prevented intelij from building 💀
this is weird
only the first join, consistently fires thrice
after that only fires once
What client are you joining with? Notchian?
yeah the microsoft - mojang minecraft default client
no mods
And simply disallowing the connection in the AsyncPlayerPreLoginEvent causes the client to try three connections in rapid succession?
Or is there something else involved.
yeah nothing else
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class LoginListener extends JavaPlugin implements Listener {
@Override
public void onEnable() {
// Plugin startup logic
Bukkit.getPluginManager().registerEvents(this, this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
@EventHandler
public void onPlayerLogin(PlayerLoginEvent event) {
String playerName = event.getPlayer().getName();
String address = event.getAddress().getHostAddress();
getLogger().info("Player " + playerName + " is trying to log in from IP: " + address);
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST,"trying smth");
}
}
this is the wole plugin lol
What is this "clumsy" screenshot for?
i tried to re create it even after the first login
so tried to create artifical lag
I cant reproduce this. Are you running the latest Spigot version?
Btw what are you planning to use the event for?
yeah
bro that ain't spigot 💀
i also tried there 💀
i can't keep taking screen shots
Sure you need the LoginEvent even?
Oh nice, well... in that case dont use it ^^
i was jus testing this
How can I use this to display a timer? Because this does something every x amount of ticks, but I need the timer to stay in the screen through the entire run, you also need to see the miliseconds
You need to repeatedly send the timer to the clients. Possibly each tick.
You can use the actionbar, bossbar, scoreboard or titles for this.
You'll have to associate data with the player and whatever
For example, when a player steps on a pressure plate, we create a "player timer data" object with, let's say, 100 ticks remaining and we associate it to the player (using a map or something)
Every tick we tick every timer data object and remove it from the collection if it's expired, for example
You can use bukkit's scheduler for that "every tick" logic and display the timer when you tick it too
If you want to get fancy you can make a whole abstraction around renderers vs timer tasks vs timer filters vs whatever
That’s also why we get bukkit.getPlayer 👍
I would actually like it the other way, when I play walks over a pressure plate the timer starts counting from 0 seconds till he reaches the end
Problem is that I can not know the amount of time
Idk why mine is getting fired twice then
Since it depends on how fast the player finishes the parkour
It is not always sent twice, sometimes it is more than two or just once
Hi guys I've been on this discord like few months ago and I'm now learning GUI, someone send me article about OOP style of GUI or how do code it propertly, someone know which article it was?
?gui
oh nvm
I'm creating and using a GUI plugin, but I want to place a player head within the GUI and change the appearance of that player head. How can I do this?
SkullMeta
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1);
SkullMeta skullmeta = (SkullMeta) skull.getItemMeta();
skullmeta.setOwner(// player here);
skull.setItemMeta(skullmeta);
Ok, I fed up with game communities blacklisting mobile hotspots so I either use this energy to something useful. So the reason this is there. You see the normal hoppers pulls 1 per item. So my question is, how can I get it to pull 8 per item without editing the spigot.yml I think its called?
I using that but its not working
?nohello
Scatter its the feds
The item does not move, how can I get it to move?
https://paste.md-5.net/berilatixu.java
did you read the javadoc for that event?
I tried
I tried to use timers. I started on its function then I thinking "This is not going to work" because if you know how hoppers work, its going to be a task which Mojang has already done. I just want this to work, I been off and on about this for months
You are canceling the even without modifying the Item so it will be returned to the source Inventory
The Item MAY have already been removed from the source inventory, so it no longer exists in the source when you attempt to remove it
I removed the cancelled event and 64 turned to 32
you also set your transferAmout to Math.min, so its always going to be 1
and item.getAmout is also going to be 1
so resultItem.setAmount(amount - transferAmount) resolves to 1-1
Changed Math.min to Math.max, 32 turned to 16
so your resultItem stack size is zero and you try to remove it from the original inventoyr where it no longer exists
you never check the original stack size
do hoppers pull a full stack at a time or do they pull 1 item?
Only one item
its been so long since I played MC
so if there is a stack of 64 it will pul a single item, leaving 63 in the inventory?
Yes, realiticly
ok
You know what I can do here?
If I were you (as its going to be a stack of size one each time the event fires) I would modify the getItem (not a clone), then remove the extra items yourself.
IF the source has the required items
I normally don't ask this but you got my code, could you edit it and I test it like I trying to get ChatGPT to do? I cannot really think. This server with its mobile hotspot blacklist annoyed me
I cannot even adv it so don't ask what server
Nope as I'm cooking dinner
I tried editing the amount (Not Clone), its not working
I had to use setItem and it saved its amount
how do I go about changing a player's movement speed in lava?
tried a whole bunch of things, like changing the velocity, movement speed attributes, setWalkSpeed, flySpeed, etc. but none of them seem to work.
There's WATER_MOVEMENT_EFFICIENCY but I don't think Mojang ever added one for lava
if the water movement attribute doesn't work, then your last resort would be a speed potion
what'cha cooking
Cottage pie, and it was lovely
i've thought about trying that recently, never had it
its yummy.
sure looks like it
oh my, am I going to have to get my hands dirty with NMS?
I don't even think NMS is going to save you here because it's not like there's a field you can change
You would have to mod the server. A Spigot fork
all that just to change how fast a player moves in lava?
Yep
yah, I am not doing that, way out of my scope. Not gonna do that just get player moving fast through some orange water.
how do I change the server's elytra handling logic? nms or smth?
orange water
😭
Yeah probably but you're going to fight with the client
today is "asking about things that the server can't do" day
Must have missed that memo
Well maybe the server should control movement smh my head
applying vectors every tick has worked really well for me in the past
I don’t understand how games that do server side movement still make it smooth for laggy clients
I figured they would be snapped back a lot by the client prediction being out of sync
uh
it's a mix of push back
For example Apex completely kills movement if you have any sort of packet loss (it pushes you back)
but it's somewhat acceptable if your ping is high
Rocket League does client prediction but if you don't get a movement packet, you slide to where the server tells you you should be
If you don't sent an input packet, the server just assumes you're still doing the last input
yeah these games just push you towards a direction
I guess being pushed would be less jarring than snapping
sometimes you snap if your packet loss is too crazy
the client sending absolute movement instead of relative helps with desyncs
I assume the server also tells it where to go and the client pushes within a certain range/time
you could do a pro gamer move and just get a career at the game company
and then just read the code and fuck off
stonks
Genius
imho liquids should be easy to make data driven
where can i get com.mojang.authlib and com.mojang.datafixers?
oh alr
Although I think you’ll also get them when depending on spigot (not spigot-api)
i looked through many reddit posts and spigot threads, many recent, and they all gave a separate link to a minecraft.net hosted file which for some reason didn't actually include the packages
(worth noting that Mojang aren't the ones that publish AuthLib or DataFixerUpper to Maven Central)
it says it's able to find datafixer, but cannot find any specified version of it...?
6.0.8 apparently doesn't exist, and neither do the other versions
It's not located on Mojang's repo
I thought they are
Nope
Swear I've downloaded it from there
The one listed on that website is from Carm repo. You would need to add https://repo.carm.cc/repository/maven-public/
Again, Mojang doesn't publish the auth lib. Third parties do
The only library Mojang publishes is Brigadier
mojang does publish authlib on their repo tho?
Does it?
yeah
Guess I'm high
sources jar too which is just confusing to me lol
sharing is caring
I'm in Canada. I'm told it's not even good weed
oh yeah you are
i tried that one, no dice
that's right
nor this one
Do the randy, eat a plate of brownies and not realise they don't have weed in
<!--Mojang -->
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.5.41</version>
<scope>provided</scope>
</dependency>```
thats the last time I use authlib
from xml <repository> <id>minecraft-repo</id> <url>https://libraries.minecraft.net/</url> </repository>
it can't find it
im 99.99% sure its right there
it just looks at the version number provided and says "welp that version doesnt exist cant use it"
its colored red in the IDE
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.5.41</version>
<scope>provided</scope>
</dependency>
everything looks fine, just the version number is red and it says it cannot find that specific version
it finds it for me
what version does spigot have in craftbukkit?
Did you run a build or whatever intellij makes you do if you're using that
did you reimport the project
i used buildtools to compile spigot api
my god that version of authlib is old
then i took craftbukkit and spigot jars from that, and i added them as libraries
it resolves all spigot and bukkit related dependancy issues
So you're not using maven?
but the com.mojang ones arent resolved
it's a maven project with a pom.xml
but i was told to manually compile spigot api
what does your pom look like
But you don't add jars in pom.xml
i drag and drop my paper jar into pom.xml
correct, i added it under project structure -> libraries
Suggest you share your pom.xml and the log of when you compile via maven and not your ide
(im using intellij idea)
that means you aren't using maven for those dependencies
how do you use maven for a file that is not hosted online?
it is hosted tho
?maven
the spigot-api is hosted online yes, but if you run buildtools then it should also be in your maven local repository
then why do build tools exist?
buildtools exists for you to run spigot, like, at all
buildtools is the one way you get the spigot jar to run your server
Bump
ok so its for making a server, not deving for one?
you mvn install it to your local maven repository, though i think buildtools maybe already does that when you run it
the server jar, that is
oh the m2 directory?
Why are you building a project with only those dependencies?
no clue, never ran buildtools in my life
Don't you want a spigot dependency?
pom.xml is not finished
im compiling an existing plugin and i'm just trying to get these dependancies nailed down before i go hunting for more
Well the only dependency you need is spigot-api or spigot
So I would delete those dependencies and replace them with spigot-api or spigot
how do i tell it to use files from the local maven repository?
It does by default
you just have to add the dependency to your dependencies block in your pom, with the proper group and artifact id
i removed the minecraft repo and now it can find authlib and datafixer 😭
even though i originally didn't have minecraft repo in repositories in the first place
i am so confused
what do you even what authlib and datafixer for
You don't need these libraries, you need spigot
to compile a plugin so that i can fix it for my server
it specifically calls for authlib and was saying it couldn't find it even though it had spigot.org and bukkit.org
and a bunch of other things
hold on ill grab the source
just run buildtools for the version you need (of spigot)
then depend on spigot instead of spigot-api
4838 lines wtf
That code is very incomplete. It references a tonne of classes which aren't in that source repository
Do you have those?
is there a reason you are using this plugin instead of just Citizens really
Otherwise you're just gonna run into a very hard time
this plugin doesn't seem to be doing anything special for NPCs
no, but in the comments on the plugin's page apparently many other people have taken to doing the same thing im doing and it has worked out for them
theres one nasty bug i want to squash
why are they putting the generated JD on github
You definitely cannot compile that plugin using only that code in that repo
That repo contains only the API, not the implementation
it's a dependancy for another one of my plugins
wow ok 😭
idk what to do then
make your plugin use Citizens then
so i have this plugin called corpses, it's the best plugin for player corpses, and really the only one that works and is customizable. you die, a corpse spawns with your items. it will despawn after a configurable amount of time, and if you get back to it before then you can get your items back. if you take too long, the items get dropped from the corpse and while the corpse is gone you have another 5 minutes to get the items (default despawn time)
and this corpses plugin depends on playernpc
but playernpc has a bug where if you create a playernpc with a cape that didn't exist back when the plugin was made, it fails to make the playernpc. it has no error handling for this when it happens.
so the corpses plugin, after a player dies with one of these capes, will drop the players items immediately as there is no corpse to put them in. but then after the corpse despawn time it spawns ANOTHER set of items as if there actually was a corpse and it finally despawned.
it's a dupe... which is pretty bad.
i genuinely do not know how to take someone else's plugin and make it use a whole new library that it didn't originally use when there are major differences between both. ive been having trouble even figuring out how to compile this one...
https://www.spigotmc.org/resources/1-20-1-21-lootable-corpses.120407/ is something like this not enough
that's for a much newer version of minecraft and the config is awful 😔
are you on 1.8
I had assumed you were trying to update the plugin to a newer version
do you have a link to the corpses plugin
it is that one
if it's open source (and has a proper build script unlike this shit you're trying to build) modifying it to use e.g. citizens would be orders of magnitude easier
that said, the Corpses plugin doesn't even seem to be open source so how are you planning to modify it
but the bug happens in playernpc
the only option is to fix playernpc
as far as i can tell
playernpc is a dependancy for corpses. the bug happens in playernpc and causes corpses to dupe item sets
theyre both built for eachother specifically
and i dont even think corpses has source code out there
so i would have to decompile or something
alternatively you can try like decompiling playernpc and selectively recompiling the problematic classes
don't even try to use maven for this honestly
it can't be done since the source is just not there lol
you think the necessary classes are all included in the final jar?
the github repository contains no implementation whatsoever
if so that may help things
sure you can, if the plugin runs on your server then you already have everything you need
it's just a matter of decompiling it
hmm
I believe it'd be more worthwhile to just remake the plugin yourself
i did this to update mythicmobs to 1.21.4 despite it being closed source
instead of digging a rabbit hole to try and get the a compilable source out of a decompiled artifact
the trick to the matter is that you don't want to recompile the entire artifact -- just the problematic classes
although if the problematic class is 4000 lines like this nonsense on this repo, the two might be one and the same 🤡
you could just take this one https://github.com/connormck333/LootableCorpses and make it work for 1.19.4 as well as change whatever you need to change
to clarify, i have no idea what im doing im not a plugin dev xd
it will take me years to get good enough at plugin development to make something like this from scratch
yes, this is honestly probably a much better option
looking at the plugin it seems like the author is a blithering fool to begin with
inb4 they're a youtuber who makes plugin
hm, a backport...?
they do give me that vibe 😭
you could also just ask the author of that plugin above if they could support 1.19.4 lol
if you're lucky, they'll do it and you're good
it uses nms so i doubt it
i remember i tried it out at some point
why it uses nms is anyone's guess
but it depends on protocollib what




