#help-development
1 messages Β· Page 1051 of 1
but I tought the contains would implicitly do that
which it does cuz the code works
but like
sussy contains
thanks for the assist
contains is just a loop with Objects.equals
yeah that would still implicitly do what I said
its just comparing object references
which event governs setting a respawn location by interacting with beds?
i see nothing wrong here
neither do i
perfectly usable code π
if only java had List::find(Predicate<E>)
it'll come in the next patch focused on performance
how do i access a function in the first plugin from another plugin
add a dependency on that plugin
how can i download 1.18.2 spigot api?
?bt ig
like add it under the pom.xlm under dependencies cause it says it cant find the dependency
where i need to compile?
why you wouldn 't use maven or gradle now is beyond me
either install your plugin to your local repo so you can depend on it, or deploy it on some repo manager like jitpack
what
alright will try that. thanks
a la mvn install if youre on maven
idk ive never in my life used the gui
π¦
whats not clear about that screen
so many things about this confuse me
Why not use Maven or Gradle
What about the GUi is unintuitive
imagine using guis
had some dude on an internship and he said he couldnt see the password when he had to login on a linux server
π
π
did you tell him that was kinda the point
i mean ye
a lot of people who go internships know litearlly nothing though
so its not surprising
my friend recently got an internship and he didn't even have a github account
π
It didn't work, me and my friend are still stuck
public void doAnimationLoop(ArmorStandClass stand) {
Iterator<StandBodyPoses> iterator = stand.savedPositions.iterator();
BukkitScheduler scheduler = Bukkit.getScheduler();
while (iterator.hasNext())
{
scheduler.runTaskTimer(Plugin.getInstance(), () ->
{
as.setWholeBodyPoseFromPose(iterator.next());
}, 2L * 10L /*<-- the initial delay */, 10L * 5L /*<-- the interval */);
}
}
no put the loop in the lambda
whats a lambda
just write a class implementing Consumer<BukkitTask>
class AnimationTask implements Consumer<BukkitTask> {
Iterattor<Pose> it = ..
@override
void accept(task) {
if !it.hasNext() { task.cancel() return }
Pose = it.next()
pose.play()
}
}
scheduler.runtaskTimer(x, y, new AnimationTask(stand.savedPostiiobs?.iterator()), 2, 10)
a la this spaghetti
or extend Bukkitrunnable whatever
Alr will try it thank you
tbh the more and more I see how folia's implementation of bukkit api is broken, the more I think that Bukkit API should be refactored for a new API standard in plugin ecosystem
its designed for single threaded environment, and if minecraft's servers really want to expand into concurrency it just begs new api
dont get me wrong current API is evolving, but not in a critical sense due to somewhat compatibility layers that's being left for old plugins that are dating back to 2013 days
maybe im wrong idk
its just my view
i have many keys tied to one value, when adding the value to the Map<Integer,Value> , is there a more efficient way than doing the following:
for(int key : value.getKeys()) {
map.put(key,value);
}
you can make it a one liner but i dont know if its more efficient: value.getKeys().forEach(key -> map.put(key, value));
i think internally this is the same, altough thank you for helping
your welcome but if you dont find anything better, just use the option which is more readable to yourself
yeah im gonna do that it looks cleaner
I will control the collection of items so that if an English player picks up the item, the lore will change to English, and if it is Portuguese, the lore will change to Portuguese, etc. But how should I do this in chests where several players can touch the items in the chest? How do you suggest displaying items in multiple languages?
Translation components
I don't know if it's better to somehow update the lore of all "multi-language" items when someone opens the chest to that player's language but fake update with packets or actually update the item.
I stayed the same xd
Is it possible to change the lore and name of an item according to the game language in the texture?
TranslatableComponents
texture not is better?
wdym by texture?
server texture
im still not sure what you mean
should i have one plugin managing all communication between plugins and the database or should every plugin have the database communication code and make their own connection or is there an even better way to do it and how?
if you have multiple small plugins managing different parts of your server, i would recommend using one connection + you can have multiple modules in one intelliJ project making it easier
how can i create a module? because right now i got stuck because i have two projects open one is for a test plugin and one is for the database manager plugin but i couldn't figure out how to reference the database manager's functions
top left, project structure, modules
top left button
you need to depend on the modules tho
so in the modules tab i just need to find my other project?
But doesnt that forces you to compile with intelliJ instead of maven or gradle?
cant i just press import and find the projects location?
try and see
I've never had a love/hate releationship quite like the one I have with nodejs
it feels like driving a race car but the only pedal you have is gas
Try Deno or Bun
they both support npm packages
Bun even supports loading straight from a npm folder and auto-conversion
I enjoy Deno
they also both have builtin Typescript support & nice builtin apis
and they also dont require a package setup to run a file, actually idk bout bun
I'm not interested in learning 35 different languages and libraries to get a project running
????
there both javascript
and also its one thing? using the same libraries as node (in npm_modules)
seems like a invalid excuse tbh
javascript is most of my problem with nodejs so I guess it wouldn't make much of a difference then
In PlayerQuitEvent, will Player#isOnline() return false?
schrodingers status
is the player online when they quit? fck around n fiiiinndd outt
is there a way to get the skin of a player and set it to a grayscale version? i wanna make it look like a stone statue of a player i select
got an annoying one, trying to figure out if there's a way I can rebalance wither, poison and fire damage because those are doing an inordinate amount of damage for my boss combat system
since gear level is meaningless unless you have fire resist
really wish there was a way to trace the damage source of those though I understand why mc doesn't do it natively
I might just apply some damage multipliers in dungeons and call it a day, not great
You can get the url of the skin if you decode the texture property in the player profile. Then you can download it and apply a transformation to the PNG. After, if you want to apply it you might need to upload it to the Mojang servers
So you might have to get a dummy Minecraft account which changes its skin
Then, you get the texture and signature and apply it on the server
on second thought i might just use a generic statue skin
no do the grayscale thing it'd be way cooler
Yo guys, do you know how do I make custom gui using my plugin menus without any external plugin?
?gui
Is there a way to get a transformation from a matrix4f object ?
I meant stuff like:
data pack with a custom font
I tried but isnt working
Should be an utf as a gui title
I made something like this
How do I access PersistentDataContainer of OfflinePlayer?
Not exposed on the OfflinePlayer
π‘
You should modify the player before they go offline
I want to get data from player that's offline
Store it in a database or yml file
anyone knows how to make an potion that deletes bad effects with duration ?
how did you actually put the texture on the menu though?
and like what have you tried exactly
whats anti debuf do
like deleting the bad effects with a duration
youd probably have to do something custom for that
idk if you can make an actual effect for that
how can i get a pink leather helmet as a material
as a itemstack?
Yeah that's possible
and how
declaration: package: org.bukkit.inventory.meta, interface: LeatherArmorMeta
ty
I ve just changed the resource pack like the rar i sent and prayed
.
well youll have to do more than that
like what texture did you change in the texturepack
im pretty sure that screenshot you sent earlier is from a video is it not?
yes
so I assumed you followed to the video?
yes but I dont wanna use any external plugin like he did on the video (DeluxeMenus)
okay, well the essential part is after you made the font with your texture you have to set that character as the title of a menu
or inventory I mean
can you show your code?
I think I got it, example: if I set the character to "Menu" the title needs to be "Menu", right?
I think the character can only be... a single character
like some unicode character that doesnt get used by others
ItemStack pinkCap = new ItemStack(Material.LEATHER_HELMET);
how can i turn this helmet pink?
set the item meta
pinkCap.getItemMeta() and check if its LeatherArmorMeta (would be weird if it wasnt) and cast it to set the color
are we talking about: ```{
"providers": [
{"type": "bitmap", "file": "minecraft:guis/pixel.png","ascent": -2000,"height": -3,"chars": ["δΈ"]},
{"type": "bitmap", "file": "minecraft:guis/pack/Fundo_1.png","ascent": 13,"height": 138,"chars": ["γΊ"]}
]
}
then set the meta back to the item
yes, that weird A looking character should be your menu title
believe the name of it is the character point you want it to replace. Then its a matter of using the character point in your strings where you want said character to appear. Don't really think there is a limit in size other then just where you want it to fit, so using invisible space can come in handy when you are wanting correct placement in regards to other strings being present on the same line other then using spaces lol
the idea is that the game will render that character with the texture you give it, in this case your menu
and if I wanted to have a name on it? like "menu" on this case?
like you can try copy and pasting that character in your chat and it will show the menu texture
ItemMeta capData = pinkCap.getItemMeta();```
i know have this wdym
then you have to do what frost said and make sure the spacing is correct
which I have no experience with
generally get best results when not trying to use the character itself rather its character point
cast it to leatherarmormeta
wdym character point
every character has a number associated with it, this is called its character point
IE \u0021
right
ItemMeta capData = (LeatherArmorMeta) pinkCap.getItemMeta();
I mean sure you never have to actually type the character, the unicode would be fine
good and now change the ItemMeta to LeatherArmorMeta
well sometimes there is issues if you use some really weird characters π
either way, now they know how to do it

so, in conclusion, I need to set the menu name to the "Chars" field?
what color is this
when you did all that, you should be able to access new methods on capData which allow you to interact with the color and stuff, dont forget to pinkCap.setItemMeta(capData); if not changes arent applied
yes
Example if I wanna make the menu with the "Fundo_1.png", the name of the inventory open needs to be "γΊ"?
it needs to have that character in it yes
LeatherArmorMeta capData = (LeatherArmorMeta) pinkCap.getItemMeta();
capData.setColor(Color.PURPLE);
pinkCap.setItemMeta(capData);```
is this right?
everywhere you use that character in the game, it would draw your menu
can I put more than 1 character on that array? and if so how would I do with the menu name?
idk
you would usually pick some unicode chatacter that minecraft doesnt render naturally
there are like a few thousand you can use iirc
try and see, but seems fine
it needs to be just 1 char right? I was thinking about using UUID
yes 1
i have not experienced a lot with this though
im not the expert you are looking for
how is it possible that i have 1 method in 1 projekt it works in the other not
compare both
i copy pasted it
what is your plugin coding experience?
mine?
steaf
great, I have a question, Im currently using gradle but since I wanted to use NMS it was giving me a lot of problems, some people said that usim maven is better, my plugin is medium size already, do you think its worth it changing it from gradle to maven?
Why are you using that
There's no reason to set the localized name anymore
itembuilder
It has no purpose you can remove it
im using it like this
30% done for the 1st version
like how big is your gradle build file
30% says nothing about size
π
sure idk how can I say
size will be relative
: / whats wrong
yeah u r right
how many dependencies do you have
If you want to detect items do so by attaching a PDC tag
?paste
if you only have a few deps there is no reason you cant switch over
also do not call close inventory in the click event
why not by localized name?
then how? waiting a tick?
ah right
It's marked for removal
just like your warning says
oh yeah this is a pretty small build file, you should be able to move to maven easy enough
whats the difference between projects
@clear elm
nothing
Just because it works (for now) does not mean it's a good idea
only artifactid name and groupid
and is it worth it?
wdym, do you use this project across multiple plugins or something?
i just used the same spigot version and the method worked in every plugin till now
?
idk
I recently switched to gradle because I am using paper
but like other than that idk what the best option is for all cases
you can use both just fyi
if you really can't decide
gradle and maven don't typically intefere with each other in the same project
really its down to preference. Generally maven is easier to use but that is because there is plenty of documentations and tutorials etc for it
where as for gradle there can be some large gaps in such things
you need a super large project to actually see any real differences between gradle and maven and most people are not going to have such things with plugins
a large enough project where you have build times of 5 or more minutes just to compile
both maven and gradle are pretty decently fast though if you tailor them appropriately and it also depends on your project as well
how can i remove the Colour: on the top and the text from When on Head
viwevers
oh
Hide attributes flag
how can i do this
what are this 2?
i am pretty sure those are clientsided idk
^
oh yea ty
i think im going to change xd, it will be the best play here
if you believe so
Hello i'm pretty new to plugins, and i wanted to create my own minigame (A the towers remake). I wanted to know if anyone knows how to detect if a player enters an area and then do some actions ?
I did my own research how to do it and found WGRegionEvents, but I can't make it work. Maybe is it outdated ?
you could use bounding boxes
or hook into the worldguard api if you want to use that
otherwise the distance check is a valid one
distance to a block ?
if you speak of an area you typically mean the space between 2 locations. you can check if the player is within that by checking his distance to the area. but a bounding box does the magic already for you, so i recommend using that
nms blockbox β€οΈ
there you can easily check if the current position of the player is withing the bounding box
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/util/BoundingBox.html#contains(double,double,double)
rather a scheduler which iterates of the players
playermoveevent is too frequently called for that check
you can just do stuff ```kt
fun save(corner1: Location, corner2: Location, key: NamespacedKey) {
val corner1Pos = corner1.toBlockPos()
val corner2Pos = corner2.toBlockPos()
val (min, max) = corner1Pos.asExtremeties(corner2Pos)
val positions = BlockPos.betweenClosed(min, max)
val palette = mutableListOf<BlockState>()
val paletteBlockStates = positions.mapNotNull { pos ->
val location = Location(corner1.world, pos.x.toDouble(), pos.y.toDouble(), pos.z.toDouble())
val state = (location.block.state as CraftBlockState).handle
if (state.isAir) {
return@mapNotNull null
} else {
if (state !in palette) {
palette.add(state)
}
val relativePos = pos.subtract(min)
val id = palette.indexOf(state)
PaletteBlockState(relativePos, id)
}
}
val blockBox = BlockBox(min, max)
val size = Vec3i(blockBox.sizeX(), blockBox.sizeY(), blockBox.sizeZ())
val schematic = Schematic(palette, paletteBlockStates, size)
val nbt = Schematic.CODEC.encodeQuick(NbtOps.INSTANCE, schematic)
val path = Path("schematics/${key.namespace}/${key.key}.nbt")
path.parent.toFile().mkdirs()
NbtIo.writeCompressed(nbt as CompoundTag, path)
put(key, schematic)
}
my schematic saving functionality
i am making a custom format
can we introduce a rule to use ?paste for kotlin code to not damage my eyes
Why do some people disable boat with chest riding? And interaction.. is there a dupe or something
can we introduce pastes.dev instead of md5 paste?
yes please
unable to determine destination of item move?
valid but also that bitch for some reason takes like 7 minutes for me to load a paste π
works on my machine
same
same

hell if i know why
The question does not apply to plugins for minecraft, but more to plugins for inteliji. For some reason, some plugins do not work specifically on my PC.
- plugin for displaying diagrams
- Codeium
Has anyone encountered this? These plugins work great for my friend.
you can check intellij's logs to see if you find any errors
Help -> Show Log in Explorer/Finder/whatever file explorer you use
Hey guys I have a problem compiling my plugin, I'm using bukkit 1.21 with nms and java 21 and I get this error while compiling the plugin:
[ERROR] Failed to execute goal net.md-5:specialsource-maven-plugin:1.2.5:remap (remap-obf) on project SimpleSmp: Error creating remapped jar: Unsupported class file major version 65 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
Can anyone help me please?
Omg dude I didn't realize the major version change π
I was updating the version with 1.2 at first then tab completing with it
Thanks alot!
wait until you find out about the armor stand manipulate event
Does anyone here know whether intellij has it's own system of merging git branches (gui or somthing) and if it's useful?
it's alright
so it exists
nice
I am doing a HUGE code rebase and I think it's good to do it with git branches
hmm theres no SugarCane block or something?
was supposed to works.this event doesn't work very well
Ageable
was wondering if you broke the second block of a sugar cane plant, it that resets all growth to 0 or remembers how much longer it wouldve taken to grow a third block
π€
as in is it good to break sugar cane when its only 2 blocks tall or do you really have to wait to the third
or do you waste progress if you break it before its fully grown
i think the convenience of letting it grow to three comes from not having to replant it
when you break the top two
design question: we want to introduce a filter system to our pathfinder library and for now we ended up with this https://github.com/patheloper/pathetic/tree/v3.0/pathetic-api/src/main/java/org/patheloper/api/pathing/filter.
the filters are passed to the pathfinder directly https://github.com/patheloper/pathetic/blob/v3.0/pathetic-api/src/main/java/org/patheloper/api/pathing/Pathfinder.java#L26 and are evaluated here https://github.com/patheloper/pathetic/blob/v3.0/pathetic-model/src/main/java/org/patheloper/model/pathing/pathfinder/AStarPathfinder.java#L307. with our current approach there are some flaws which are very annoying, so openly asked: does anyone have any suggestions on how we can approach this better?
me with my 2x2 chunks of sugar cane being perfectly reasonable
i mean if you break it at 2, while it wouldve only taken 40 more ticks to grow to 3, so now its at 1, will it now grow to 2 again within 40 ticks or will it have to grow that second block from 0 again
theres probably a wiki about this
why i can interact with armorstand?
use the function with the consumer
it fires the event before you set the custom data
actually nvm, interaction event
what
NAME COMPARISON
improving filter system design for a pathfinding library
you debug if in first place the event is fired and the basic info about that entity?
is fired yes
but i didn't debug
try check if fired with armorstand and what is the info of that...
How can I register my enchant in 1.21?
because in this version there is no registerEnchantment method in the Enchantment class
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/enchantments/Enchantment.html
declaration: package: org.bukkit.enchantments, class: Enchantment
declaration: package: org.bukkit.enchantments, class: Enchantment
datapack or nms
inthe docs it says to generally not be used in a plugin
so they probably removed it to avoid confusion
That's quite the odd addition wonder when that was added and why
Might need the ol deprecated
i mean, it was probably added in, like, its inception
far before registries were a thing
Yeah I was thinking so
and that's how they thought would be a good idea
then when registries were added md5 kept it cuz muh backwards compatibility of unsupported methods π€
Should probably be deprecated for removal I'll take a look at that later ig
Spigot have a sensible deprecation schedule (impossible)
Trying to maintain compatibility with 1.8 at this point is wild
it literally doesn't exist anymore
that's what op was pointing out
so only nms?
thanks π
thank you too
Data packs more like midpacks
does spigot api support sending worldborder warnings to players?
more like mid api when data packs can do more
so i create a border for single player only and simulate warning with a crazy distance?
yes
Don't think the game works that way
i can just warn players if their Y is too high
and then loop some damage
kinda nether behavior
How do you get an entity's EntityCategory now through the new tag system?
?paste
why does it pick up blocks like this? - https://paste.md-5.net/oxecakiwol.cs
suckCounter
kekw
since when do inventories no longer implement Serializeable?
it never did?
^^
huh
if i use ItemStack.serialize() i fail to see how i can deserialize it afterwards
π€―
π€―
right...
okay my bad
was just looking in the definition of ConfigurationSerializable
but makes sense to use a static method
public ArrayList<Map<String, Object>> serializeItems(ItemStack[] items)
{
ArrayList<Map<String, Object>> ser = new ArrayList<Map<String, Object>>();
for (ItemStack is : items)
{
ser.add(((is != null) ? is.serialize() : new ItemStack(Material.AIR, 1).serialize()));
}
return ser;
}
``` yaay.. xD
ever heard of getOrDefault?
ask that to md5
epic
hello everyone
Could someone help me prioritize the tablist? I'm trying with packets and teammanager
whats teammanager
ktx.serial + kaml = β€οΈ
as.setRemoveWhenFarAway(false); how does it works?
does this mean that I can access the entity when it is not loaded?
it just removes it client side
it just gets hidden
(at least with displays, not sure with ASs)
Can an entity's UUID be the same as a player's UUID or do I not have to check if an entity is a player before searching for it's UUID in a map?
it can but that's so fucking unlikely
it's more likely that you would get hit by space trash than a uuid colliding within like 2m years
yeah this discussion happened in paper earlier today lol
and if it does happen youll find out (probably)
i think you were there
yes I was xD
but its like the chance is infinetly higher that your code has a billion more bugs than the uuid collide messing up your code
so I just assume its always unique
its in the name ffs
My life is so boring I feel like a risktaker when I skip this check
can some1 recommend a good obfuscator
theres specific guidelines of obsfucators on spigot and obsfucation wont stop people, if they want to they can still see your code
but can you recommend a good obfuscator anyways
theres loads of them
thats why I have a public github repo xD
some easy to use would be good
theres still loads of them
just tell me 1 of them
that will narrow it down
i got sniped
get sniped on
is the Proguard good?
sure
obfuscation isnt security
hmm
Whatβs the fastest way to check if an item in a slot has changed
equals and isSimilar clone the meta, which id like to avoid
hashcode is my first idea, but thatβs still not ideal
reference check?
like if items.contains(otherItem)
where items is like a set or map or smth
Is it going to be the same reference all the time? (Until changing that is)
I donβt really know how long ItemStack references survive
movfuscator enters the chat
and how long do you wanna check the slots for
like in the lifetime of the server or what
I need to know when they change
So yeah, as long as the player is online
Sadly the inventory change event isnβt merged yet
I see
forcemerge it
yeah you can probably use references, I think they dont randomly change if the item is in the inventory
like surely if you drop them perhaps
or when you die
but then you detect they changed, which is the goal
talking about dropping it
Iβll be checking every couple of ticks, I just want to avoid cloning the meta and then parsing PDC if nothing has changed
so I think the reference only changes when the slot changes, which is what you want
Use nms lol
makes sense haha
Nou
serializing ItemStacks with item meta still causes problems
when i try to serialize the itemmeta on its own theres no deserializer?
why do you serialize or deserize meta without the item
Itβs possible you canβt do meta on itβs own because itβs actually represented by a ton of different objects depending on the item
because is serialized the itemstack with the meta
and when i wanted to write it via pdc
i got exceptions
isnt it saved with the itemstack or whatever
deserialize is in the package private impl class
Yeah I figured deserialize would be in the internals
so i cant access it?
nop
Not easily
so this is what i do rn
if (ser.get(i).get("meta") != null)
{
ser.get(i).put("meta", ((ItemMeta)ser.get(i).get("meta")).serialize());
}
```to serialize the itemmeta
which works fine
would be cool to deserialize it tho
xD
why are you serializing it
no i cant
because im getting exceptions when i try to serialize an ItemStack with ItemMeta
then that should be the thing you fix
when i try to pass the whole map to an object output stream
not create an xy problem out of it
which is what im fixing
Does using ConfigurationSection#getObject(key, ItemMeta.class) not work
whats the exception
hold on i need to revert the code then
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
what does it do? does this mean that I can access the entity when it is not loaded?
declaration: package: org.bukkit.entity, interface: LivingEntity
so in essence
java.io.NotSerializableException: org.bukkit.craftbukkit.v1_21_R1.inventory.CraftMetaItem
Are you trying to serialize it with javas serialization system?
Then PR better API π
Because that wonβt work
yes
i need to store it to a pdc container
Use BukkitObjectOutputStream
use BOOS
That lets you convert it to byte[]
No
thats crazy that this was an xy issue
well i didnt know that bukkit had its own implementation of an object output stream lol
well now you know π
@river oracle was supposed to add methods to convert items directly to and from bytes
But heβs bad
<3
Thatβs not spigot
just use pineapple Β―_(γ)_/Β―
Iβd rather not rely on someone elseβs NMS
so pr it
I canβt
I didnβt write that code
Also you removed the code for saving a single item to bytes? What a nerd
I cbf to deal with ItemStack it's annoying and stupid
Smh
after testing and rewriting the affected sections, it does work now i can serialize bukkit objects, cheersπ
hi everyone. is there any tool/plugin/mod that show sample of every bukkit materials items as some kind of image or chest gui
creative mode
i mean i need to know the exact enum value of bukkit Material as well
The enum value is just the same as vanilla but uppercase
Assuming you're not on an ancient version
They are the same
okie thanks mates
why does it pick up blocks like this? - https://paste.md-5.net/oxecakiwol.cs
something about suckDelay
You're incrementing the delay for each block instead of per iteration
Which creates a pattern instead of an effect
how can I attach a certain object/block to a player?
put the on an armorstand, and make the armorstand teleport to the player when they move
it`s so slowly
is there a way to check if sand breaks when it falls on a slab, or any block that causes it to break?
You could check the #EntityChangeBlockEvent
hello eveyone!
Im trying to create temporary cache (hashmap) for database and save the hashmap values in database after player quit
my question is now if player rejoin i need to put the databases values into hashmap again?
Does this cause lag?
depends on your code
It is known that direct storage of data via the database causes lag and also depend on the count of players in your server
Never access a Database on the main thread. Then you wont cause lag.
No its not. The amount of players should have exactly 0 impact on lag created by IO.
I said it depends on yoru code because your question is too vague to answer. We'd need to know exactly what your code is doing to tell you if it could lag.
just putting some data into a HashMap would not cause lag.
But thats nto all you are doing
Im coding player stats like kills,death, etc.
Load your data in the AsyncPlayerPreLoginEvent. You can call your DB methods right in this event since its async already.
Save your data in the PlayerQuitEvent. You need to call your DB methods in a different thread here since the event is not async.
I would recommend using a ConcurrentHashMap from java.utils.
Or a Cache from the Caffeine library.
so, is it okay to move data from the database back to the hashmap again, right?
In what regard? Whats concerning you?
where is the data coming from? How much data?
the data comes from database as you know hashmap data will removed if i reload the server or closed it, so i need to store it in file or database
and when player quit i stored the hashmap values into database, but if i want again to get the data i don't want to use it directly from database, becasue as i told you guys i think this will causes lag because the game i created is pvp game.
is there a plugin that can create custom smithing recipes and compatabile with oraxen
Hello, good question, I bought a plugin and I have not been able to download it, what should I do or what should I do?
Sorry for the bad English, it is with a translator, I speak Spanish
maybe contact dev
I think sometimes it gets stuck and you can ask the plugin dev for a key or whatever
ik how it works exactly
depends of the plugin but yeah.. try contact the developer.
how to make priority on tablist with packets? i try but not work
help me? please
consider sending your code
?notworking
"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.
?paste
How it's possible to let players in newest versions join? (no viaversion) I mean with own code
very very painfully
you wont find an example of how to recreate via version
you have to remap the protocol, tell the client it can join and handle every single possible packet translation
nah I don't any idea of how to do that
if it aint broke dont fix it... unless you want to spend hundreds of hours making a bootleg version of something already working perfectly fine
so use via version
yeah
am i wrong in thinking that git could be a great way to store server's configuration files?
not worlds or plugin artifacts ofc
but for keeping track of configuration files, imo is great if you want to branch off multiple versions of the same config files with some changes (for example production server's and test server's)
also CI/CD support for pushing those changes from git to production or test servers
you can also do rollbacks to specific commits
I think some servers probably use git to store state of their config files already
I mean its a pretty sensible system if you think about it
you can fallback if errors are made in your config you can have multiple branches, dev prod etc
what about plugin artifacts or lets say paperclip jar files
shall i store that?
how can i really deal with that
tbh i should probably develop a docker container for that
I would do that too if it was in an offline git repo. Once you post that stuff though it becomes wacky. As far as server jar if you default to paper you don't need to actually save the jar you can use their API to do downloads
since you can code it'd be pretty trivial to throw together a quick script to read a JSON file with needed data thats saved in git and actually make a request
i have folia
so i need to compile it
could also prob script that pretty easily too
but yeah it'd be more complex as you'd need a specific git version to compile
what about plugins, if i dont throw in the artifacts, how can i be sure that my cloned repo config files are always compatible with the newest plugins i download
i need some kind of package manager but for plugins
Yeah unfortunately unless you're using all free plugins that's not realistic. I mean you can save plugins with git / docker. But it'd need to be private/offline
well my repo is stored on github privately
i can store artifacts just by uploading them but this feels wrong
but at the same time it right since if production server uses the older version of the artifacts because somebody rollbacked it due to some kind of exploit
CI/CD would upload the right files to the server after the commit to the private repo
am i wrong?
i hate this kind of solution but i dont see better alternatives
I mean ideallistically you'd only store meta but plugins are a weird world of not being able to easily obtain them
i would love to have some kind of npm but for spigot plugins with package.json for keeping up with plugin versions from spigot marketplace
but we dont have smth like this afaik
Does anyone know how I could create a special item where if you right click it it would give certain players speed 2
Check for an item, PlayerInteractEvent to get the action type, (permission check for certain players) then give the player speed 2 @sacred light
ty
Hey what would you do if I hit you with a ?ask
block your ass
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!
its a command
only time I even seen bytebuddy was when I watched a conference from java about agents
look @ snakeyml
that's what everyone uses
its pretty lightweight
Would anyone know how to make a conditional tabprefix/tagprefix in the TAB plugin. for example when im in no faction it has nothing but when im in a faction it says the factions name. I want it so there would be no faction placeholder if your not in a faction
Sounds like a #help-server question
ok ty
just use jackson or configurate
jackson is bae
idk idc, I just use it
I just use jackson, idc how it works lol
I sleep
I have been trying for a couple hours now to get custom player heads into my 1.21 server. How can I do this, I have tried using things such as setting the owner of the head. I have seen people try to use GameProfile but that does not work since GameProfile is now changed to PlayerProfile.
Ive just posted on the forms of commissioning a new plugin
i hope i did everything right π
https://www.spigotmc.org/threads/new-plugin-commission-enchantment-clashing.653925/
I think you can create a PlayerProfile object using this https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Server.html#createPlayerProfile(java.util.UUID,java.lang.String)
declaration: package: org.bukkit, interface: Server
You posted it in the wrong Forum category, you need to post it on the "Hiring Developer" section which can be found at https://www.spigotmc.org/forums/hiring-developers.55/
oh right
thanks
wait how do i make a post?
its not coming up with the option to post there
Oh yeah you need at least 20 posts and your account must be at least 1 week old, it;s what it says on your screen.
umm ive had my account for more than 20 days
But not 20 posts yet then.
lol where do i make posts then???
you participate in the community, that's the whole point
okay now how do i speedrun getting to 20 posts
and they woke up
yay

who tf ghost pinged me
john doe
some shenanigans were afoot but they've been removed
sobs
The other option is to contact someone offering their services
thanks but someone reached out to me
I'm trying to use Vault in 1.21 and I wanted to make my own economy plugin but for some reason the Economy.class is null https://paste.md-5.net/eqicifabep.cs, why is that? there are only two plugins on the server, Vault and my custom plugin.
did you register your eco as a service provider?
Ah that might be why. I don't know if I need to do that.
So I need to create a class that implements Economy and register it using the ServicesManager?
Gotcha, thank you!
you don't
actually take part in the community
respond in threads (if you actually have something to add)
Bit of a niche question but how do i hide the health bar icon when mounting an armourstand in spectator?
Negative hp? Texturepack?
negative max health did the job, thanks
is there a event for right clicking/using a item?
even if it doesnt have a useaction
Interact event
hey guys, i am looking fpr an offline manager plugin and for an anti Xray Plugin
whats an offline manager plugin
doesnt exist
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
?tas
k
ye
why is getItemInUse giving me a error/returning null
also its not cancelling the event when i do this
event.setCancelled(true);
event.setUseItemInHand(Event.Result.DENY);```
wait im stupid
im doing getItemInuse on player
theres event.getItem
nvm
Need some help here. In older versions (pre 1.20.5) items got serialized to something like
v: 3700
type: CHICKEN
meta:
==: ItemMeta
meta-type: UNSPECIFIC
internal: H4sIAAAAAAAA/+NiYOBk4PZzCnHOz81NzEsp5mBgYGBkkAiPDMipDDaAKs1wykoJNvL3qSyziAi0tWUAAGLP5ZQxAAAA
While on new versions its
v: 3700
type: CHICKEN
meta:
==: ItemMeta
meta-type: UNSPECIFIC
custom: H4sIAAAAAAAA/+NiYOBk4PZzCnHOz81NzEsp5mBgYGBkkAiPDMipDDaAKs1wykoJNvL3qSyziAi0tWUAAGLP5ZQxAAAA
aka it changed from "internal" to "custom" and now items can't be fully recognized as "internal" section gets completely ignored. Any work arounds without a need to manually or via code to modify file itself?
I'm trying to retrieve transaction logs based on duration of the transaction happened, for example If I do /paymentlogs 5h, it will show transaction logs in the past 5 hours from that time. But I ran into an issue, I managed to convert 5h into a milliseconds and that value is used to find the transactions inside the database.
But for some reason even tho I put WHERE conditions in the syntax the SQL just ignores it, as you can see in the video I put 1719994286367 and transaction with timestamp 1719999792025 is still being picked up.
i don't get it? 1719999792025 > 1719994286367
anyone know how i can get rid of this part in the spawner lore?
Wait, let me double check it, smh.
just look at the 7th digit
Haven't got any sleep, need to refocus lmao
1719999792025 IS >= to 1719994286367
also 1719999792025 - 1719994286367 = 5505658 => 1719999792025 - 1719994286367 > 0
numbers ;-;
ItemFlag#HIDE_POTION_EFFECTS should hide that
Ah yes, so the result is already correct.
np
too many numbers i guess
yes
thanks i'll give that a try
does the question mark on the character look tacky?
thats really cool
ty ty
// Hide Random Lore Message
fakeSpawnerMeta.addItemFlags(ItemFlag.values());
Worked.
also just a piece of grammar but the plural is just Cows, not Cow's
but it also removes all the flags from visibility
that works too though xD
fixed thank you
weird question to ask but what do you all feel about a custom enchant that acts like lumber but for ores? I've already made a lumber enchant (Tree Hugger) but i was thinking about doing the same sort of thing but it mines all the ores in a vein
like veinminer?
?
ah
alright
just trying to build up a good lib of enchants for my custom enchant plugin
its SMP based so trying to think of SMP Enchant ideas
just fyi
mysql can do the conversions for you
if you weren't already aware
SELECT FROM_UNIXTIME(1447430881);
would match 2015-11-13 10:08:01
SELECT UNIX_TIMESTAMP();
allows you to incorporate timezones
but it also lets you convert too
SELECT UNIX_TIMESTAMP('2015-11-13 10:20:19');
would match 1447431619
but here is another way to do a conversion in a query
SELECT FROM_UNIXTIME(FLOOR(millis/1000));
only telling you this because its handy to know you don't need to incorporate additional code for conversions in regards to queries when something like mysql can handle it for you π
If I have List of Players and after Player leave and I try to get UUID from him (after he left) will it work?
yes but you cant get a Player object from an offline player
it will be an OfflinePlayer
but yeah uuid is unique for every player and cant be changed
I will just save UUID instead of Player obj
you should always be doing that anyway
holding references of Player will cause a memory leak
oof
I wasn't aware of that stuff before, thank you!
not only that but it can cause errors that make no sense from just reading them but are caused by said player objects
did it accidentally once and it took me two weeks to find the stupid mistake
is this the proper way to run a tick timer
task.runTaskTimer(plugin, 20, 1);
run every tick
and wait 1 tick
before running
yes, but it'll wait one second before running, not tick
yes
lol
:p
Is there any event for totem break?
EntityResurrectEvent
oh is there a way to change the item rendered in the totem animation? or is it all client side?
in which case can it be changed using a resource pack?
(apart from changing totem texture)
I dont remember but the item used in show in the animation, if you use resoursepack for the item then works, also not sure if you run the totem effect show any item in hand
hmm
is there api to just play the animation at any time?
like on another event or something
playEffect
which effect is it, I cant seem to find the totem one
TOTEM_RESURRECT
Can use customModelData but it has to be a totem
rught
and then it just takes the item in hand?
like playEffect does that look at hand items or how does it know what model data to use
Yep
i see
Pretty sure it has to be in hand
hmm, might be sufficient
Hold up you making my question myself lel
I think its a particle so should be possible to recreate in a resource pack anyways
only the trajectory might be a bit tricky haha
right I see
uh my interact event is running twice for items with vanilla functionality, how do I stop it doin that
i am jjst working on my minigane plugin but it would be so cool to play that animation for an item when you collect it
check the hand
Check the hand
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
i do
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND && event.getHand() != EquipmentSlot.OFF_HAND)
return;
the thing is tho, theres more return statements at the bottom, so it doesnt matter which hand it calls from, itll only make it to the bottom for one hand, and send the message
its not getting cancelled its just returning
but yeah this code should not be doing wnything
because I think those are the only slots it gets fired for
Yeah that code does nothing
its not the full code
public class PlayerInteractEventHandler implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND && event.getHand() != EquipmentSlot.OFF_HAND)
return;
Player player = event.getPlayer();
ItemStack itemStack = event.getItem();
if (itemStack == null || !ItemManager.isCustomItem(itemStack)) {
return;
}
Item item = ItemManager.getItemForStack(itemStack);
if (item == null) {
return;
}
event.setCancelled(true);
event.setUseItemInHand(Event.Result.DENY);
int cooldownTicks = ItemManager.getCooldown(player, item);
if (cooldownTicks == -1) {
Util.sendMessage(player, "&aYou used the item!");
ItemManager.startCooldown(player.getUniqueId(), item);
return;
}
int seconds = cooldownTicks / 20;
Util.sendMessage(player, "&cYou cannot use the item again for " + seconds + (seconds > 1 ? "s" : ""));
}
}
That snippet is enough to go off of
well the code "works", just runs twice when using fishing rod/etc
sir
you are returning at the start no matter what
That if statement does nothing
then explain this
Other way around
or is it opposite?
It will always be false
right
No, they are not returning at the start no matter what
It's just a waste of cpu cycles
my brain is bad at boolean logic, sorry
no im not
guys gitlab vs github vs bitbucket for private repo with 5-6 collaborators?
especially when it's inverted boolean logic
it returns if its neither of them
Depends you paying premium?
guys
free plan
think
I say github merely because I guarentee all of the calaberators
Git lab and girhub are both good options
since when does steve have a third hand
Git lab is good becuase of the CI/CD
Gitlab runners > github actions
yeah but it can't interact with thme
have you ever seen steve press left leg click?
ah shit i just pressed a button with my chest
lmao
totally works guys
Yes
feet walking over pressure plate?
that would be a phyiscal interaction
player.getFeet().tickle()
lmao
fine ill remove the if statement
if its https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/Action.html#PHYSICAL then ignore any hand specific code
declaration: package: org.bukkit.event.block, enum: Action
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
can't you get the item for the current hand and check for it?
check the action
btw
they are
event.getItem is the item in whichever hand the event is called for
i use that
LET ME SEND IMAGES
bro
ItemStack itemStack = event.getItem();
if (itemStack == null || !ItemManager.isCustomItem(itemStack)) {
?image
no
what was the command
imgur
ItemStack itemStack = event.getItem();
if (itemStack == null || !ItemManager.isCustomItem(itemStack)) {
return;
look
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
... space?
if only you read ahead an extra sentence
Are you storing the account on your computer?
use imgur or lightshot
lmaoo
Md pays this guy to host spigot forums
lmaoo
it will return on any item that isnt a custom one
and my offhand is empty
so its not running past that point
does isCustomItem work correctly
yes
could someone in dms give me a hand with a bossbar compass system ^^
even then if it didnt and made it past, itd still return on getting the custom item based on the stack
too much code and text to paste π