#help-development
1 messages ยท Page 252 of 1
odd
But sometime it is
I don't get it
Maybe I've got a plugin that cancels the event
When not the same case
So when I perform myself it bypasses this plugin
if it's a bungee plugin it will ignore performed commands (I believe)
I never knew
What's the difference between dispatchCommand and player.performCommand
weren't builtin command made case sensitive in 1.19 or 1.18.2 or so?
hi guys
all (properly registered) commands, 1.19.2
Could I get some clarification on when durability is consumed? I'm trying to override a BlockBreakEvent's drops by my own by setting the block to air anad providing my own drops. Problem is, durability isn't being consumed, even if setCancelled is false.
there's the PlayerItemDamageEvent, no idea if that helps you
to get the drops, you'd normally use the BlockDropItemEvent. in BlockBreakEvent, you have no way to get the actual drops
I do, that event has e.getBlock.getDrops()
yes, it doesn't return the actual drops
it doesn't?
it returns a list of "hypothetical" drops
well anyway I don't need the drops, I only need to check what the block is and set my own drops
e.g. WHEAT will return 1x WHEAT and 1xSEED but sometimes, they don't drop seeds, and sometimes they drop more than one
but it doesn't consume durability
so you want to manually damage an item? I don't really understand the issue
there is an event for blocks dropping items
yes, but the block is already broken by then
don;t override in the break event
the issue is, I'm overriding a block's drops by setting the blocktype to air, then dropping them by plugin, but doing that does not consume pickaxe durability
he's just breaking it himself to then drop his own drops
if he uses teh correct event he can control the drops
https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/ItemStackUtils.java#L229 This is how I damage items. It works the same way as in vanilla, e.g. it respects durability enchantments and stuff, calls a PlayerItemDamageEvent, and blah
alr, I guess I'm gonna use blockdrop then ^
cancel BlockDropItemEvent if block matches + World#dropItem()
will not do what he wants. He already has the correct answer
will not damage teh tool used. Which was his original issue
if you cancel the break the damage to the tool is also canceled
yes and no
just cancel blockdrop and drop item manually in the world
I didn;t notice you said blockdrop event
and then call another BlockDropItemEvent ๐
for your custom item
with the cancelled event's blockstate
is World#dropItem calling it
no, it only calls ItemSpawnEvent
how would it be supposed to know what block caused a drop
could also be a random drop, or an entity. and also the original blockstate is meanwhile gone
No need, you don;t even cancel the drop event, just remove items from teh drops and drop whatever you want
oh true
I'd still call my own BlockDropItemEvent to notify other plugins about it
perhaps
i just thought it can call blockdropitem with block on given location or smth
but block is not getting destroyed so yeah
i love this so much
Guys, a strange idea came to me. But is it possible to use the bar next to the nickname in order to color-mark certain messages?
I was looking for this in the api, but I didn't find anything
๐ฆ
Do u mean the chat reports?
The only thing you can do is make it green gray or red by either activating deactivating chat reporting or using only system messages
By the way, I didn't understand the encryption topic at all. What is it for? And will the NoEncrypted plugin, as well as enforce-secure-profile=false, be enough to disable this?
I prefer anti popup by @onyx fjord
How's that?
Activate chst reports by removing all chat formatting plugins and enforcing secure profile
Deactivate by not enforcing use a plugin
System message only via a plugin
I meant the decorative function of this, but as I understood, it is only possible to implement it from the client's side
You can't use that bar as decorative
You'd prob have to override nms code for that
Best would be to use fabric as they use mixins a lot
gaze upon my creation and despair
hows your dog
dead as dirt
ratio
technically things can go more inline, when I do conditions for actions those will have targets as well and that's inside of a script inside of the powers card
that's going to be pretty funny
I noticed in 1.19.3 the PacketPlayOutPlayerInfo class has disappeared. Does anyone know what it has been replaced by?
Is there a way to register an eventListener to only some players to reduce server processing when a lot of players are present ?
Just do an if statement in your listener
No need to overcomplicate
Your O(1) check is not going to overburden the server ;p
It took me 8000 leaked infinite running async tasks to crash my server you should be fine with your if check
ask geyser
any of you know a site where you can convert a texturepack file to a link
not dropbox i swear there was an actual website for it
this? https://mc-packs.net/
Guys, can someone who know javascript help me translate this to java? I'd appreciate it
async function ScanResult(scanUUID) {
const response = await axios.get(`https://api.echo.ac/query/scan?key=MTYxNzAzMzEzMjEwOT&uuid=${scanUUID}`) //get scan info for scan with UUID = scanUUID (would replace key with your key)
if (!result)
return ("no result")
if (result.detected = 1)
{
return 1
}
else if (result.detected = 2)
{
return 2
}
else
{
return 0
}
}```
Can I get the dc link of them?
From what ik is that this is a authme problem
authme triggers once you have joined, it wont stop you from joining from what i remember
Yea it is not even letting me join once
It says this
its probably a geyser issue
Let's see
It's not Geyser but floodgate that's causing your issue, the prefix to be specific. Either yeet the prefix, yeet auth me cuz meh offline .. or edit auth me regex to allow the prefix.
check if it is https://hub.spigotmc.org/javadocs/spigot/org/bukkit/material/SpawnEgg.html probably
declaration: package: org.bukkit.material, class: SpawnEgg
SpawnEgg class deprecated
i did not see that lmao
Deprecated doesn't necessarily mean unusable
Hello! Is there any functions exposed to the API; which I can use to edit the Knockback?
I haven't did Plugin programming for 2 years, so I'm kinda lost rn
set velocity
thanks!
It's better to have two listeners or one with case? For the EntityDamageEvent and events DamageCause
How should I load default kits?
Should I stick to yaml, or via code directly?
i prefer the first option, but i'd like to have feedback
yaml ofc u can change it anytime
yes, that was a silly question thanks!
What's the best way to prevent a chunk from unloading ? Is there a better way than loading it again as soon as it unloads (doesn't seem very efficient, plus I don't know if a chunk will unload at every tick when a player is not near it) ?
(I can't do chunkUnloadEvent.setCancelled(), idk why)
Guys, how do I check that the block == any carpet?
there are few ways
one is to check if material name ends with CARPET
like your about me lol
add a chunk ticket
search the javadocs for ticket
?jd-s
I found the setChunkForceLoaded function which seems to be the best
Thank both
Use chunk tickets like md5 said. It's better for compatibility with other plugins
Wouldn't this set the server's MOTD when it gets pinged, right?
@EventHandler (priority = EventPriority.HIGHEST)
public void onProxyPing(ProxyPingEvent e) {
ServerPing ping = e.getResponse();
ping.setDescriptionComponent(new TextComponent("Testing..."));
e.setResponse(ping);
}```
all it does is bug out the version
why does generating a vanilla structure not put any loot inside D:
ig the lower part isnt part of the structure
Hmm
I dont have much experience with structures, but, intuitively there is probably another section
see where that structure is invoked in NMS i guess
weird though cause DesertPyramidStructure extends SinglePieceStructure
ye
just sending that and no other info isnt gonna do much
also go to geyser
for april first paper and spigot should swap icons, it would be pretty funny
can confirm
this is a longshot but anyone have experience using selectize on websites?
it looks cool but it requires jquery which I was trying to avoid
HI, how can i create an entity for a client using packets (obviously)? I want to show it not hide it from everybody else
Could you be more specific?
Paper will use their paperchan-theme anyways, so that will not happen
that sounds cursed
<#general message> being their mascot. Yes, I am not kidding.
thanks, I hate it
almost as much as I hate installing jquery and a library only for it not to work
aha this thing requires it to already be appended to the page, that's why
The rest of the data I guess? Can you send a link
What even is selectize?
Documentation and demos for the selectize.js library
the functionality seems pretty cool
for my purposes
if action is 1 for example only the gamemode field will be present, for 4 there are no fields and so on. @midnight shore
No example images. Sadge
However, from what it's described as, it sounds like a glorified <datalist> tag.
Examples of using the API to control selectize
it does native multiselects, it can autocomplete based on different fields and so on
and it's a single line to hook it up to my system which is always a plus
ohh okay
ty
Ah, I see it does a little more than the normal datalist element.
Hi, i have a problem that if i rotate an item in item frame the value does not update in java, or at least on my debug messages. this is the code to check which rotation the item frame has: ```java
public void paint(){
for (Bundle<ItemFrame, Type> pack : frames.values()){
if(pack == null)
continue;
ItemFrame frame = pack.getFirst();
boolean isCorrect = false;
switch (pack.getLast()){
case Up -> isCorrect = frame.getRotation() == Rotation.COUNTER_CLOCKWISE_45;
case Right -> isCorrect = frame.getRotation() == Rotation.CLOCKWISE_45;
case Down -> isCorrect = frame.getRotation() == Rotation.CLOCKWISE_135;
case Left -> isCorrect = frame.getRotation() == Rotation.FLIPPED_45;
case Start,Stop -> isCorrect = true;
}
System.out.println(frame.getRotation());
//set sea latern
if(isCorrect) {
frame.getLocation().subtract(1, 0, 0).getBlock().setType(Material.SEA_LANTERN);
}else{
frame.getLocation().subtract(1, 0, 0).getBlock().setType(Material.BLUE_TERRACOTTA);
}
}
}```
is that one of the things that you need to tell the block to manually update?
how to get server tps?
StringBuilder sb = new StringBuilder( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " );
for ( double tps : MinecraftServer.getServer().recentTps )
{
sb.append( format( tps ) );
sb.append( ", " );
}
sender.sendMessage( sb.substring( 0, sb.length() - 2 ) );
this method get crash (sorry for my eng)
item frames are entitys and idk
as far as i know yes
I think they are TileEntities.
No
I thought they were tileentities as well
They are entities
im confused now, is the method that i use to get the rotation wrong?
Wait, why aren't you using ItemFrame#setRotation()?
What version?
1.19.2
because the player rotates the thing setting it would be contraproductive
What?
he's scanning rotations
How is the player involved here?
im trying to get the rotation and set the block to a sea lattern if the rotation is correct but the rotation is not updating smh
does it always give the same value or could it be that you are getting the value before the rotation is fully done
i have a 2 tick delay + i runned a comand so its not to early still same result
Hey, is there a way to get the items dropped list from a block broken on the BlockBreakEvent?
I want to know how many items they are getting and use that count for some kind of xp multiplier on my plugin. Searched online but couldn't find any specific threads with this. Only thing I found was to make your own fortune code.
event.getDrops()?
no, but you can make it by geting the block
event.getBlock().getDrops()
yep
does that take into account the fortune on the pickaxe used tho?
No
i thought that gets the drops from the default block. not fortune included
I want with the fortune included.
Use the BlockDropItemEvent
u can calculate that
No
u can't really, fortune is "random"
Again use the BlockDropItemEvent
make it random
I will look into it.
you didn't read my question then
You can use the same method, but pass in the tool the player is using.
#getDrops(ItemStack tool)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockDropItemEvent.html
^ Here's the doc link
declaration: package: org.bukkit.event.block, class: BlockDropItemEvent
wouldn't that generate a different outcome tho
It would
It shouldn't though.
im already looking into it, ty
If you are passing in a tool with fortune, it should take that into account when getting the drops.
fortune isn't always the same drops
Fortune doesn't drop the same amount of items every time
then how is it supposed to foresee whether fortune will turn this diamond ore into 4 diamonds or 3 diamonds?
Is that not what you're wanting?
all it can tell you it's 1x diamond when using a pickaxe and 0x diamond when using anything else than a pickaxe
it returns the "default drops" for this itemstack and nothing else
I was looking for the drops given by a block broken. not to create my own drops code.
you cannot. at the moment where BlockBreakEvent gets called, the drops haven't been calculated yet
Yes, and it'll give it to you. You just have to pass in the tool. It returns a Collection<ItemStack>.
i know, we talked about it already
Olivo told me the right direction.
im fixing my code on it
aw yee bby I love webdev
BlockBreakEvent is fired at the top of PlayerInteractManager
then when it was not cancelled, it calculates the drops, otherwise it sets back the block
yes we found it already
BlockDropItemEvent is the one to use for such thing
I may be thinking of a bug it might cause.
if I break a furnace or a chest with items inside. this function will be called and it will "glitch" the system
I might really need to create my own fortune system
since this event says the event.getBlock will most likely always come as AIR since it's called after block being broken, i can't really check if they are breaking a ore
you do know you can create a custom event that combines the two events
only way would be to check the drops but a chest or a furnace or any other "storage" would bring it up
and then fire your own custom event for such things
ofc yo ucan
just get the blockstate
like blockBreak creating a drop event?
or just filter the list to only contain the drop types from getDrops
I never did such a thing
ah
most people overlook making their own events
np
wrong reply
but what if you have a chest full of chests?
True
although no problem, containers will always only drop one of itself
If you break a container it will always drop 1. Fortune don't work so you can just give xp from get drops
;/ too slow
Jfc, do none of you realize that #getDrops(ItemStack tool) will do the calculations with the enchantments applied to the tool you provide?
I see 8 diamonds. The sysout shows 9
Doesn't match
but it does a new RNG
game will drop X, code will say it would drop Y
you don't get it, do you?
as you see yourself, sometimes it returns 4, sometimes 1, sometimes 3
the drops were not calculated yet, so although it says 4 now, it doesnt mean it actually also will drop 4
as you see yourself, the output of getDrops(itemstack) is random
Oh ffs. I'm dumb.
I don't remember it being like this at one point.
It used to calculate things properly.
that's not possible
^ doubt
it's like a dice
it can be 1-6
now I ask you "throw the dice" and it returns 3
then I throw it too and it's 5 now
it's the exact same thing
what's the rng of it? does anyone have a table with that? for fortune
like, from where to where per fortune
probably the ServerLevel's RandomSource
are people just confusing this with loot tables?
Did they change fortune to loot table logic?
i was more looking for a code on it, because u can have more fortune than 3.
๐ฑ
The math is there, you just gotta plug in the level.
didn't see it. went right to the table
๐ซ
isn't it simply this?
@tender shard
๐
stop pointing out im dumb and didnt notice
๐ฅน 2nd time already
but tyty
I'm curious now. Does #getDrops(ItemStack tool) not returning the proper value intended functionality then? Or is this a bug?
It works just as intended
getDrops returns what would be dropped if you broke the block
It's just that a block doesn't always drop the same things
Yea, but it's not returning what you would expect.
Is there a way to increase the maximum durability of an item?
Durability is hardcoded so you can't change it
You can however make it use less durability like the unbreaking enchant
it's returning what you "can" expect.
But that's dumb. It should return exactly what the game shows. Not an approximation.
It's not an approximation though
i mean there is randomniss involved if i get it correctly
block break gets called when u break the block. the dropping of items happens after you break the block.
the block.getDrops does a "simulation" if you would break that block.
like Olivo has helped before, if you need the event when drop items happen, use the event BlockDropItemEvent
this one will tell the right numbers.
@chrome beacon btw, im trying to make a "Harvesting" event and I'm using the event PlayerHarvestBlockEvent. But now I'm not sure which to use for each crop. like Wheat/Carrots/potatoes can be called on this event or on the blockbreak or on the blockdropitem. and the Sweet Berries can be called on the playerHarvest or on the blockdropitem as well.
Do you perhaps know for this what would be the best?
I tried to hide the original durability and make the other look like original but my math is bad, how can I do it?
i guess blockbreak is called first, so i should use the ones after in case blockbreak is cancelled.
You can do that. You simply scale the durability by % of the original durability... if that makes sense ๐
get the persentage from you 'new' durability get the orginal and aply the persentage and then set the result as durability
but seems like there's 2 options which makes it weird to know exactly which to use. if anyone has used them and knows whats the different and which should be used for this. would appreciate
I would use the BlockDropItemEvent
i made my own custom mining system i never worked with the spigot/minecraft one
//push
If you need the drops and don't care about cancelling the block breaking the BlockDropItemEvent is what you would use
time to use BlockDropItemEvent for everything ๐
The only downside is that the event doesn't exist in old versions (if you're trying to support that)
nah, the server is on 1.19.2
i do use viaversion to allow older versions
but not the server side
Then great you don't have to deal with the pain of multiversion support
No problem ๐
I already know to calculate this as a percentage, but I couldn't figure out what kind of operation to use
my english is bad, sorry
Time to open the Minecraft wiki again
like unbreaking 10, is it 10+1 uses per durability, or some weird formula % behind it?
Minecraft is very well documented
It's a percentage chance to not use a durability.
yeah im seeing that
I see
that's weird but also kinda makes sense
Looks like the formula is 100 / (level + 1) % chance that using the item reduces durability
at the end of the day, on items with big durability the chance will always end up being close to average anyways
but its crazy how it's a chance to take down durability
curiosity fixed ๐ ty
don't think the chance percentage changes with levels
think it is only how much durability is taken away is all that changes
Tools and armor have different calculations.
been a while since I have needed to really look at mc internals
are u saying if we have high unbreaking(like 100s), our durability goes down to like 1000.05.... 1000.04....?
Tools always go down by one, and unbreaking calculates a percentage change to not tick damage based on the level.
Armor is another story.
minecraft certifiably has one of the worst item durability systems ever conceived
they use damage because they favor smaller numbers
but binding limits to the material instead of to the item meta is a bit mehh
but when I get the health of the item it only gives the total lost health, also I can only set the total decreasing health
maybe like you it's because they can only fit small numbers in their small mind
This. Not just durability, but item cooldowns. Just put it on the ItemStack plz.
what's the largest number you can think of illusion
or to achieve better compression ratios, to fit more data in less space
you can always add numbers on top, this is the concept of different infinities
see he doesn't even know a single number
uh, sure
compression is a stupid excuse, it's a bad system just like the damage system
Illusion: nothing
Me: Parabolaยฒ
y=mx+b
any1 knows why item frames just change theyr entity id and how to update them so you have the correct entity id again?
Oh god not basic math
its a normal line function
No really?
Myes I was about to do some crazy ass chunk scanning for specific blocks then I realized chunks are a persistent data holder o am i relieved
do you know how to work with item frames cuz im stuck ๐ข
Gross entities
ye
I've never 3ven touched entities
oh
Crazy considering it's been almost 2 years now
what to code?
? wdym
How do I get the direction a furnace is facing?
I'm proud of myself entities sound like they suck to deal with
Laggy messy unfun. Not even mentioning if you need nms with them lol
Furnaces have Directional BlockData
Directional furnace = (Directional) block.getBlockData();
BlockFace face = furnace.getFacing();```
Ty!
Im trying to build a javadoc jar but it gives me this weird error, Is anyone familiar with how to fix it? https://paste.md-5.net/cayiyanace.cs
Only thing I haven't touched during the past 6 years is scoreboards
Guys, what can I code I ran out of ideas
essentials 2.0
Make a plugin which creates giant mobs
like
made from blocks
and they walk around like normal mobs
lol
What would be an efficient way of making multiblocks without the code becoming 100 if lines?
multiblocks?
I've a problem, I need to pass a player parameter in a method of CorspeRebornAPI (a corpse plugin as the name suggests), the problem is that sometimes I need to spawn a corpse of a player just by his name or his uuid
The plugin MUST takes a player as parameter, but sometimes the player can be offline
Do they have a method for an offline player object or only Player?
If you really need an offline player and they don't support it I'd ask the dev to add it or write a pr yourself
i remake hypixel skyblock, its fun
My most fun projects till now was to write a chunk-based claiming plugin. On it's own no big deal, but then one can hyperoptimise it
These are only the chests current loaded
I assume you are better of reading the world data directly
It loads all the chest witch are already in a loaded chunk right?
well that is what it is intended to do
As they are already loaded
Not sure how they behave if the loot hasn't been generated yet though
Can you give me an example on a way to do it?
Define "it"
To get the contents off all the loaded chest
nah
Have some ideas?
cast blockstate to Chest
Good choice
how long would be the vector player.getEyeLocation().getDirection()?
how do we make the hunger more higher for the user
It's normalized, so 1
like they should get hunger a bit faster
Yes
can we use the setSaturation
Saturation is (in a very oversimplified way) a second hunger bar, so probably not quite what you want
i see
To make people hungry more quickly, you have to give them the hunger effect. There's no other way to go about doing that unless you intend on having a task timer that ticks every few seconds and decreases hunger or whatever
(which is a valid solution - you can do that too)
i meant like
in peaceful
the hunger is slow / doesnt lower
how do i make it medium
does the server need to change it
Oh, yeah, then your only solution is to handle hunger yourself
I don't even know if hunger exists in peaceful mode or if it can be set to anything lower than 20
ok
Why can't I cast Block into Furnace? (yes I am using org.bukkit.block.Furnace and not the material one)
blockstate?
set 5 to {kills::%player%}
doesnt work
Ask in the Skript discord
where
where is the skript discord
ty
Hey, i don't know where to ask this but has anyone used Orebfuscator (Anti Xray) or some other kind of anti x-rays?
The problem I'm having is I made my own mine 3x3 pickaxe, and it's not updating the blocks correctly around and gives "visual bug".
(Video attached below)
Has anyone dealt with something alike and knows a way to fix it?
I've added to my code the Orebfuscator API to try to fix but still hasn't worked. I will post the code below:
didnt choco tell you what to do
@remote swallow
OrebfuscatorService orebfuscator = Bukkit.getServicesManager().load(OrebfuscatorService.class);
if (orebfuscator != null) {
Collection<Block> collection = new HashSet<>();
for (Location loc : blocks_to_break) {
for (BlockFace face : Main.getInstance().blockFaces) {
collection.add(loc.getBlock().getRelative(face));
}
}
orebfuscator.deobfuscate(collection);
}```
declaration: package: org.bukkit.entity, interface: Player
breakBlock would cause an infinite loop i do not know how to break
how
because breakBlock would cause the breakblock event to be called again and again
so it would cause the 9 broken blocks to then make the player mine the 9 blocks around per each. and then another 9 per each and so on
one method you could do is check where the playing is looking, only remove the blocks around and 1 diagonal of the block if they are looking at it
Hey there.
I'm trying to make a MiniMessage (Adventure Chat API) TagResolver.
I can see that I can do:
TextColor color = //Something
TagResolver.resolver("base_style", Tag.Styling(color));
I want to be able to apply all of the TextDecoration in a Style, but it doesn't work (Presumably because a Style contains hoverevents, clickevents, etc)...
Style style = //Something
TagResolver.resolver("base_style", Tag.Styling(style)); // Doesn't work
// Instead have to...
TagResolver.resolver("base_style", Tag.Styling(color, TextDecoration.ITALIC, TextDecoration.BOLD));
What is the cleanest / most efficient way to extract all of the TextDecoration from a Style like this?
you probably want to use components
How can I turn my plugin into dependency?
I'm already using it as a dependency, but don't want to always have to put that plugin into /plugins
the event gets called on blockbreak, even if i do check the blocks around, after it breaks, it will get again the blocks around that new block broken
Add it to the classpath or shade it in.
Do you need for it to be a JavaPlugin?
not really ig
just need those Spigot things
how do i expand a stream
like i input a String[] lines, call Arrays.stream(lines) -> Stream<String>, and then .map(s -> s.split("\n")) -> Stream<String[]>, how would i flatten/expand that stream into a Stream<String> that can be collected to a List<String>
so just use spigot as a dependency in your plugin, mark it as provided and let others shade your stuff in
flatMap
oh shit thanks
Send JSON message without building TextComponent
Is buildtools and 1.19.3 remapped broken right now? I can't get mine to build when I use the --remapped option
Anyone know why this import is not working? Trying to rebuild a old plugin I had made for me.
https://i.imgur.com/4UrjtAD.png
https://i.imgur.com/dnaPryJ.png
https://i.imgur.com/l9AJ0Jl.png
I think that's NMS. You'll need to depend on spigot to get access to those classes.
how do I add that?
Change your dependency. ArtifactID should be spigot instead of spigot-api.
Hi. How and what packet should I use for posing an armorstand? This is in Spigot 1.19.2 with the Mojang remappings
Looks like your going to have to run buildtools.
java -jar BuildTools.jar --rev 1.16.5 --compile craftbukkit
For posing an armorstand using a packet so it would only apply to a certain player, I;m guessing I have to use a ClientBoundSetEntityDataPacket, but it says it require a โFriendlyByteBufโ ? What should I do?
The ClientBoundSetEntityDataPacket is used to update the data of an entity on the client-side. To use this packet, you'll need to create a FriendlyByteBuf and then write the necessary data to it. This data will include the entity's unique ID, as well as the updated values for the entity's data. Once you've written the data to the FriendlyByteBuf, you can then use it to create a ClientBoundSetEntityDataPacket and send it to the client.
Here's an example of how you might use the ClientBoundSetEntityDataPacket to update an armor stand's pose:
// Create a FriendlyByteBuf to hold the entity data
FriendlyByteBuf data = new FriendlyByteBuf();
// Write the entity's unique ID to the buffer
data.writeLong(armorStand.getUuid().getMostSignificantBits());
data.writeLong(armorStand.getUuid().getLeastSignificantBits());
// Write the updated pose data to the buffer
data.writeByte(0); // This is the "index" of the data we're updating
data.writeByte(0); // This is the "type" of the data we're updating (0 for a Pose)
data.writeByte(0); // This is the "flags" for the data we're updating (0 for a Pose)
// Write the individual values for the pose
data.writeByte(armorStand.getBodyPose().getX());
data.writeByte(armorStand.getBodyPose().getY());
data.writeByte(armorStand.getBodyPose().getZ());
data.writeByte(armorStand.getLeftArmPose().getX());
data.writeByte(armorStand.getLeftArmPose().getY());
data.writeByte(armorStand.getLeftArmPose().getZ());
// Repeat this process for the right arm, left leg, and right leg poses
// Create a new ClientBoundSetEntityDataPacket using the data from the buffer
ClientBoundSetEntityDataPacket packet = new ClientBoundSetEntityDataPacket(data);
// Send the packet to the client
client.sendPacket(packet);
ChatGPT says this.
@rotund ravine Thanks!
lol, I can't verify how accurate that is, but if it's not spot on, it's damn close
ChatGPT ftw, tbf you also have to give it a good question for it to answer.
Don't look at my recent posts on the spigot forums
I was messing with it earlier today and it's been great
what a gentleman that friendly bytebuffer
It even answers in different languages
I have no idea what I said here, but he hasn't complained. https://www.spigotmc.org/threads/enderdrachen-spawn-deaktivieren.581523/

Wtf
Okay, I'm a moderator, I'm obliged to tell you that the forums should be in English
lmao
That code was chatgpt?
Yeah
It's like a million times better than autopilot
Yes
Yeah ;p All AI based on a question
Thatโs crazy
It's honestly impressive the code it generates and with how much accuracy
Also someone please check if it's correct, it looks pretty close (does that packet include that uuid or just entity Id though?)
Entity id
Yeah that's what I mean. If it's not spot on, it's close
Also entity metadata has more complicated serialisation
Probably accurate enough for me to figure it out
Not really it's a garbage way
Jan did you copy/paste the OP's question verbatim? 
The problem with AI is it's always 100% confident
Yes
Like people on the internet
That's awesome. I hope it's accurate and he replies with "Solved"
@sullen marlin How would you set the armorstand pose on the client then?
That's the trick. ChatGPT is just a guy
Lmao, like those really old school chess bots.
JavaPlugin::onEnable() is called before or after ServerLoadEvent event?
depends
nvm must be before
How can it be before? ;p
because you firstly need somehow register event
@gleaming grove Itโs before Iโm sure
@worldly ingot i read that as worldloadevent
Oh mb I read the question backwards lol. Yeah, plugins enable first otherwise why call an event
@gleaming grove An instance of the event class is created usually in OnEnable
does MD5 or someone else made events lifecycle documentation?
I told ChatGPT to write it again differently, it gave me this.
Here is an example function that sets an armorstand's position and pose using the ClientBoundSetEntityDataPacket and FriendlyByteBuf classes in Spigot:
public void setArmorstandPositionAndPose(Armorstand armorstand, Vector3f position, Quaternionf rotation, Vector3f headRotation) {
// Create a new packet
ClientBoundSetEntityDataPacket packet = new ClientBoundSetEntityDataPacket();
// Set the entity ID
packet.setEntityId(armorstand.getEntityId());
// Create a new FriendlyByteBuf to hold the entity data
FriendlyByteBuf data = new FriendlyByteBuf();
// Set the position and rotation of the armorstand using the data buffer
data.writeVector3f(position);
data.writeQuaternionf(rotation);
data.writeVector3f(headRotation);
// Set the entity data in the packet
packet.setData(data);
// Send the packet to the client
armorstand.getPlayer().sendPacket(packet);
}
This function takes an Armorstand object, a Vector3f representing the position, a Quaternionf representing the rotation, and a Vector3f representing the head rotation as parameters. It creates a ClientBoundSetEntityDataPacket, sets the entity ID to the ID of the armorstand, creates a FriendlyByteBuf to hold the entity data, writes the position, rotation, and head rotation to the data buffer, sets the entity data in the packet, and finally sends the packet to the client.
@rotund ravine So this code actually works?
I'm pretty sure there is no empty constructor on that packet though.
probably not.
Rip
I would need to supply it with more data, so If there was an error I could mention it to it and tell it to rewrite it to fix it.
In my plugin I have a Map<UUID, PlayerData>.
When a Player logs in I load the PlayerData by reading a database like:
public class AsyncPlayerPreLoginListener implements Listener {
@EventHandler
public void onPlayerPreLogin(AsyncPlayerPreLoginEvent event) {
// Contact db and get the information needed to make a PlayerData.
// ???
}
}
How can I give this data back to the main thread, before PlayerLoginEvent or PlayerJoinEvent is called?
I was going to do java Bukkit.getScheduler.runTask(plugin, () -> { plugin.giveDataMethod(uuid, and, the, data, that, i, loaded) } );
...but I'm not meant to do that right?
How am I meant to pass this information to my Map<UUID, PlayerData> on the main thread?
That's actually one way of doing it. The bukkit scheduler runs everything on the main thread unless stated otherwise with the #runAsync methods.
It'll handle the thread switching.
Thankyou both, but to just to reaffirm the first bit of my question - will this guarantee that it will run before PlayerLoginEvent are PlayerJoinEvent called?
Wouldn't this set the server's MOTD when it gets pinged, right?
@EventHandler (priority = EventPriority.HIGHEST)
public void onProxyPing(ProxyPingEvent e) {
ServerPing ping = e.getResponse();
ping.setDescriptionComponent(new TextComponent("Testing..."));
e.setResponse(ping);
}```
all it does is bug out the version
The AsyncPlayerPreLogin event is fired before the PlayerJoinEvent, so it should be a guaranteed thing.
ya it seems so https://puu.sh/JtCxF/a98f8e3831.png
what site is that?
Yeah but, if I'm scheduling that task - is there a chance that PlayerLoginEvent or PlayerJoinEvent will be fired before that task is executed?
I think that's what has me confused. If I'm telling Bukkit "hey schedule this to run", how can I know it's going to run before PlayerLoginEvent & PlayerJoinEvent?
The AsyncPlayerPreLoginEvent has to finish first before the PlayerLoginEvent can fire.
That event has a method that sets whether or not the player can join.
So only if the state is set to allowed, will the player be allowed to join.
But the event needs to finish first before any following events can work off of it.
Thanks so much, I appreciate the help. ๐
(If you don't mind me asking - where did you snip this from? It looks like a really solid resource lol)
That's ChatGPT
It's an AI, I just asked it question
idk if this belongs on here or #help-server but here goes nothing:
if bungeecord is in offline mode and another player with the same name connects to the proxy, does it kick all the players with that name?
Are you guys shitting me?
No?
What year is it holy
its twenty twenty, too
It's still far from perfect, but it's getting there.
@faint cypress Um the year is 2347?
I've never seen something like that before, my mind is actually blown wtf
Only one person can be connected with their name. So if someone else tries to log in, it will kick the player with that name.
Apologies for my aneurism lol but I can't believe that's real - how long has that existed, at least to that ability?
ChatGPT is the best
ok i alr thought i will need to make a custom session plugin
thank god
Still in shock, genuinely LOL.
Anyways thanks for sharing this moment with me lads and thanks for the help again ๐
can someone send me the direct link?
ty
Why does it happens when I run server there is 0 Entitis (should be 93) for certain chunk by after reload entitis appears
Is your plugin running postworld?
no, what is that?
If not it will load before the world so obviously no entities
so instead ServerLoadEvent I should use some "WordLoadedEvent"?
Simply make the code that checks for entities run in a bukkit runnable that runs after 1 tick. The runnables run after server has loaded.
i try that, but ServerLoadEvent suppose to work excatly like your approach
You sure?
not at all
Entities are loaded into chunks asynchronously, so in all likelihood they're not loaded by the time your plugin runs on startup
They are, however, loaded after a reload because reloads don't remove entities
Has that always been a thingv
Only as of recently are entities loaded async from chunks
It's like a 1.17 thing or something. Can't recall
but entitis should be loaded when chunk is loaded right?
Havenโt been here that recently i see
That's why we have events like this now :) https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/EntitiesLoadEvent.html
Also Piano plugin??
September of last year, so yeah, 1.17
So Iโm wondering, whatโs better? Mojang mappings for MNS or Spigot mappings?
Now go bonk mojang for making crawling not be a Pose
guys
i made a number guess game
but its with the old fashion way the 3 cups and with a ball
and i tried it out but
it goes 0-1-2-3
but i want to do 1-2-3
where is the ball?
cup 1, 2 o 3?
2
you lost, the cup with the ball was in the cup n.0
Process finished with exit code 0
Just + 1
ok ty
hi, does anyone know the fields in ENTITY_DESTROY packet type (ProtocolLib)?
If you open up the server code, itโll match whatever the packetโs fields are
PacketPlayOutEntityDestroy iirc
guys i need help
Picked up _JAVA_OPTIONS: -Xmx10250M
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Press any key to continue . . .
i keep getting this error
Where can i find the 1_16_R3 version of spigot, also for the maven repository.
Im currently using the 1.16.5-R0.1-SNAPSHOT from spigot-api. But i need the Class "PacketPlayOutCustomPayload" and other classes which the version i use not have
Run BuildTools
?bt
And instead of spigot-api use spigot
hi guys, before 1.14(i think) it was possible to make tripple chest with a bug, and i search a way to make a menu with the same size of a tripple chest. is it possible ?
sorry if my english is not good
No
so its not possible to have more than 6 row in a menu ?
why this world is so rude ๐ฆ
XD
k thanks
im stupid 6 is more than i need XD
Hello :3, how could i get the saved images on the resources?, if you look the pictures the plugin is saving the folder well, but i dont know how to make to load on the server. I've tried with :
plugin.saveResource(PATH,false); // PATH = images/markers/default and images/markers/custom
what are you trying to achieve
.png
and where are you putting those <include>-s
you just want to copy image from your resources to your plugin folder ?
that is not needed
i need to load the images from the resources to the server plugin folder
and what is your PATH
oh
just change path from
images/markers/default to images/markers/default/imageName.png
i have 76 .png D:
I don't even want to ask
xd
either open jar as zipentry and walk trough dirs or save names inside of some set and saveResources for every entry of set
ohhh how could i open the jar as zipentry ?
something along those lines ๐
ty <3
Is there a way to not play specific sounds to a Player?
or to cancel those sounds?
Wouldn't this set the server's MOTD when it gets pinged, right?
Am I doing something wrong?
@EventHandler (priority = EventPriority.HIGHEST)
public void onProxyPing(ProxyPingEvent e) {
ServerPing ping = e.getResponse();
ping.setDescriptionComponent(new TextComponent("Testing..."));
e.setResponse(ping);
}```
all it does is bug out the version
Is there a server side method to give players a certain amount of stingers/arrows in their body?
You probably don't want to do that with every ping event (unless ping is just triggered in server list)
sometimes (or maybe always) when i change a players gamemode while loading (for example the join event or world change), the player is in creative mode, but cant fly, any idea why?
idk, I'm just trying to figure out how it works
?ask
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!
Your path is incorrect. It should have been images.markers/custom
explain whats wrong in more detail
the event doesnt work
more detail
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
MORE MORE!!
ahhaa
its working with my path, but ty <3
idk what more bruh
is your plugin enabling
it is
newer starwars :cringe:
The issue could be with the instance check of which entity
have you added any debug statements
no
On phone so can't check. But getentity I am pretty sure is going to return the entity shooting the bow and not the arrow
it would be Player no?
iirc from my minigame code from like this summer it should be player
Should be whatever entity is shooting bow. But their condition is checking it for arrow and most likely failing there
debug statements in the future though at the top of the event to ensure it works than within each nest so you can figure out where it goes wrong
Okay
if (event.getEntity() instanceof Arrow) this is most likely where it is failing which is the start of your code block
Nesting code :(
So it isn't that the event isn't working just your condition check is incorrect
my soul aches
I never press the tab button
ah
proof just incase you needed (ignoore all the tabs)
I use tab but my ide is setup to change tab to spaces
:despair:
My tab is like 4 spaces
idk if thats like standard
It is
okay I'm normal ๐ฎโ๐จ
That event you are using. The method you want to get the arrow is getProjectile()
wait remembered I use vscode ๐จ
ty
yo
how do i make a plugin start/load after the world has finished loading?
i have set load to POSTWORLD in plugin.yml
but it still loads before the world
thanks in advance
Post world is the default. I assume you have code that needs executing when the world is finished loading?
What java guava for?
Like collection
It's just a collection of utility classes. If you need a util, Guava probably has it
Not only that but it has collections that are better then the standard ones too
Really
One of my favorites from guava is the cache collections
All I'm thinking about is data management
And data science stuff
Later rn just curious
Guava is shaded into the server jar just fyi
Also you have apache commons too shaded in if guava methods are too heavy for your liking
Lol
Always handy. Maybe learned a bit of thing or two from my recent talks of sql
yes
currently trying to retrieve world border from world โworldโ but i get null due to the plugin loading before the world
You can listen for worldloadevent
yea, i did but it still seems to scan through the code and send an error
Don't have your code execute anything until that event is fired and then maybe wait a tick or two after
also it ends up working when i use /reload but i cant do that every time i start up the server because it resets the plugin statistics
all i have it do is listen for the event
Then create a delayed task to wait a few ticks after
Just check to see which world it is loading. If it isn't overworld do nothing
hmm ok
how would i set the damage of a projectile?
Cast projectile to arrow
Arrow has setDamage() method
Just make sure to check that the projectile is an instanceof arrow fiirst
?paste show entire pom
What you have above isn't all of it
Remove java.version tag
I can give the log file too if you want that
Not needed
You probably need to relocate jda
Your java tag version is setting to use java 8 when you are wanting java 10
So remove that tag
How do I do that?
removed
Now try it
Try that if it still doesnt work googlr maven shade example
same issue
The version of the dependency did you ensure is compiled for java 10? And not compiled for a newer version
Need to ensure you use correct versions for the java version you are compiling for. Also not sure why you need to compile for java 10 would recommend 11
jda 5 beta only came out like 3 weeks ago so i would guess its compiled for a lot later version
does it have to be on the same version Minecraft is?
java 17 is the current version minecraft uses
Depends on version of server you are talking about. But the server version isn't the only thing that matters but also the java version being used to run the server too
I will be continually keeping it on the newest version
But I think your issue is using a dependency that is compiled for a higher java version then what you are trying to compile for. Which won't work
so how do I put this on Java 17
change the version in pom and
file > project structure > project at the top > change jdk to 17
didn't you tell me to remove the verssion?
it was alreayd on this:
No. I told you to remove java.version tag. You have another spot that is setting the version which is part of the compiler plugin in pom
Says source and target
When you had java.version tag it was conflicting with the compiler settings
line 16 if its <java.version>1.8</java.version> can be removed and line 27 & 28 should have value of 17
I did that
thanks, I'll try it again
should be good to go then
Make sure to do a clean build
NoClassDefFoundError
Show the full error please
Open your plugin jar and see if the dependency was in fact shaded in
was the pom even shading it
Think the empty config section might be making it not do so
I don't see it in it
Also they need to ensure if using intellij that they are having maven compile and not the ide
<relocations>
<relocation>
<pattern>net.dv8tion.jda</pattern>
<shadedPattern>aspireinc.torture.libs.jda</shadedPattern>
</relocation>
</relocations>
I am compiling maven, and also yes IntelliJ
put that between the configuration tags in maven shade
Lately some people have been mistakenly not have maven actually compile
I think you have to use the big green play button for intellij when usinaven instead of right clicking build
But also note I don't use intellij either lol
depends
if you tell ij to make the green button run maven clean package or gradlew build it builds it
otherwise it just does nothing
in between the configuration?
line 41 it looks like
how are you building
Then most likely maven isn't being used
or there using the maven tab on the side
You would know more on that then mr
Just know that maven isn't being invoked otherwise it should have shaded
build -> build artifacts ?
No
press crtl twice, then type mvn clean package
then for following builds you can press the green play button near top right
heyyyy, JDA is in it now, same result tho
like same error, but when I viewed what was in the JAR JDA5 is in it
same error or different
same NoClassDefFoundError at the same line
Hello just wanted to know, does 1.8.9 plugins work in 1.8 servers?
whats line 11 of SussyBot.java
runs the createDefault method of the DefaultShardManagerBuilder class
idk what could cause that, so the best i can probably advise is going to JDA's discord and see if they know whats up
sure, thank you for your help
How to teleport Armorstand when player is set as passager?
here is method I use to create Armorstand ```` public static ArmorStand create(Location location, String id)
{
ArmorStand armorStand;
armorStand = location.getWorld().spawn(location, ArmorStand.class);
armorStand.setVisible(false);
armorStand.setCollidable(false);
armorStand.setGravity(false);
armorStand.setAI(true);
armorStand.setMarker(true);
armorStand.setNoDamageTicks(0);
armorStand.setInvulnerable(true);
armorStand.setInvisible(true);
armorStand.setRemoveWhenFarAway(true);
armorStand.addEquipmentLock(EquipmentSlot.HEAD, ArmorStand.LockType.REMOVING_OR_CHANGING);
armorStand.setRotation(0, 0);
var metadata= armorStand.getPersistentDataContainer();
metadata.set(PluginConsts.PIANO_NAMESPACE, PersistentDataType.STRING,id);
return armorStand;
}```
Have you tried teleporting it?
that was first thing I;ve done
how can I move this to the left?
how do i associate an item in an itemstack with my plugin? like can I add pluginname.itemname in the items metadata somehow?
To resolve that I've needed to remove all passagers from Armorstand then teleport it and then after 2 ticks set passagers again ๐
Was going to suggest this
sup, by the time the PlayerJoinEvent is fired, is there a player.dat file created for the player that just joined in /world/playerdata ?
like if player bob joined the server for the first time, at the PlayerJoinEvent is there a file <bob's uuid>.dat in /world/playerdata ?
Why donโt u check?
Hello, im trying to learn oop, xd, i rewrite my plugin, and now i have Bot object, when i create this object, bot appears and start working for some player, how can i create bot for every another player?
Maybe it not how i suppose to use oop
@hushed pawn show how you have tried
Bot bot1 = new Bot(player);
bot1.doSomething();
This is how it works now
But everything is just for one player
What is the right way to do it for different players at the same time?
I have to type this string 100 times for 100 players?
With different object names
getItem().getItemMeta().getLore() == Arrays.asList("BundleItems") are these not equal? the lore is ["BundleItems"]
No. Just create a new object when player joins. Store the object as a value in something like a hashmap. Then anytime you need it use uuid of player as key and you should get the bot object of that player. But it sounds like you need to learn more of the basics
No
Google what == does in java
Thanks, i guess that exactly what i need
In my first version of plugin i created all variables as hashmaps , and stored own values for each player. So i started to think that i doing something wrong
@rotund ravine thanks man, would have been stuck on that forever. used .equals() instead ๐
I can't find a statistic for distance flown with Elytra on the Spigot API. Unless I'm overlooking something here.
Nevermind, found it. It's AVIATE_ONE_CM.
Is VisibilityManager removed from HolographicDisplays?
Sounds like a question to ask the author
Is there a way to create an online player without using NMS?
protocollib
what's NMS?
net.minecraft.server
oh, k k
hola. i have a function inside a class, this function simply gets all the players and does stuff with em in a while (true). I want to run this function as a thread 24/7 without messing up the main spigot server thread(s)
I mean not in that sense of having the player as NPC, maybe if I explain the problem it would be better, isn't it?
use scheduler instead
?scheduling
thanku
I am trying to make a ban plugin and want to take duration input in that mo,w,d etc format
for ex /ban {player] 2d12h7s (2 days, 12 hours and 7 seconds)
how I can make this happen?
Give a look to String's methods
I figured it out literally right after writing that message lmao
Could use regex all the way
I want .runTaskTimerAsynchronously(); to run forever in 30 second intervals. i dont understand wtf }.runTaskTimer(plugin, 20L * 10L /*<-- the initial delay */, 20L * 5L /*<-- the interval */); is
Initial delay is delay before first start and other one means that It will run every "interval" ticks
no like what is the 20L * 5L
is that a 25 second interval im confused
OHHH
1 second have 20 ticks
It means it will run every 5 seconds
it wait 1 second and run every 5 ticks?
More or less
ohhhhh
so 20L * 30L it run every 30 seconds?
More or less, make sure that every second don't have exactly 20 ticks
Due to lag or whatever
np
tysm
new AuthenticationDaemon().runTaskTimerAsynchronously(this, 20L * 30L); gives me error 'runTaskTimerAsynchronously(org.bukkit.plugin.@org.jetbrains.annotations.NotNull Plugin, long, long)' in 'org.bukkit.scheduler.BukkitRunnable' cannot be applied to '(gg.brotherhood.brotherhood.Brotherhood, long)'
P.S the AuthenticationDaemon() is a class that extends BukkitRunnable
it has a public run method like the docs tlel me to
use
Bukkit.getScheduler().runTaskTimerAsync(plugin, () -> { code }, 20l * 30l);
lemme try
Use JavaPlugin.getProvidingPlugin(getClass()) instead of this
tasktimer takes 3 args
javaplugin, long, long
first long is how many ticks delay before the first run
second long is how often in ticks you want it to run
how does the bungeecord module manager work
how is this possible?
what version of protocollib
what version is the server
Latest version of ProtocolLib and server is 1.17.1
are you using protocollib API
wdym
are you making a plugin that uses protocollib's API
is your plugin using spigot 1.17.1
yes


