#help-development
1 messages · Page 552 of 1
just pay attention when you do or dont write pointless documentation
why would the key not be set
Think for the person who needs to use your code but doesn't understand your design pattern
you havent added the key yet
thats why we use design patterns that a lot of people know
wdym it saves at the end
A lot doesn't mean most
like I said, if its for complex thing, you would want some docs as to how to use the code
im not arguing against that
anyways im spamming the chat again with useless conversation xD
No, it's okay. I shared my opinion since I had struggled multiple times because documentation was scarce.
yes that is true
is there a new event for brushing sus sand?
you can probably use an existing event
like playerInteractEvent
which is like used for everything at this point
why do you want an event?
I want to get its drop for my AutoPickup plugin
declaration: package: org.bukkit.event.block, class: BlockDropItemEvent
is triggered
and then check if the block data is brushable
Does anybody know how to use varints in protocollib? I'm trying to make smooth recoil using packets, and so far I have this:
Location lookatloc = p.getEyeLocation().clone();
lookatloc.setPitch(p.getEyeLocation().getPitch()-recoil);
lookatloc.add(lookatloc.getDirection());
ProtocolManager pm = ProtocolLibrary.getProtocolManager();
PacketContainer packet = pm.createPacket(PacketType.Play.Client.POSITION_LOOK);
packet.getIntegers().write(0, 1);
packet.getDoubles()
.write(0, lookatloc.getX())
.write(1, lookatloc.getY())
.write(2, lookatloc.getZ());
packet.getBooleans().write(0, false);
try {pm.sendServerPacket(p, packet);} catch (InvocationTargetException e) {throw new RuntimeException(e);}```
In theory it should be under that event.
Then I get this error, indicating that that setting integers isn't the way to do it.
com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0
at com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:316) ~[ProtocolLib.jar:?]
at com.lynxdeer.lynxsguns.weapons.guns.AK47$1.run(AK47.java:114) ~[rwb.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.4.jar:git-Paper-524]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.4.jar:git-Paper-524]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1483) ~[paper-1.19.4.jar:git-Paper-524]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.19.4.jar:git-Paper-524]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.4.jar:git-Paper-524]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1174) ~[paper-1.19.4.jar:git-Paper-524]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-524]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
ProtocolLib?
The Look at Packet
I didn't see the code you sent
.
Is there a reason you're using packets for that?
I don't think theres another way to do it smoothly without teleporting the player
Teleporting the player is a problem because that screws with movement which doesn't feel good
It looks like this on wiki.vg, I just need to know how to set the VarInt field
You could probably debug/print getStructures and see what's in the packet
There's a setRotation method
Otherwise paper has this https://jd.papermc.io/paper/1.19/org/bukkit/entity/Entity.html#teleport(org.bukkit.Location,io.papermc.paper.entity.TeleportFlag...)
declaration: package: org.bukkit.entity, interface: Entity
Thank you!
I'd recommend to look at the second solution because you are able to use relative positions and not the absolute ones, which would improve the feeling make of the recoil
Also note that Mojang has started to ban servers recently that have guns
Not a good idea to recommend Paper in the Spigot discord
I'll look into that, I'm already using paper.
I think they just wanted a reason to ban that gta server
If that was the case, then hypixel would also be removing cops and crims
using setRotation works fine, but I will be looking into the second method to make it a bit smoother
ty
Np
why does the recoil follow the crosshair
What do you mean? Do you mean the spread?
The recoil follows the crosshair
Should it not?
No
Look at the NMS impl
That's how protocollib works
I ended up using Entity#setRotation instead of packets
Yeah but the crosshair doesnt follow it
yeah it returns to the original position
Exactly
also aiming recoil is separate from hip fire recoil but we all know that
and recoil is usually just a function(bulletsFired) -> Point which is the rotation offset
So a weapon with no recoil will return an offset of 0, 0
A weapon that's just straight up will return an offset of 0, 1
A weapon that's zigzag will be like
-1, 1
1, 1
-1, 1
1, 1
Game devs hardcode these sometimes
But yeah you add those to your camera and after a certain amount you remove them
so it's a pattern
and that amount is usually just like a second after the last bullet fires
Yeah it's a pattern
modern recoil is always a pattern
noted for when i update my cops and crims plugin
Spray patterns explained: https://youtu.be/XNkijakpf9Y
Games played: Valorant, CS:GO, Rising Storm 2: Vietnam, Apex Legends, Insurgency Sandstorm, Call Of Duty Warzone, Overwatch 2, R6 Siege
2nd Channel: https://www.youtube.com/c/GarbajGaming
Twitch: https://www.twitch.tv/garbajcan
Twitter: https://twitter.com/Garbaj2
Insurgency Sandstorm: ht...
it makes sense
i had a system with roundsperyse and rounds per pitch
but it's limited to what i can do with it
which version of bukkit.getPlayers actually searches through the database and stuff? I just want the version that tries to get a player from within the current server
spigot api has a Tag for concrete blocks ?
Bukkit.getOfflinePlayers?
What
assuming you want all the players including the offline ones
from my memory there was a method that did that
get offline player that takes a name
and I dont want to pick that one xD
What database are you talking about
.
anyways Bukkit.getplayer just looks through online players in the server right?
getOfflinePlayer might make web request yeah
Yes
okay perfect
spigot api have Tags for concrete blocks ?
not that I know
I just created an enum for colored blocks
since I was mad at some point
and just pooped out an enum for colored things in the game
so if there is a better way, do also let me know xD
pretty sure there is some complicated way to get the same color a map would use for a particular block
no idea how tho
Why does resources are not included to the jar output? There is no plugin.yml
Is the armor trim "Silence" in spigot yet for 1.20?
Show your project folders also how are you building your plugin
oh nvm I had to full screen those images to see :/
With maven
package command?
lol after restarting Inteliji it works again
hi guys i have a problem i do custom block drops
but when player break blocks on worldguard region
block not breaking but drop items
what version of spigot?
1.16.5
Just use the BlockDropItemEvent if current.
I thought you were on 1.12
yeah use the block drop items instead of break
alright
do u know any tag for minecraft Concrete blocks ?
no
How do I make a plugin that when the player clicks Q
Then it drops their item that they are holding
the vanilla minecraft mechanic?
there is no method to detect pressing Q
you can catch teh drop event but no way of knowing ifd it was due to pressing Q
What
You cant drop items in minecraft
Yeah sounds good
wha t
How would I make that elgarl
hey theree
Does anyone know the link to the documentation for doing this tag style in the tab using texture?
EventPriority.java:
/**
* Event is listened to purely for monitoring the outcome of an event.
* No modifications to the event should be made under this priority
*/
MONITOR(5);
i want to know, what does it mean no modifications to the event should be done under this priority? what about cancelling the event? does it affect that?
no changes
i am confused about "changes" & cancelling the event, since cancelling the event also changes the event, cancelling the event will be useless in this priority then? (affecting server stuff, like picking an item, and cancel it in MONITOR priority, then what happens to the item? is it going to picked up or not?)
Keyed enums
Strange, when I logged into the server, the tab looked like this, without any Chinese symbol
this was before the texture could load
As far I understood, some enums will stay
they’re on experimental branch
moved to registry backed instances
not in live 1.20
Not sure what is confusing you, Do NOT make ANY changes in MONITOR.
sir, im just asking one question, should i cancel event in MONITOR or not?
bruh
do you know what monitor means ?
No, do NOT make ANY changes. None at all. Not one single change.
I have decomposed their texture and it is organized like this, with all the roles in one image
no
ok 👍
You can still work with the classes. What seems to change are features that are specific to enum classes.
monitor should just be used for gathering intel like logger statements or smt
nothing more
read the docs next time
They will implement methods that are currently used but the features that cannot be added are the ones you don’t want to use in your code
Like, Material#values if you ask me should still work since adding such method is not impossible 🤷🏻
Whats the method to delete a hologram in HolographicDisplays
I'm on the javadoc and I can't find anything
nvm
Got it
is there a method to get a hologram?
i have this method but how do i make a delete along with it
public void createHologram(@NotNull ConfigurationSection crateName, @NotNull Location location) {
HolographicDisplaysAPI api = HolographicDisplaysAPI.get(main);
Hologram hd = api.createHologram(location);
List<String> hologramLines = getCrateHologram(crateName); // Assuming getCrateHologram is your method returning a list of strings
for (String line : hologramLines) {
TextHologramLine textLine = hd.getLines().appendText(line);
}
}
material is deprecated but yes
it shouldn’t be an api break
yet
guys, how to change the scale of the ItemDisplay? I know it has Transformation, but Transformation doesn't have a scale setting method
yes i know
this is custom fonts with resourcepacks
Can I get the broken block in event as an itemstack?
save the hologram into a hashmap with the key being the crateName.
yeah i got it
[21:01:57] [Server thread/ERROR]: Could not load 'plugins\oink.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.2
at org.bukkit.craftbukkit.v1_20_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:319) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:141) ~[spigot-api-1.20-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-api-1.20-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-api-1.20-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.loadPlugins(CraftServer.java:430) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:973) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20-R0.1-SNAPSHOT.jar:3777-Spigot-723951c-f3b2b22]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.2
api-version: '1.20'
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
plugin.yml
name: oink
version: '${project.version}'
main: xyz.oinkyscosmetics.Oink
api-version: 1.20
authors: [Oinky]
description: Oink!!!```
put '' around the 1.20
alr
you do due to the way SnakeYAML reads entries
it reads it as a float so it ends up 1.2
I've seen it often when using numbers as keys
this would also happen on older but we've never had a trailing zero before
oh
I need some help trying to debug this, I'm at like a complete total lost on what to do. I've already tested the ItemStack, the item does come out with everything that it's suppose to be, but the actual recipe doesnt work, it returns just an original netherite helmet, im not sure what it is.
public static void CrackedNetheriteHelmetRecipe() {
SmithingRecipe recipe = new SmithingRecipe(new NamespacedKey(plugin, "cracked_netherite_helmet"), CrackedNetheriteHelmet(), new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET), new RecipeChoice.ExactChoice(CrackedResources.CrackedNetherite()));
Bukkit.addRecipe(recipe);
}
Yeah it should happen on older versions too
SnakeYAML 2.0 for ya
Because it looks like a float
its just the way yaml tries to guess the type of the entry
Sanity check time. Getting inventory holder for a shulker box loads the tile entity and in turn all the items in the inventory... if thats the case, is this the same for all types of inventory?
Or is it just for shulkers.
Follow on question: Is it just the get holder method that causes the whole inventory to load verbatim?
1.10?
That option got added in 1.13
Oh
can i do this code shorter ?```java
@EventHandler
public void drop(BlockDropItemEvent e) {
if (e.getBlock().getType() == Material.WHITE_CONCRETE) {
ItemStack item = new ItemStack(Material.WHITE_CONCRETE);
ItemMeta meta = item.getItemMeta();
if (e.getBlock().getLocation().getWorld() !=null && meta != null) {
meta.setDisplayName(ChatColor.WHITE + "Granite Bricks");
item.setItemMeta(meta);
e.getBlock().getLocation().getWorld().dropItemNaturally(e.getBlock().getLocation(), item);
e.setCancelled(true);
}
}```
when you think your code is working fine but your ide doesnt show the errors
why not just use the item thats already dropping?
wdym ?
no need to create a new ItemStack
Does anybody know how to change the Item within Suspisous Sand? I've tried using BlockState casted to BrushableBlock and i did not work
but can i drop item with custom name with geti tem ?
yes
i will try
you can modify the item and don't need to drop it yourself
Which would also allow your plugin to handle multi block drops caused by other plugins
I want the if statments return true when the current health drops by 10%
wich I did in healthPercentage
currenthealth / maxhealth <= 0.9
@hard socket
you can remove the = sign
if you want it to be exclusive
i wanna set drop type with setmethod
i thin this
concrete have only drop if i set 0th drop i can change
but how i give to name
what?
can i set drop with getitems ?
so u said getitems is collection
and i can set 0st index of item
modify the itemstack in each dropped item
alrigt
Does anybody know how to change the Item within Suspisous Sand? I've tried using BlockState casted to BrushableBlock and i did not work
so no need for healthPerc?
you are not adding to the List
bump.
you can remove or modify, but not add
@hard socket exactly
@lilac dagger you made if only for the first 20
uhm?
I wanted it to be everytime he loses 20
20 percent?
yes
yeah I tried that but my brain isnt mathing
well get the previous health and divide currenthealth/previoushealth
so everytime the difference is greater than 10% it'll trigger what you wanna trigger
currenthealth/previoushealth < 0.9
is the same just replace max with previous
yup it works tysm ❤️
👍
java.lang.IllegalArgumentException: Plugin already initialized!
what
did i do wrong
Bukkit.getPluginManager().registerEvents(new JoinListener(), this);
Bukkit.getPluginManager().registerEvents(new onChairListener(), this);
}```
do not use new Main()
only one class extends JavaPlugin
so what do i do
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
oh so i dont need to register it in my main class, i need to do it in the class?
you have more then one class extending JavaPlugin
because you don;t yet understand dependency injection
i use javaplugin in my kick command
does it have to affect with my other
yk
class
only your plugins main class can extend JavaPlugin
oh
@quaint mantle swap the event with this too
assuming 'this' is your main plugin and event is implementing Listener
yeah
how do i make an armor stand completely invisible
like you can still place blocks even when they are there
addPassenger(player)
setVisible(false)
around
this
armorStand.setVisible(false);
armorStand.setGravity(false);
armorStand.setSmall(true);
armorStand.setMarker(true);```
you just miss addPassenger
im aware..
probably worst hashmap insertion impl ive ever written
How would I copy resources in my project to a folder in my plugin datafolder
I have a .schem file in a schematics folder in my resources folder and I want it in my plugin datafolder
resources included in your jar?
hmhm
plugin.saveResouce
what's this for? and why aren't you using the default?
its not java
thanks
looks like kotlin
c++ does have maps
oh so its C
odin
error: cannot find symbol
player.addPassenger(armorStand);
^
symbol: method addPassenger(org.bukkit.entity.ArmorStand)
location: variable player of type org.bukkit.entity.Player
why does this happen wtf
looks very much like c but better
oh yes I kinow this one
well "better", less overhead of allocating memory myself
or encapsulation
shut
C has arrows
lemme not write an example bruh, i dont want to write memory allocation code :(
just for dereferencing
can anyone help
ye
i could never code containers for c or c++, looks like a headache and probably it'll have memory leaks
what type is your player? CommandSender?
no
i can succesfully code in java containers but in c++? no way
its a listener
no
wait didnt even read that last line
i went up in the skill tree, no more assembly
hmm, i think it's getPassengers().add
not sure
can anyone tell me the vector to sit on the lower stair part
What version of Minecraft?
its okay i fixed it
took me 2 hours to write this single method 💀 always fun when there are no docs
I need to check if while A player is walking they enter a specific area? Is there a more efficent way of doing this than just looping over each area every time PlayerMoveEvent is triggered? I feel like doing possible 20 or so checks every player move event for hundreds of people would not be ideal
how are you storing your areas?
does spigot automatically override plugin commands over minecraft commands
essentials is able to override /give but it probably injects its command directly into the command map
no clue actually
its definitly possible, PlayerCommandPreProcessEvent or smth is smth too
should have to try out
the last plugin to register a command gets it
anyone else does
private final VoidCrates main;
public Manager(VoidCrates main) {
this.main = main;
}
for dependency injection??
i terribly forgot then, the same for vanilla commands?
becuase i used to do it all the time and would be able to access main from outside the constructor but now all i get is because "this.main" is null
unknown
BoundingBoxes
in an unsorted list?
essentially I have a Map<String, ZoneData>
String would be name of the zone, ZoneData contains all the zone data bounding boxes etc
id say mapping areas to chunks would be a lil better atleast
but im too tired too come up with anything better
yep, plugin overrides minecraft plugins
thank you guys
anyone know how to cancel the "%username% has joined the game" ?
like that yellow text
what would make checking chunks vs location more performant I mean wouldn't it be the same calculation at the end of the day?
ah wait zonedata contains another map?
no
I'll show you
private String name;
private String schematicName;
private XZBoundingBox area;
private Location flagLocation;
private XZBoundingBox flagArea;
private ZoneData(String name, String schematicName, XZBoundingBox area, Location flagLocation,
XZBoundingBox flagArea) {
this.name = name;
this.schematicName = schematicName;
this.area = area;
this.flagLocation = flagLocation;
this.flagArea = flagArea;
}
XZBoundingBox is just a bounding box
are you just looping over your map.values()
I mean I'll have to the current way I'm thinking about this
:(
but I really don't want to
How can I run a code block every day at 8 o'clock with a timer?
that is the weirdest question ive ever heard
why
its so specific
well actually now that I think about it I have a Map<String, List<ZoneData>>
String -> WorldName
List<ZoneData> -> Zone's in the world
still doesn't solve my looping issue though
best i can came up with is a Map<String, Map<Chunk, List<ZoneThing>>> where it stores all the chunks of that area :/
it gives some idea
how do i check if a player clicked right click on a stair
have you even googled?
PlayerInteractEvent
sorry
Theoretically, could you run any Java program within a plugin? Like how you can use jda within a plugin, can you also use any .jar programs?
theres savePlayers()
yeah thats different
lol
you can trigger java -jar x.jar within your plugin
actually just use a dependency lol
When I do git config --global user.name it says my name is "BuildTools". And my user.email was set to "unconfigured@null.spigotmc.org". Why is that? Does running BuildTools change my globally set github credentials??
can you explain how that helps much at all??? Because wouldn't you just be comparing Chunk Locations versus cordinate locations which I don't think is much of a difference I mean under the hood it ends up being the same
oh ye running buildtools fucks up stuff
any way to make it not do that? cuz that sucks
well now yoore looping through all your areas to find the one the player is in right?
or there may even be multiple ig
yeah
so instead you just do a map lookup based on the chunk, so thats O(1)
would still require to put all the covering chunks from that area in that map tho
it'd also require all borders to be on chunk borders too
but it makes it much more performant
Just setting your own should work fine
and it wont be reset, the next time i run buildtools?
Yeah
ok good, ty
i was already thinking about some bitwise encoding of the covering area but i just want to sleep lol
hologram.setCollidable(false), whats the way to do this in 1.8
grim's reach detection is actually so smart
i just realized that
its a prediction reach check
and actually accurate
one sec
nvm
uh
i dont
think there is
honestly I'm going to start from scratch and draw up my data structure and shit tommorrow with a thorough plan
shoulda done this from the beginning tbh
do you know any good programs for visualizing this shit
is there a copypasta somewhere for a Material PDC?
wait i wonder if gpt could do it
no it cant
Okay
So
PSA / sanity check.
Did ya'll know that getting an inventoryHolder in an OnClick event is dog tier bad idea?
Because I was today years old when i found out
hm how so?
Tl;dr: Due to how Bukkit logic works, if you call the inventory holder and its a chest, shulker , basically any storage based tile entity... yeah its going to reconstruct the inventory from scratch every click
oh
I just removed some checks in a plugin that use get holder...
i went from 2% thread usage... to 0.1%
idk because getHolder() only returns a stored variable so uh
All that did this was a check that involved event.getInventory.getHolder().
replaced with event.getInventory.getType()
How do other 1.8 servers have it
it goes down to 0.1%
NMS if you wanna work with legacy versions you deal with legacy problems
What part of NMS do I look into
Damn Thas crazy
so you'll have to look around until you find it
Almost everyone
~90% of servers
prevent this event will do lag ?
no
i will change dead coralts to new ores, and there will be more than that
can u explain me why no lag ?
As long as you don't write bad code it won't lag
question, how can I add a library I created into my plugin?
preferably use maven and add it as a dependency
I'm not sure I understand, sorry im new to this
u mean library or api ?
I did that, but it doesn't recognize it
its your own library?
I just made a "plugin" that has some code I frequently use so I can use that instead of always copy/pasting the same code
ah ok
and I was wondering if there was a way of using that plugin's methods in another project
if you built this other plugin just run mvn install
it will then be available to maven
and you can access it using Bukkit.getPlugin("pluginName");
add it to your plugin.yml in a depend: [pluginName]
I run this anywhere, on a terminal?
what ide do you use?
instellij
there is a maven command tab in IJ
no clue where though
be sure you have the correct project selected before you run mvn install
scope shoudl be provided, but you likely need to refresh/update maven
you can't have correctly ran mvn install then
hm
make sure you had this other project selected when you ran the mvn install
bro can u explain me ,because there will be no recycling
prevent blocks physics will do lag ? no or yes ? and why ?
example i wanna disable sand fall physics
So did a bit more investigating.
Yeah InventoryGetClickEvent.getHolder is 100% the reason most servers with custom items with gradient lines are laggy
If even one plugin has it on ur server as an event check
ur cooked
preventing ALl falling sand will not be simple
oh sec, there is a new event for it
I think
i don't need actually
i will prevent sand fall with placeblock and settype with no physics
and prevent too blockphysics
Actually guys im gonna say it one more time because this is actually huge
Dont put getHolders in click events...
Might be common sense to some, but i found it today in a pretty decently popular plugin
And its the sole reason its a TPS drain
doubt that
I just reduced the thread usage of a plugin to 1/20th of its usage
getHolder takes a SNAPSHOT of the holder
So you be dumb and put that check in your onclickevent...
And have a load of gradient lore lined items in ur inventory
is their a region flag in world guardf to block crafting and spawning in snow golems and iron
why not ask this in the world guard discord lol
either way i dont see any on their documentation
from where do you take that?
The profiler itself my guy
what profiler do you use
On further investigation i found out its exactly what happens
and its hwy
paper added a boolean clause
to prevent it
have you tried on the latest version by chance?
just seems odd something like that would go for 12+ years unnoticed by anyone feels like something else
Im the guy who also caught the fact the crop modifier for spigot didnt work for 9 years
It took us 2000 years to try spinning the cylinder of an archemidies screw rather than the screw
Humans
are
by nature
morons
Its not suprising. Some bugs hide for many years before discovery
Do i get shit wrong half the time? Absoloutly
earlier today when i was a full goof
But thing is , as papi said, gotta stop holding in farts just cause ur scared of shitting urself
whats the code that causes this
Well, if paper added a check for it couldn't you just PR it really fast then? sounds like its something rather simple
Or ctrl + click and show us the method compared to papers? ^
oh wait forgot you have to be viewing spigot code to see sources since its all impls
nah dont tell me you are using 1.14
1.19.1 from that profiler
Nope all that is, is a legacy check
The maker of this plugin did some questional stuff with his legacy implementations lol
you could use reflection to get the holder tbf
or just dont get it three times
oh shit yeah
My brother in christ its not the 3 times thats the issue either way
lmao
There is another event that uses 1 single method and its still 1% thread on the profiler
then your server is garbaage
foir just me on my own
well if the call is constructing something, 3 -> 1 is a gigantic help thats 300% increase
Bc people are smarter here
Oh agreed
100%
lmao
be aware that the "profiler" sprinkle percentages here and there
Dude... its making a snapshot of the inventory full of items with custom metadata on each click
I think its time to accept this one is correct
maybe ask choco about this when hes back, or make a bug report on spigot jira thing too
see what they gotta say about it
never said it wasnt. all i'm saying is that the shit you are trying to fix there is garbage, your server is for sure not the best and the percentages of the profiler are not reliable but a rough direction
I cant say the name but this was a test on my server to fix a problem on a 200+ player comercial server that uses this plugin
Quite a decently popular plugin too
i really dont care
lets just leave it at "this is a cool find and shows that any click event that uses onholder is likely a contributor to this issue"
Aight i'll be real as ive tried to be cordial about it. Wtf is actually your problem?
You have gone out of your way to be an ass ngl chief
get used to it, you're welcome
I pointed out an interesting find, folk were talking about it, you come in, say it aint right, say it doesnt work like that, says the profiler might be inaccurate, says my server is garbage and then, to top it all off, when everything is disproved or elaborated on, you just are like "I don't care".
Its a bad look my guy ngl
interesting. you've changed every of my statements
ah nvm the server is garbage part is true
yo whats goin on
2% is huge tps drain
got it
like cmon if ur gonna say huge at least have it be double digits
or at least like 5 or smthn idk
Its enough
less then 2?
0.3 tps for an inventory click is a lot
spam clicking...
but the case on this is unclear. did he spam the click? is it a single click? whats in the inventory? and so on. but right now he's bullshitting at me for collecting facts
multiple players
he's not making friends right now
*This wasnt even spam clicking, it was moving all the custom items from a shulker to a chest
wait
all im saying is less then 2% isnt exactly going to be the only factor
are you by chance
Hi, i am one single person
looping every item and getting holder on every iteration
oh is that one person?
Nope. Its just the holder itself and the snapshot it makes
if its 1 person on its still for sure
Les go find out
it would be interesting to know what the exact method is that causes this
I legit showed you
nah, you sent the onInventoryClick. onInventoryClickBSealer is causing it
whatever that method name is
Oh yeah mb i sent the wrong one, there are 3 events with get holder one sec
oh hum
Yeah...
Its the on holder chaps
I hold heartedly encourage you all to give it a test try with a load of gradient items in ur inventories
*gradient lore
What shows u that info?
Spark
o thats what spark is
lol
i just assumed it was something to make sure the server runs better
meh spigot needs to give us pdc for inventories anyways
pr it
i think that would require inventories needing MetaData
and no thank you on that part
?jira
why am i getting this error in my console? 08.06 18:57:17 [Server] [INFO] [ChunkerDunkers] disconnected with: DecoderException : java.lang.IndexOutOfBoundsException: readerIndex(1) + length(1) exceeds writerIndex(1): PooledSlicedByteBuf(ridx: 1, widx: 1, cap: 1/1, unwrapped: PooledUnsafeDirectByteBuf(ridx: 61, widx: 1530, cap: 16384)) @ io.netty.handler.codec.MessageToMessageDecoder:98
For a project I have to use packets, but I can't import them, I saw on forums that it was necessary in the pom.xml to put in dependency spigot and not spigot-api but I have an error when I do it do (I'm in 1.8.8)
Entities have it, block states have it, what more do you need?
How can any other type of inventory be persistent?
Did u see what i put earlier lol
With the inventoryholder
Execution failed for task ':test'.
> No tests found for given includes: [sh.miles.domainsiege.internal.LightChunkTest.testInRange](--tests filter)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
``` I'm so confused what is going on here with IntelliJ its like spazzing out :L about to uninstall again so many issues with things that just work on vsc
Yeah something funky going on with Spigot site. I uploaded a jar to the GroupManager page and changed from external site to direct download 14 hours ago. The update post is there and fine, but it still links to external site not download from spigot.
ok seems it was my mistake
I didn;t enter a version even though I uploaded the jar so it was ignored
ChatColor.of
The ChatColor from the net.md-5 package, to clarify
wait so i cant use it on like names of items?
You can
when we deprecating org.bukkit.ChatColor or is it actually used for stuff
It probably won't be deprecated
'setDisplayName(java.lang.String)' in 'org.bukkit.inventory.meta.ItemMeta' cannot be applied to '(net.md_5.bungee.api.ChatColor)'
ok
ChatColor.of(0xRRGGBB) + "Hello world"
I'm currently awaiting API to support components in ItemMeta
use MineDown honestly or something like IridiumChatColorAPI
Also an option but that gets you back a BaseComponent[], which again, we're waiting on API for
I already promised him fresh baked cookies
oh me? I couldn't care less imma still use getHolder() lol
I was more or less saying that in response to Raziels results with tps drops using that method :p

noooo not getHolder()
thats a sinnn
getHolder() instanceof MyCustomInventory
You cannot stop me
us*

please provide a better option that doesnt involve me keeping track of Inventory instances in a map
if it's that bad
New spigot update dropped if your username is Burchard37 inventory holders break
idk the way they were explaining it sounded like a simple fix
just return the cached holder if exists (which, it should in this case)
or
hack it yourself with reflection lol
This method doesn't work when a player is near the edge of the block. I couldnt think of a good idea to fix this. Any ideas?
private boolean isOnGround(Player player) {
double epsilon = 0.01;
boolean onSolidGround = player.getLocation().subtract(0, epsilon, 0).getBlock().getType().isSolid();
boolean inLiquid = player.getLocation().getBlock().isLiquid();
return onSolidGround && !inLiquid;
}```
I thought maybe just subtracting a small amount from X or Z and checking if there is a block there but that wouldnt work with the different sizes of blocks
rrly?
yeah
i need some help debugging this exception I'm getting
java.lang.ExceptionInInitializerError: null
...
Caused by: java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?]
at java.util.KeyValueHolder.<init>(KeyValueHolder.java:61) ~[?:?]
at java.util.Map.entry(Map.java:1709) ~[?:?]
at co.tantleffbeef.pluggytesty.armor.ArmorEquipListener.<clinit>(ArmorEquipListener.java:39) ~[pluggyTesty-1.0-SNAPSHOT.jar:?]
... 13 more
here's the relevant part of code causing it. line 39 is the line that starts with entry
private final static Map<TrimPattern, ArmorEffectType> trimMap = Map.ofEntries(
entry(TrimPattern.COAST, ArmorEffectType.CONDUIT_POWER),
...
I'll send the full file
?paste
this file was written a few months ago and so I don't remember how it works
but it just started causing issues
oh is it because my world doesn't have the experimental datapack?
yes, one of those references is null
when would they be null?
this is 1.19.4, waiting to update until FAWE finishes updating
if experimental datapack isn't on?
well TrimPattern would be null when there is no experimental datapack
idk what ArmorEffectType is
okay that makes sense
oh right that's an enum from our plugin
once again old code couldn't remember
anyone have an idea about this?
maybe something with bounding boxes could help
ngl idk what that is
declaration: package: org.bukkit.util, class: BoundingBox
Im about to lose my fucking shit
I JUST had this working, so i just deleted the import, jar and everything thinking i didnt need the import anymore (was using an event from this plugin) and now... i try to add it back and it will NOT RE-IMPORT FUCK
I tried
Invalidating my caches, renaming the packages, version and path, renaming the jar file, using the maven install-file command what the FUCK am i doing wrong?????????????
no errors.... this is with install-file
Just shows the import in dependencies but cant even view its source (could do it before i removed it) wtf is going on?
huh?? restarted my pc and now this? wtf? cant access any of my own classes but other imports are just fine...
I have a bit of an odd request that i don't even know if it's possible, but i'll try to summarize in the most comprehensible possible way
I'm developing a Level System plugin, basically what you would find in any RPG, you get XP from doing tasks (killing mobs, gathering wood, mining), you level up and you get skill points to spend in your skill tree
In this project I'm implementing a rank system, that acts as a level cap until you change to a higher rank, but leveling up your rank is different than a normal lvl up
To lvl up the rank the player has to consume a specific item, let's say an item called "Rank Up Apple", obviously it's not a vanilla item, I'm using the ItemAdder plugin to create this item
My question is, from my own plugin, how can i check if the consumed item was indeed the "Rank Up Apple" to then change the player rank? i don't think this is possible using the normal ItemStack interface because it's not a vanilla item, it's a custom item
I'm studying the ItemsAdder API to check if there's anything there that can help me identify custom items from within my plugin, i hope I'm not just losing time
For the "Rank Up Apple" Use PDC
?pdc
From there you can change the rank on the consumed food event (forgot its name exactly but i assume you know it) with your methods that you have
Considering these are your own custom items your creating with your plugin of course, items adder just has an api that checks for you against theyre own items
i'll look into it, thanks a lot
couple more rounds of invalidating caches and re-indexing my files i fixed this but now cant even compile without dependencies because....
A class cant access its own class..... what the fuck is intellij smoking today?
guess imma need to find an idea ive been at this for over an hour and nothing
Holy shit i was right...
Pic 1: The 3 plugins running normally. All with the getHolder method.
Pic 2....
the checks replaced with something otehr than getHolder
All the bigger , inventory dealing , plugins.... they are supposed to be at like less than 1/10th the execution time...
Believe me now?
12 god damn years...
Im both extatic and distraught lmao
never said I fully didn't, just said doubted
Idk why you don't report it to jira like a couple of us said earlier lol
amazing even on a new project i cant compile anymore due to this 
Jesus is there a full on error message for it?
slowly starting to lose belief in the jetbrains supremecy now
nope
even with the flags for maven, thats the only error
im at a loss tbh
you do know the jira site btw right?
I do, last time i reported something it took 2 months and ahving to explain it 3 times in a row
hello there,
how to start to dev with spigot, i know oop base of java, any conseil ?
poo base?
oriented objet
yeah sorry 🤣
no, i don't have objectifs, i just want to know of this work, personnaly, i used netbeans because school
im jumping off a bridge
i got it smh
alright well you can use netbeans if you want but I personally recommend Intellij IDEA
others here would disagree with me
ctrl + z doesnt fully bring back files when deleted in intellij even though it literally gives you a popup saying to bring it back
Neat...
What an amazing feature intellij 😄
here's a tutorial for idea, there's one for netbeans but I don't think it uses maven or gradle so not as great
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
that will just show you how to make a blank plugin
which will have an enable message
the main part of spigot is events
your plugin can listen for events
for more information about how to do that read this
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ok, so is essentialy a responsive of event
yes
they don'T have notion of classe traitement directly, like a specific action
the basic idea is that when things happen, events will be broadcasted that you can listen to
and react to
and even sometimes cancel
and there's all sorts of events
super common stuff like PlayerMoveEvent and far less frequent things like SheepRegrowWoolEvent
ok
i see
and that : https://hub.spigotmc.org/javadocs/spigot/ was the all package i can use ?
package index
nothing more
that's all of the spigot packages
which is a lot
and most things you'll want to do you can do purely through the spigot api
you might need to add additional dependencies
and for almost everything you won't actually need to interact with internal game code
hopefully you'll never have to
@wise mesa where i can found that : internal game code
?nms
but I wouldn't worry about it
mess with the spigot api for some time first
if you don't need to mess with the internal code, then don't
especially if you're just starting off
?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!
there's some command for this
it doesn't let you upload a pic because you're not verified
but you can still send an embed
?ss
no
does anyone know
idk the website everyone uses
@quaint mantle
?img
Not verified? Upload screenshots here: https://prnt.sc/
i want you to use that
so you can ask your question publicly
idk man
it says error is not very helpful
okay fine
here's the image they sent me
I don't undertstand it's probably just an overlay on their stream
it's not on their server
it's just part of their stream
that they overlayed
Tiktok doesn't have a public api you would need to use a 3rd party one and do stuff according to how it works
The tnt levels are prob just bigger explosions
I just found out ur the one who added the snapshot to getHolder...
😅
Might be worth doing a big oll annual PSA on why putting kn holder methods into on click events is a really bad idea
I used to use getHolder as it was way easier than using the getName and shit. I recommand using InvUI
great ui and simple to use.
U don't understand.
GetHolder makes a snapshot of the holder. Which if jts a block entity... gets.... its inventory...
Every... damn... click.
Core protect has it brewery has it, a lot of plugins have it and its the number one reason custom items are TPS hogs
It ws never the items
It was the fact me moving 20 cobble stacks was reloading the other 10+ custom items in the same inventory... 20 times...
Once every click
This took my brewery usage usage from 12%... to 0.7%
It is, quite literally, THE TPS problem
toooo be fair
everyone always does say not to use holders
people just dont care most of the time :p
also there is this basically saying what your experiencing from 2021
make a spigot post about it and the correct way to do it = free spigot forum clout
This method doesn't work when a player is near the edge of the block. I couldnt think of a good idea to fix this. Any ideas?
private boolean isOnGround(Player player) {
double epsilon = 0.01;
boolean onSolidGround = player.getLocation().subtract(0, epsilon, 0).getBlock().getType().isSolid();
boolean inLiquid = player.getLocation().getBlock().isLiquid();
return onSolidGround && !inLiquid;
}```
Can't you get players location and check the block face of block below and check if its solid
And see if distance between the edge and player is < ~0.01
Not edge but block face
That would still have the same effect
Wait wym
Check all blockfaces?
There deff is lmao just prob not easy
Alright
i am SO upset
ive went through like 3 drop editing blocks
andi wanted to add my own auto pickup and for fucks sakes no one uses this event to add drops 
im gonna make a rant on the forums about people not using this, its truly a crime
just a small query, how can i enable allow cheats, in server properties there are no option for that.
i did already
it just saying cheat is not enabled in server
where does it say that
ingame
yes
what command
gamemode
are you by chance using geyser and you are on bedrock
yes lol
Hello, I'm new to building with the build tool. I build Spigot 1.19.4 succesfully with:
export MAVEN_OPTS="-Xmx2G" java -Xmx2G -jar BuildTools.jar
Now I'm trying to build 1.20 with:
export MAVEN_OPTS="-Xmx2G" java -Xmx2G -jar BuildTools.jar --rev 1.20
and it Fails with a timeout.
Exception in thread "main" java.net.ConnectException: Operation timed out
What am I doing wrong?
I'm on MacOs
Could you send the entire log in a paste
?paste
Send it in #help-server
I wanna add koji's skyblock custom items to shop any plugin for that? Like I tried the fancy shop and economy shop fancy shop doesn't work, economy shop adds it but as a normal item and not as a custom item with abilities
In royal economy how do I do it?
Ask in #help-server
Ohk
this makes 0 sense
String uuid = String.valueOf(player.getUniqueId());
File file = FileUtil.getFile(uuid + ".yml", "data");
YamlConfiguration configuration = new YamlConfiguration();
try {
configuration.load(file);
} catch (IOException | InvalidConfigurationException e) {
throw new RuntimeException(e);
}
configuration.getConfigurationSection(name).getConfigurationSection("data").set("slot", 10);
try {
configuration.save(file);
} catch (IOException e) {
throw new RuntimeException(e);
}
}```
player = a valid player
name = "t1"
```t1:
data:
slot: 9
page: 1```
slot stays at 9 it isnt changing from the code i sent, no errors
Are you getting the right file
Make sure that FileUtil is reading in the correct folder
it is "data" is the folder
and my plugin folder looks like
PluginName
-> config
-> data
-> my_uuid.yml
no need for String.valueOf
Show your FileUtil class
and instead of
YamlConfiguration configuration = new YamlConfiguration();
try {
configuration.load(file);
} catch (IOException | InvalidConfigurationException e) {
throw new RuntimeException(e);
}```
just do YamlConfiguration.loadConfiguration
public class FileUtil {
public static void createResourceFile(String name, String directory) {
File rf = new File(PlotAddon.getInstance().getDataFolder() + File.separator + directory, name);
if (!rf.exists()) {
rf.getParentFile().mkdirs();
PlotAddon.getInstance().saveResource(directory + File.separator + name, false);
}
}
public static void createResourceFile(String name) {
File rf = new File(PlotAddon.getInstance().getDataFolder(), name);
if (!rf.exists()) {
rf.getParentFile().mkdirs();
PlotAddon.getInstance().saveResource(name, false);
}
}
//
// Constructor
//
private final File file;
private YamlConfiguration configuration;
public FileUtil(File file) {
this.file = file;
}
public YamlConfiguration getConfiguration() {
YamlConfiguration configuration = new YamlConfiguration();
try {
configuration.load(this.file);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
this.configuration = configuration;
return configuration;
}
public File getFile() {
return file;
}
public void save() {
try {
this.configuration.save(this.file);
} catch (IOException e) {
e.printStackTrace();
}
}
public static File getFile(String name, String directory) {
return new File(PlotAddon.getInstance().getDataFolder() + File.separator + directory, name);
}```
and instead of getConfigurationSection(name).getConfigurationSection("data"), getConfigSection(name + '.' + data)
lol
I have a problem with memory. Memory is continuously increased. If it is caused by loading a lot of chunks, why unloading worlds doesn't affect? What's wrong with it?
I mean, your JVM won't need to garbage collect until you are getting close to the max memory configured
how can I instead of ClickEvent.Action.RUN_COMMAND just run plain code?
If so, why restarting the server affects? Anyway, how to make it garbage collect after unloading a world or a chunk?
a server restart obviously restarts the entire process ?
beyond that, you don't want to manually garbage collect
reduce your maximum memory allocation if you want java to use less memory
and the gc is a diva
usually this is done with a Map<UUID, Runnable> and you generating a random uuid, adding it to the map and then run command something like /runmylogiccommand <uuid>, the command then doing a lookup in that map and running the runnable
can I implement my own ClickEvent natively or maybe extend the BaseComponent/TextComponent or smth?
no
run command click event is interpreted by the client
the server cannot do more than just, have it run a command
run a profiler if you really want to know
What about loading chunks until full memory, it will unload some chunks to load next or it crash the server?
Sign#setEditable is is only strictly on restricted in the event and nothing else?
throws an out of memory error if the chunks cant be unloaded due to loaded entities and such
how many gigs is it using
some kind of profiling tool
or ask it at Runtime.getRuntime().freeMemory()
or use visualvm to inspect memory dumps
tells you how much objects of each type are instantiated
Hello, I have a lot of listeners listening to the same event. Is there a way to ensure certain listeners "listen" in a certain order? i.e. I want to ensure ListenerA is executed after ListenerB.
EventPriority is not enough for my use case as I have 10+ listeners. Is there a library that handles this?
Use a single listener and call you methods in an order?
Can't, they all do other things
generally it would be very bad to have everything in 1 listener anyways
Not really
Can't, they all do other things
Why does this matter
all your listener will be called for every single event ew
writing them in order procudurally is the only way to guarantee the order afaik
i hope you know damager.getLocation() returns a new location on every invocation
uhrm, because we follow a single responsibility principle. We have multiple modules responsible for varying code, I can't have them all in 1 listener :/
Yeah... that's what we're doing currently -.-
have one base listener that delegates responsability to the modules
I was just wondering if there is a different solution
single responsibility is a lie anyways
We try
it returns a new location object every time you call it
the responsibility of the listener is to make sure events are passed and handled correctly
but the listener also shouldnt handle low level impl details, it should delegate the work
variables 💀
why: idk
yes agreed
Actually says what it does in the code. Basically checks if the projectile hit the head part of the player.
So you run the code and it doesn't work?
Well you can make a listener class that only has the responsibilty to handle listens and pass them on to other parts of the code. For example you can keep a list of listener methods and loop that
projectileY and damagedY are always the same, substracting them will always be 0
wow
wrong reply
thanks i really didnt know. will fix it asap!
@quaint mantle ^
read docs next time !
will do !
if only you read up on the subtraction operator on the docs, you wouldnt have to ask such a question
How would i check if a player traded with a villager for a certain item?
there is a tradeselectevent you could use, but I think that just fkres when you select a trade, now when you actually confirm it
for that you would probably use an inventoryclick event or something
having two separate listeneres is such a negligible performance reduction lol
not worth violating a code principle for that
Hehe listeners having a minimal effect on performance if you don't do a separation check
inventoryClickEvent.getInventory.getHolder() called, it wants its incorrect assumptipn back 🤣
No. Not in this case.
I have 10+ listeners for a particular event across various modules. They all do different things and have different checks.
I just wanted to know if there was an alternative - or an addition - to EventPriority. (except for just ordering the listener in they way I want them executed.)

pwease MD5