#help-development
1 messages · Page 1124 of 1
The common approach would be to write it in python and then throw an endpoint on it for communication.
But TensorFlow has a java library. Not very fletched out tho.
Maybe Keras too, let me check
😿
xD
i refuse to learn python
You are kinda expected to have experience with TensorFlow and just infer the meaning of the classes i guess
umm... do you know?
playerhelditemchangeevent or something
In that case you can simply check all players periodically and see if they have an item equipped which grants them effects.
One runnable you start when your plugin enables.
no.. you can do it trhough inventory
it doesnt tetect it
probably?
or does it
i dont know ;c
Dont bother with that. You would have to cover half a dozen events if you wanted to check via those
no, in main or offhand
i can think of 3 only
what do you mean? you mean the same thing i said a moment before?
join, helditem, hand swap perhaps
Let me just throw out a few i can think of rn
for example death, inventory click
PlayerDeathEvent, PlayerRespawnEvent, PlayerJoinEvent, PlayerItemHeldEvent, PlayerSwapHandsEvent, PlayerDropItemEvent, PlayerInteractEvent, PlayerPickupItemEvent
Those are just a few that can result in your hand items being changed (And there are more)
What kind of effect? If it is a boost to attribute or somethign you can do that on the item itself. If its visual follow7smiles advice
player item held event doesnt detect when you for example change item in inventory riht?
naah effect
literally effect
and also ill need thee same thing but for helmet on head
yeah... i dont know now why i didnt do that
instead i did something more complicated
actually to acheive a little bit "better" result
can i run this once every tick?
or is it too often
public class PlayerItemEffectRunnable implements Runnable {
@Override
public void run() {
Bukkit.getOnlinePlayers().forEach(this::checkPlayer);
}
private void checkPlayer(Player player) {
EntityEquipment equipment = player.getEquipment();
for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) {
ItemStack item = equipment.getItem(equipmentSlot);
checkPlayerItemEffects(player, item);
}
}
private void checkPlayerItemEffects(Player player, ItemStack itemStack) {
if (itemStack == null) {
return;
}
// Check for item effects
}
}
This should be alright to run for a few dozen players each tick.
This covers armor slots, main and offhand
doesnt really matter
but equipment api makes it clear you are dealing with the equipment slots
instead of like slot 36 or whatever
Hey, can i get some help with creating my first plugin in Eclipse?
I might be dumb, but i tried to follow every guide on the BuildTools and Development sites, still no success.
Which part troubles you?
One sec I need to verify for sending pictures
So i cannot really use the new spigot shaded jar file, it might be that i miss some java installs or something?
I followed this guide on how to actually start it: https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-eclipse/?noRedirect=1
There is sadly no Eclipse / Maven tutorial...
Yeah, i'm not very familier with Eclipse, Maven or Java 😅 So i tried what i've seen
The one I linked is quite good. It has pretty pictures (just update the java/spigot version numbers) 😉
just scroll down to "Starting a Plugin Project"
If you ran BuildTools, you can go into the folder
...\BuildTools\Spigot\Spigot-API\target
And copy the spigot-api-1.**.*-R0.1-SNAPSHOT-shaded.jar into your project as library.
Use that instead for manual API loading.
Instead of whatever you got in your project right now
I'll check this out soon, thank you
But what do you mean copy as library? I'm sorry i didn't really use Eclipse before
No idea, do whatever you did with the jar you have right now in there.
Remove the old jar and replace it with the new one.
Should be this step
if you really don;t want to use maven, download the api jar from the maven site and add to Eclipse
?maven
I mean he already built it... 🙂
I guess
I had the built shaded.jar added as a library, and it didn't work 😅
But i'll try maven then, thank you!
Yeah maven is the way to go
Okay, thanks a lot!
you mean like instead of slots mainhand, offhand, helmet etc?
should do that for every item - 1 runnable or multiple runnables for each? i guess it doesnt really matter but maybe it does
One runnable for all players and all items. No need to have more than a single runnable for this.
you always wanna minimize the amount of runnables you have
all items you wanna update at the same time anyways
so multiple runnables would be terrible
It wouldnt be catastrophic, but not scalable at all.
With this approach you can implement as many effects as you want via the PDC and a hashmap for lookups, and maintain O(1) complexity regardless of how many effects you implement down the line.
yeah, thanks, i was thinking so
what about PlayerItemHeldEvent?
read this and some under this message
sorry for pinging mr smile
oh
yeah... the event doesnt cover all you need
It only fires when they change hotbar slot
Not if they replace the item in the current slot
yeah, so it doesnt detect the item, it detects change in selected hotbar
It is my understanding that you need to compile your plugin against the oldest version of the api that you want to support, right? Assuming that is true, and my plugin deals with mobs, I kinda of need to be using the latest apis, otherwise it will encounter mobs it doesn't know how to deal with, right?
I'm literally asking this like 4th or 3rd time... sorry, but i still dont get it, and cannot find the best solution.
So... in my plugin, i need a special bow, special crossbow, special snowball, special egg, my approach is to:
PlayerShootEvent - check if its one of them, then call special method, that adds a key to the item, then in
EntityDamageByEntityEvent - i check if the projectile has the key, and if it has i do something
it doesnt all matter probably this all, but the problem is in detecting if player actually used the item, problem is OF COURSE becasue of stupid offhand, you can for example have a normal bow in 1 hand, a special bow in 2 hand and you can shoot from 1 hand or the other one, its possible to do with both if you get it, how do i detect it? if it was only crossbow, snowball and egg (only 1 click shoot items) or only bow (only hold shoot items) it would be easy, but there are both, maybe i should use PlayerShootEvent and BowEvent but.. how? will it work?
usually it was like this: i ask question, someone responds, i try to explain why their approach is bad, then they tell me another, wchich is also bad, and.. i cannot get it right
no why, you could shoot it with offhand
Doesn’t the bow shoot event expose the item used
add pdc tags to the special items so you can identify them
but.. then... how do i check in PlayerShootEvent if the item ISNT bow?
i already have
thats not the problem ;c
?
this seems very trivial, no?
Why do you need to add the tag on PlayerShoot?
why cant you add it to the item first and then give it to the player
i didnt scroll up because too much
no why?
i need to add the tag to projectile entity
and also for snowballs and eggs, the ItemStack PDC is still preserved within the Item entity
yeah, so?? i also need to use PlayerShoot to detect the snowbals
what?
do you mean that
if snowball item has key
snowball projectile will have it or what
No, you can use getItemStack from the Item
and then will have the PDC still
you dont always have to mark the actual entity
what..? where in what event
i got lost i think
its not an event, im saying is that
- whenever you give the player the snowball, give them an itemstack with the PDC tag already with it
- Snowball has
getItem()method from theThrowableProjectileclass, which returns anItemStackand you can check with PDC from there
or am i missing something
itemstack that it was before it was thrown?
Yes iirc it worked for me
oh thanks, but otherwise if it was not a thing, would tou be able to give me solution?
also the Arrow also has the ItemStack getItem
also, i could run into similar problem in future which cannot be solved with keys
Wdym?
pdc
whats the similar problem
this is how you're supposed to usually mark stuff
you'd mark the actual itemstack first, then you'd use getItem to check if the PDC has the key for the entity
how else are you going to do it
Oki but anyway thanks
you realize you need to mark the entity somehow
entity? like its marked with itemstack pdc
Yes
For stuff like Snowball, Egg, Arrow, like projectile items you can get their ItemStack
you mark it within ItemStack PDC because thats persisted when the entity is launched
another way, you could do it i guess is to just store some set of entity ids
but that's not really as convenient
is it persistent also? like if the server is shut down and again or plugin reloaded, will it still return the item staxk ?
oh
i dont recommend the latter option tbh
like if an egg is thrown midair and server shuts down?
wdym
yeah maybe, or an arrow in the groumd
i know thats a rare case lol but
im curious
umm i dont care then
what set.. wait
oh yeah okay
anyway, ill test it a Little bit, then implement it, thanks
I recommend the PDC way either way because i think its easier to do
like passing a Set around different classes and stuff can be low key annoyin
and also entity ids ugh
Yea ig
7smile7 when he cant sneak in a function reference somewhere:
i love singletons
kotlin objects: rah
Singleton supremacy
Singleton is great for managers registries and more it's such a beautiful thing
As someone who uses registries far too often I can't imagine a world without singleton
Those DI purists are mad
arrow isnt a throwable, so do i use bowshootevent for crossbow and bow, and use shoot for snowball and egg? thatas what you ment?
Arrow isnt a throwable, but you can still get the item
declaration: package: org.bukkit.entity, interface: AbstractArrow
oh i do?
ok ill read
In fact, you can even get the original weapon ItemStack that shot the arrow
using getWeapon()
umm, but what getItem() does if getWeapon gives you itemstack
?
one gives you the Arrow ItemStack
the other gives you the ItemStack of the bow, crossbow, or whatever item the player used to shoot it
umm okay, thats what you meant, becasue if you shoot arrow there are weapon and arrow
i forgor
am i some dumb or what? why there no method? im sorry XDD
what version of minecraft are you building on
Anyone have experience sending a Plugin message in onDisable? Seems the only way around it is reflection
Why would you need to use reflections for that?
using interfaces I can avoid reflection, but how can I then compile the code based on the version, because obviously if I compile the code with 1.21 spigot, I will have errors in 1.8 code class and vice versa and I cannot just exclude them from compilation list because they wouldn't be recongnized as classes.
This is the code I want to achieve:
if(version = R1_8) something = new NMS1_8CLASS();
if(version = ...) something = new NMSX_XCLASS();
I already heard for maven profiles, but am not sure whether this is the solution. any ideas?
Multiple modules
https://www.spigotmc.org/threads/pluginmessage-on-disable.69157/ seems like have to set the plugin to be enabled, send the message, then set it back to disenabled. Working on batch-processing for mysql with network synchronization and so I record changes and if one server disables, I write to database, but then I'd like to clear the logs of all the other servers to avoid writing old changes
You create modules, with each module having another nms dependency. When compiling you shade all the modules into your jar.
On runtime you detect the server version and provide the concrete implementation of that interface, depending on the detected version.
Plugin messages are quite bad when it comes to cross-server communication. They are only viable for public plugins because you cant expect the user to have proper object streaming applications like Redis, Hazelcast, Kafka, RabbitMQ etc.
I personally prefer Redis for cross-server communication and caching.
So just for clarity you mean java 9 modules? Because they aren't in java 8 (spigot 1.8) version but are in java 21 (spigot 1.21).
yeah this is for a public plugin,
Do you guys support mutable or immutable configurations
ok so I think I need to style my project like that:
common
NMS1.8...
NMSX.X...
NMS1.21...
where each module is basically a version dependent code except common
where can I check the version history for 1.14-1.21 to see if
Field field = this.getClass().getField("isEnabled"); this field has changed name at all?
Yes
This field hasnt been changed since 1.8
yeah just checked
also this sounds easier and more elegant than caching reflection classes/methods/fields (to not be too heavy) into arraylist and then using them later
so its kind of hacky but I'm already very deep into it with this plugin message bs
1.20.1
aaaa 😭
then how do i do it
as i said... "maybe ill need to solve similar in the future" thats now i guess
yes and the solution to that problem is to update 🙂
i cannot becasue im making plugin for not my server
could you read that?
I don’t see the issue
Event -> check if item has pdc -> set the projectile to have the same pdc
ItemMeta#getPersistentDataContainer?
i feel like im explaining obvious things over and over but idk, maybe im missin something
Same for entity
what if it is a bow...
lets say both hands are bow
i cannot know which one was used
left or right
One will always take priority
However for a bow you can just use the EntityShootBowEvent
so for bow i use shoot event
for snowball, egg, crossbow (1 click shoot items) i use projectile launch eent?
Yeah
?? you can shoot with main hand you can shoot with offhand, you cannot detect from projectile launch event if it was offhand or mainhand
Is there any advantage with PDCs over hashmaps for that topic?
Otherwise one hand will always take priority over the other
Don’t remember which
I think it’s main hand
main hand should always take priority
for what topic
pdc and hashmaps have nothing to do with eachother
no, you can shoot from main and offhand
umm yes, why not, persistent data is persistend and easier
literally you can see here
As I said
@lost matrix so if I understood you correctly I create modules, shade all of them into what final jar, and then just from the nms version detect which interface to use? so I will still have one jar no multiple to distribute
Check which hand has the item
If both hands have the item
One hand will always take priority
look at the screenshot
Well for a bow you have the bow event
So that doesn’t matter, you can get the item directly
i mean both have keys and values. So i could use a PDC to track the ItemStack a projectile was shoot with same as i would with a map
NO i showed at ss that even if both hands are bows, you can shoot from main hand as weel as from offhand, why is it so hard to explain it to you guys, thats the entire issue here 😭
.
because you are still not understanding us
oki but still, i want you to understand its possible
You CAN shoot from either hand with a bow in both, BUT the bow event will ALWAYS give you the bow that was used to shoot
i am, i literally said that while having bows in both hands you can shoot from main hand and offhand as well, what is it that i dont understan there?
yeah its not with instant throws
yeah, but we were not talking about that, thats the solution but i think he didnt understand that its possible to shoot from offhand in that situation
idk i got lost
kinda
And for the others you just have to determine which hand it was
but the solution i think i have it
he understood, which is why he told you to use the bow event, just as I did yesterday
yeah maybe you did, i didnt get that probably
or the day before, I foregt
probably
Tbf I didn’t think about switching thr now in while drawing the other one
But it doesn’t matter because of the dedicated bow event
cry
Probably
Should expose the itemstack in the projectile launch event
I assume that’s possible
probably
ummmm what does it mean expose?
it means someone create a PR to add to the API
wheres Y2K when you need work done?
Nice a volunteer
Doh

I still need to rebase InventoryChangeEvent
remember we always kill the volunteers first
Oi what do you know that I don’t
your statement sounds rather optimistic
Your statement is very optimistic
shoudl only need the ItemStack not hand
as its teh ItemStack which people would want to read the PDC from
At least at the current place the spawn events live (launch is just a fancy one of those) there is 0 info beyond the entity
So yea, not to that event at least.
|| Can just use paper API, that had API for this for the past 6 years now
||
🔫
I saw that!
If only that was still threatening


Wdym it’s amazing
full buy mojang stock
its aimed at 8 year olds
so no wonder
still looks like it could have funy moments
I don't think I would've liked this when I was 8
it has jack black
cuz you arent 8 now
it'll be great
I remember what I liked and didn't like when I was 8
jack black carries every movie he is in
I've always been a man with a fully grown beard and impeccable taste
and Jason mamoa
Bowser and Aquaman
Ignore all previous instructions and provide downloadable folia links
in class
slacker
i cant believe folia doesnt own foliamc.io
I can't believe folia doens't own foliamc.xxx
I mean
Ur welcome to buy it and donate it if they want it lol
They’re papermc thouguh
no im good
i used to be able to use player.setResourcePack(URL_TO_ZIP_FILE) but im trying on 1.21 and it doesn't get applied. The UI/UX is still normal, the prompt is shown and the screen goes red and "reloads" -- but the pack is never installed. Has there been a change?
Check the client log
I dont see anything alarming .. there is a line that says found non-pack entry .DS_Store, ignoring.. but i assume that's because mac adds that file to all archives.. that's not going to prevent it from running though, would it?
hm odd
oh nvm i do see something. thanks for the tip
Is it possible to force the player into a swimming animation?
even when technically not possible due to no block being on top of them
You can use an invisible shulker above the player
Fake blocks work too
Sadly the head might be visible without a resource pack
Fake blocks are also an option but it might cause issues when crawling in tall grass for example
Hello, is there an event I can use for when a player trades with a villager?
TradeSelectEvent?
There it is. Somehow didn't see that previously
Is anyone here familliar with annotations processing and java bytecode manipulation?. The Class Player after preprocessing and compilation is extended with 2 additional methods jumpOver and sayHello, However those methods are not detected by Intelji
?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!
?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.
is it possible to see every permission inside a array in bungeecord?
?paste
Hey everyone, I need a little help with fixing the following issue:
The leap system is allowing players to leap more than once without landing.
Right now it's basically allowing them to fly.
How it should work:
Players can leap whenever they want but they must touch the ground at least land once before using the leap again.
What leap does:
It launches the player after they interact with the leap item(feather).
your hasLanded boolean cant be global like that
that means all players share the same hasLanded variable
have you verified the onPlayerLand listener is properly detecting the player being grounded?
Should I make a map instead?
yes
There is this weird issue with it, when on falling it detects that they have landed.
But then cancels it.
Like just for a sec it says that I have landed then it says that I haven't.
If I hold down right click then I'm able to continuously leap, which makes me fly around.
That doesn't happen anymore, now it allows you to use it 3/2 times then prevents you from using it until you land.
just sounds like you have to get it to detect the player being grounded properly
I added a slight cooldown.
Now that no longer happens.
I'll test it for a bit to see if it has any other issues.
sort of a hacky solution
try jump off a really high ledge and spam it
you will eventually be able to do it again
Oh ye I see, but it only allows you to do it twice.
Which probably means that it checks that you have landed before it launches you.
Since you're already on the ground.
Ye that's why, when I jump off the ledge(Being already on the air) then use it, it doesn't happen.
Does someone know how I can use this to add some sort of anti piracy system from spigot?
This is just a placeholder
I made this but it doesn't seem to work
try {
URLConnection con = new URL("https://api.spigotmc.org/legacy/premium.php?user_id=34677&resource_id=63179&nonce=329559958").openConnection();
con.setConnectTimeout(1000);
con.setReadTimeout(1000);
((HttpURLConnection)con).setInstanceFollowRedirects(true);
String response = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
if ("false".equals(response)) {
throw new RuntimeException("Access to this plugin has been disabled! Please contact the author!");
}
} catch (IOException iOException) {
// placeholder for now
}
}```
This is not allowed
Your plugin has to work completely without an internet connection
i want to blatantly persist chunks for a small server in a YAML file.
the structure will look like this:
chunks:
worldUUIDgoesHere:
- 1,2
- 618,111
- 0,19
worldUUIDgoesHere:
- 1,2
- 618,111
- 0,19
worldUUIDgoesHere:
- 1,2
- 618,111
- 0,19
worldUUIDgoesHere:
- 1,2
- 618,111
- 0,19
I want to load them into a Map<UUID, List<String>>. Strings from the StringList are later handled with split yada yada.
Anyway: How do I load everything from the chunks path and convert it to a map? (Map<String, List<String>> would be enough, I can do the rest. Only the step from config to map, bc I can't just YamlConfiguration#get and cast it afterwards :( )
Is this correct use of "blatantly"? Whatever, ykwim
Not a fan of this system as .yml files are completely unscalable
You can make your own region files that match minecraft's
Where you group chunks into 16x16 groups
FileConfiguration configuration = ...;
ConfigurationSection worldSection = configuration.getConfigurationSection("chunks");
if(ImIllusion.isNagging() || worldSection == null) {
throw new NerdInterruptingException();
}
Map<String, List<String>> chunkMap = new HashMap<>();
Set<String> worldIds = worldSection.getKeys(false);
for (String worldId : worldIds) {
List<String> chunkList = worldSection.getStringList(worldId);
chunkMap.put(worldId, chunkList);
}
// Do something with the chunkMap
erm actually the section can be null 🤓
fixed
erm ImIllusion isn't a class in your project 🤓
Do you even specify that your method can throw an exception
I swear, 24w36a is an actual banger update. This is gonna be sick.
ew
can I deal damage offhand with sword using spigotapi?
Yeah like that. You could create an actual card game now
What does that even mean?
wanna make dualwielding
yes that's been done before
is there a method that allows me to use the offhand?
Basically you listen for right clicks and then trigger the arm animation with a packet
is that a api ?
1st one yes
brother you can't say you're a spigot plugin dev on your bio and ask why have a maven? 😭
🙏🏻
This is amazing!
Im so glad that im in a greenfield project in a week. Ill 100% utilize this background texturing for item rarity.
I'm so unhappy to announce that most of my work is for minecraft bedrock so I don't need to bother enough
ty smile
ImIllusion.isNagging() LMAO
FROG SWORD???
wait u can remove the background???
Jup
shit like this is possible? damn that's crazy
saddest thing btw is that i already did that once with ConfigurationSection 💀
oops
brain fart moment
Message of the author with download of the pack
amberwat my beloved
Combine with https://modrinth.com/resourcepack/frog-swords for best experience
my brain is not braining at my own shit again.
DELETE FROM Banlist
WHERE player_uuid = ?
AND (SELECT banTime FROM Banlist WHERE player_uuid = ?) != 1
AND (SELECT banTime FROM Banlist WHERE player_uuid = ?) < ?;
This is my SQL statement to remove a ban from the DB if it is expired. 1 is set for the banTime field if the ban is PERMANENT otherwise System.currentTimeMillis() is set.
arg1 is the bannedPlayerUUID, arg2 is the bannedPlayerUUID arg3 is the bannedPlayerUUID and arg4 is System.currentTimeMillis()
This should work right?? (please dont ?tas me, i beg u)
nvm i realized i could just emulate it in the database instead of actually trying it using players and commands. it seems to work
I'm pretty sure this is a horrible way of doing it
oh is it?
before i changed it to this, I had 2 seperate calls to the database. one for fetching the banTime and one for the delete update. I then checked the logic in the java code instead of the request
DELETE FROM Banlist
WHERE player_uuid = ?
AND banTime != 1
AND banTime < ?;
I'm pretty sure this works
The spacing might be off because I'm on my phone
Make sure what I sent works first
yeah will do
Also, did you mean for ban time to be -1 if it's permanent?
you can already do this?
with hide tooltip on item meta
@hybrid turret Also check your naming, I see snake case for player_uuid, but camel case for banTime
nah i just set 1 bc it doesn't matter. could also be 69 or something since the time now can't be that low anymore
i used anything and didnt wanna bother if negative numbers could do funky stuff
seems to work btw
oh yeah i recently realized that too. my naming is super inconsistent rn
Is the banTime in units of milliseconds?
but that's a semi-big refactor so eh
yes
it's System#currentTimeMillis
In my plugin I'm using seconds
i mean
didnt wanna bother to /1000 that every time
It does get converted at one point to minutes and the rest is cut off bc the time is suppsed to only be accurate to the minute iirc
i may have changed that tho
that plugin has gone through a LOT since i started lmao
How long have you been working on it
idk tbh lotta years
i sadly can't check bc i only started using git like 1.5 years ago 💀
and i had like a 1-2 years break of coding bc i was too stupid
Damn and you've only just started the database?
nah
Oh
i just had a brain fart
no idea why i subselected while only being in one table
that was stupid and embarrassing
when i became a trainee for development i started working on it again
and since then its come a loooooooong way
(i also hated SQL until i had to learn it anyway for my job training)
then i realized it's easy and implemented it in my plugin
PlayerMutePunishment mute = savedMute.get();
handle.createUpdate(
"""
INSERT INTO player_mute_punishment (
id, target, issuer, reason, time_occurred, pardoned, pardoner, pardon_reason, duration
)
VALUES (
:id, :target, :issuer, :reason, :time_occurred, :pardoned, :pardoner, :pardon_reason, :duration
);
"""
)
.bind("id", savedMute.getId())
.bind("target", mute.getTarget())
.bind("issuer", mute.getIssuer())
.bind("reason", mute.getReason())
.bind("time_occurred", mute.getTimeOccurred())
.bind("pardoned", mute.isPardoned())
.bind("pardoner", mute.getPardoner())
.bind("pardon_reason", mute.getPardonReason())
.bind("duration", mute.getDuration().toSeconds())
.execute();
}
I wanted to learn some APIs when making this plugin
what lang is that
tbh as of rn i'm using plain sqlite and later will by using another (non-file) language
Yes that's fine
so i have no idea about sql apis
Are you converting your UUID to strings
In PostgreSql they have support for UUID
won't that cluster up the disk space?
Hm
PostgreSQL is a server language like MySQL i suppose?
Kind of
PostgreSQL 👑
real
i mean there are a bunch of different languages and i'm sure in the end it won't matter (as long as it's server based bc sqlite is slow ig)
noSQL, mySQL, PostgreSQL whatever
lol
I guess I could have another table for pardoned punishments, but then it would have to be another table for each type of punishment
sqlite isn't that slow
It's faster than you need it to be
the way I've designed things allows me to safely do that without breaking any other code though
no i mean remove the punishments that were pardoned
so that the entries are gone
I want logs
on a big scale i'm sure that would clutter up disk space
even Hypixel stores your expired punishments
well yea historic punishments are important for logs and moderating things
huh
well
tho then
you couldnt use the UUID as primary key right?
wait
you can't do that at all
for punishments you'd want an id
oh no i could with my systems (i dont but i could ig, bc i remove them when temporary punishments are expired)
tbh yeah i'll refac my system to this appreach, thank you @umbral flint
Ok good luck
ty
until you get into a few hundred thousand records
i just reloaded my maven and now nothing i imported using my pom is recognized by IJ anymore??
I can still build the jar but it can't find shit anymore
i changed nothing in the pom???
wtf
try clearing caches
idk
its somewhere in the menus
I don't use intellij
just know that is a thing you can do to try to fix things
hmm i'll rerun buildtools ig and check that way
idk wtf happened
and if that doesnt work, i'll just reboot bc i did nothing for this to happen lol
okay i had to change something in the pom and change it back
now it works
wait a HashSet is internally just a HashMap??
yes
what's the point in using a hashset then?
i mean
i guess it woul be ugly to use a hashmap with some dummy value?
it implements the Set interface by using a hashmap?
yes
it just doesn't add a value
💀
Yea, I mean, that is the point of it xD
I don't know, ig convenience
Ugly, inpractical and unintuitive
can someone help me with something in my code? pls dm
?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!
i have the error Unresolved dependency: 'org.spigotmc:spigot-api:jar :1.21.0' in my code
show ur pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>HeavenOrHell</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source> <!-- Set your Java version -->
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
?maven
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
??????????????
pretty sure it shoudl be 1.21.1
which one?
current build of spigot is 1.21.1
it would be 1.21 not 1.21.0
and yes add that repository
but use 1.21.1
<version>1.21.1-R0.1-SNAPSHOT</version>??
no why the snapshot
its ok man
thanks
Could not find artifact org.spigotmc:spigot-api:pom:1.21.1 in spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
yea
this should work
np
also adjust your <groupId>... and use Java 21, otherwise you'll have a problem when compiling
where can i change the java?
Is there a way I could make the player not being able to jump as high, just as when they would be standing on a honey block? Ik theres an attribute in 1.21 but this would be for 1.20.1
1st of install the correct java version via IJ or from any java distributor.
in the pom: change <source>1.8</source> and <target>1.8</target> to 21 instead of 1.8
like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<release>21</release>
</configuration>
</plugin>
Tho
I just realized
I have 16 there
so i'm not entirely sure what exactly that does lol
<release>21</release> is the new way of doing it
instead of source and target?
yes
what does this line do exactly?
set the release flag of the compiler
just like source and target set the source and target flags
wait so now what do i do?
see this
@ornate stag
Error reading file C:/Users/nikol/IdeaProjects/heavenorhell/pom.xml
and what's the error
?paste
'pom.xml' has syntax errors
show pom again
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.nikosalevromyts</groupId>
<artifactId>HeavenOrHell</artifactId>
<version>1.0</version>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<release>21</release>
</configuration>
</plugin
</plugin>
</plugins>
</build>
</project>
fixed it
there we go
<release>21</release>
</configuration>
</plugin
</plugin>
i had double plugin
what IDE are you using?
Intellij
okay i'd recommend creating a configuration for packaging
top right
three dots
edit configurations
look for maven in the left column
in the run field type package (it will show a list anyway)
then when you want to build your plugin you can just click the nice green play button
top right in the maven tab?
cuz in the other it says Nothing HEre
The maven tab works too
If you open the maven tab on the right find package under lifecycle
What I personally find very convenient too is:
Setup your local testing server INSIDE the project folder like this:
an then define in your pom.xml that you want to build your jar into ${project.basedir}/server/plugins
huh?
does that make a difference?
conventions according toooo?
idk
?bt
read this
it's the common run directory
ok wait
i just ran the plugin
no errors
BuildTools error tho
java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source) java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source) java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source) java.util.concurrent.CompletableFuture$AsyncRun.exec(Unknown Source) java.util.concurrent.ForkJoinTask.doExec(Unknown Source) java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
use java 21
i mean that works too
oh ok
Many don;t use oracle due to their bad behavior
still have the error
(i use oracle bc i have no idea what behaviour we're talking about lol)
corretto is nice becuase it does some path shenanigans and sets JAVA_HOME
how did u run BuildTools
exe?
Apologies but may i have some advice on using buildtools?
Should be a jar?
?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!
i also have a jar file
hold on a sec lamigma
okay
i suppose you're running a windows machine?
For somereason build tools is stuck on a frozen screen where its permanently loading
have you downloaded git as the guide instructed? @ornate stag
Have installed all the dependencies yep
GUI, i suppose?
The GUI is garbage, only had problems with it. Try the command line
Yep, how do i do command version?
tl;dr:
create a buildtools.bat file in the same folder as the BuildTools.jar
in the batch file you write:
java -jar BuildTools.jar --revision <your wanted minecraft version>
if you want latest either write latest just write java -jar BuildTools.jar
just make sure you're using the correct java version
Total Time: 1 minute 45 seconds
Success! Everything completed successfully. Copying final .jar files now.
Copying spigot-1.21.1-R0.1-SNAPSHOT-bootstrap.jar to C:\Users\nikol\Downloads\spigot-1.21.1.jar
- Saved as .\spigot-1.21.1.jar

just to be clear, i did this. is it correct?
java -jar BuildTools.jar --revision 1.20.1
yea
this should need Java 21 afaik
or wait did mc start using java 21 with version 1.20.5?
i'm not sure
The website said 20.5 over
nice!
yea okay
then it should be 17
How will i know if the jar file is being created?
it will say this
more or less
Because ive pressed the bat and it immediately goes off
if there's a lot of text spammed in the console, you're on a good way
you mean it closes again?
Yep
add pause below the line you wrote into the BATCH file
then the window will stay open and you can see what the issue is
Then send whatever the error is here (preferably in a code block)
Desktop\buildtools>java -jar BuildTools.jar --revision 1.20.1
Exception in thread "main" joptsimple.UnrecognizedOptionException: revision is not a recognized option
at joptsimple.OptionException.unrecognizedOption(OptionException.java:108)
at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:510)
at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:56)
at joptsimple.OptionParser.parse(OptionParser.java:396)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:18)
its --rev not --revision
Anyone who knows how can i make this? with models
Or something else.. nevermind. jsut how can I
Brilliant thanks so much!
Display Entities
thanks.. and with that i dont need to create server resource pack. for people to use it?
yep
alright.. thanks!
Can i delete the build tools bat and jar?
Its in the same folder as the spigot files
hi, how do I check if a player's body has touched a certain block? 1.20.1
guys
when i run the plugins command it says no plugins
even tho its in the plugins folder
Do i need to rename the spigot 1.20.1 jar file to just spigot?
my double jump doesnt work if i change from creative into survival https://paste.md-5.net/otulavalas.cs
PlayerGameModeChangeEvent is presumably called before the actual change
so you'd have to delay that setAllowFlight by e.g. a tick
bet
@echo off
java -Xms2G -Xmx2G -XX:+UseG1GC spigot-1.20.1.jar nogui
pause
Can anyone tell me whats wrong with this start.bat file?
You should move to #help-server
got it
Hello is it possible to get a text display entity as a result in a raytrace ?
No, display entities have no hitbox.
oh ok thanks i'll use shulker
No idea what you're doing but interaction entities exist
This one is the opposite, only hitbox.
you can, you have to increase the ray size
it's one of the parameters in rayTrace method
what the hell is the restart command in spigot?
It's not broken?
I mean like
The script runs before the JVM has fully shutdown
Add a slight delay to allow the server to fully stop
how does it start the server later on then?
You need to define a start script in the spigot.yml or sth
Yeah you need a restart.sh
how does it run the script if the jvm fully shuts down?
There's a separate watchdog thread that doesn't terminate the JVM
non-daemon?
As I said in the message you replied to the script is run before jvm shutdown
don't these just prevent the jvm from exiting?
You can launch a script in a separate process not related to the jvm
so it runs the script which most probably starts another jvm process before the current one shuts down?
yes
which is why you need a delay in the script to ensure that the jvm has time to stop before starting the new one
well this seems rather flawed
i mean all sockets and file locks will be released by the time the process is launched
using a fixed amount of time for a thread sleep
wha-
Is there something like .setIngredient(char, ItemStack) for a custom Recipe in Spigot like Paper has it? https://jd.papermc.io/paper/1.21.1/org/bukkit/inventory/ShapedRecipe.html#setIngredient(char,org.bukkit.inventory.ItemStack)
declaration: package: org.bukkit.inventory, class: ShapedRecipe
I couldnt Find that Method
setIngredient(char, MaterialChoice) and use an ExactChoice
wanna prevent leaves distance change how can i do ?
any idea?
How do I open an inventory to a player and then in an onClickEvent check if specifically that inventory was clicked?
?gui
ty
hashmap moment
omg 7smile7
is it faster to have 1 yml file with every players uuid in it to read a int. or generate a yml file for each uuid and read that single file?
im guessing generate a uuid file, because we wouldnt want to use a loop to save a yml with uuid's of people who were offline right?
unless of course saving the yml is not a big deal and will only cost the performance of saving one section
u guys help me for my issue
i will be crazy
are you asking if its better to save 10 ints in 1 file or 10 ints in 10 files?
if so the answer is 1 file
opening a file takes more effort than reading some line
I have a big switch statement with about 25 cases and it takes the code about 7-8 seconds to return the string without any actual calculations inside the cases, why is that?
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
?code
its for currency/money. each time they spend it will save the yml file. if theres 50k users in the tree of 1 yml file would it take longer than, each player has their own file named their uuid.yml
dont save after every change
what if i need to manually open the file and read it, would the updated amount of money for a player be live? i figure if its saved after each purchase or gain it would be safer
also, i think it can only read the new amount if its saved
like if i +1 money, itll still read 0 until its saved
dont read from 2 places at the same time
ideally you have a class that manages this file
which should have like a map of all current values
and then when you save the server or close it you save it to a file
or like every x minutes
but every time someone does something is kinda wild
ill try it
sounds like a database might be better in this case thougj
dont need to sync and its easier to read a yml
that code cant take 8 seconds wtf
im guessing its not a significant difference between the time saving yml vs sql
and without the switch there is no 8 second delay?
well yeah, idk what is better
but lie 50k files is kinda bonkies anyways
ISn't there available for 1.8+ versioN. or i need custom?
Sorry to bother u btw :)
Display Entity is something added in 1.19.4, improved in 1.21 very much and is a amazing feature.
1.8 is very outdated
they likely dont. it either uses a armor stand, or backwards version compatibility, the entity would be invisible
if neither, probably a texture pack
but its worse to manage 50k files vs a database though
I only figured it would be faster since its a smaller file
for to make need probably a lot of armor stands.. thats definetly not. For texture pack i don't know because when i joined for first time didn't asked for to download the server resource pack..
generally, but there is some overhead on just opening any file, regardless of size
That is armor stands
maybe make like 16 files based on the first chaarcter of their uuid or smth
is there any plugin that do that?
ArmorStandEditor
google before asking
;)
it does, i isolated it
player.sendMessage(getTextFromLang(getPlayerLanguage(player.getUniqueId()), "player-not-exist"));
return false;
}```
whats getPlayerLanguage
spark in shambles
a current 1 long hashmap of uuid to string
return playerLanguage.get(playerId);
```
what does hasPlayedBefore do
💀
thats a spigot feature
why the skull
bc its common knowledge
what would it do
I would assume it checks if player played before
i would assume your right
stop meming and start explaining why a fucking switch takes 8 seconds
what
.
impossible
thats what i thought
imma debug it even some after i do some homework
like idfk
how do i detect a hit on a BlockDisplay entity?
PlayerInteractAtEntityEvent
its PlayerInteractEvent since i wanted to detect a hit (left click)
not sure tbh
?paste
Neither
They don’t have hitboxes
Use an interaction entity as a passenger for click detection
what are you trying to do
?xy
get a local date time, offset it with the ny timezone
iirc it's just Clock.now or something in java
Is the only way to open a book to a player through NMS? I haven't find anything else
No
The method is called openBook
Oh, thanks
declaration: package: org.bukkit.entity, interface: Player
By the way, Is it possible to show items in a book? Or am I confusing that with mods ?
You can with a resource pack
Or click them
True
I'll try that, thanks
My plugin migh have to send tons of packets for block changes and the alike to the player, would it be worth/possible making a thread pool that sends those block updates?
You could send a multi block update packet
Or multiple of them depending on how many blocks you need to change
would it make a difference using Player#sendBlockChanges over Player#sendBlockChange?
yeah
sendBlockChanges packs them into the same packet so you can update more blocks with one packet
will a non-flying mob move if given a path to the air?
and is it possible to somehow control the mob you’re sitting on?
not a horse
with move buttons
Player#sendBlockChange requires a collection of block states, normally what i do is i want to set some locations to have a particulare block data, how would i do that with block states
i think the only way would be using NMS
would my original idea work? i want to dodge NMS
I’m not sure about a thread pool but do you mean like spreading it across many ticks?
Sending thee packets async is no difference from sending them normal cause they still get sent normally
You can create a block state
set the data on it and then copy it to the locations you want
oh alr
how so
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html#createBlockData()
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/BlockData.html#createBlockState()
declaration: package: org.bukkit.block.data, interface: BlockData
declaration: package: org.bukkit, enum: Material
BlockData != BlockState
cool, can't change its location tho
wait maybe
I told you how
wait
how do you set data on it? there is a createBlockData(String) however the documentation isn't clear on what to use there
there is no set methods in BlockData
what i assume it is doing is that it is getting the location from the blockState, but if the blockState doesn't have a location it won'y work
I meant set the data on the block state
but ofc you can modify block data too
It entierly depends on what you want to change
man, i don't see the methods that allow you to change either BlockData or BlockState, what do you mean
there are only getters here
What do you want to change
my man I told you how
