#help-development
1 messages Ā· Page 934 of 1
Switch statements š¤¦
Is that gitea; awesome
a Minecraft server, written in Bash
Some people have far too much free time
I remember seeing a writeup on it on HN before
We could just compile spigot to native binaries with Graal, no?
You could but plugins?...
"can somebody help me? heres my code:" ```bash
function timer() {
while true; do
if [[ $time_left -le 0 ]]; then
pos=$(cat $TEMP/players/$nick/position)
pkt_effect $(awk -F, '{print $1}' <<< "$pos") $(awk -F, '{print $2}' <<< "$pos") $(awk -F, '{print $3}' <<< "$pos") 1032
sleep 1
break
elif [[ $time_left -le 5 ]]; then
sleep 1
pos=$(cat $TEMP/players/$nick/position)
pkt_effect $(awk -F, '{print $1}' <<< "$pos") $(awk -F, '{print $2}' <<< "$pos") $(awk -F, '{print $3}' <<< "$pos") 1000
time_left=$((time_left-1))
elif [[ $time_left -le 10 ]]; then
sleep 5
time_left=$((time_left-5))
else
sleep 10
time_left=$((time_left-10))
fi
if [[ ! -a $TEMP/players/$nick ]]; then # die if disconnected
break
fi
pkt_chatmessage "§aTime left: §r${time_left}s" "00000000000000000000000000000000"
done
pkt_disconnect "Time's up! Your final score: §a$(cat $TEMP/players/$nick/score)"
}
Wonder if hypixel does that
can i use this "§" instead of ChatColor?
Probably not. Something as dynamic as a game is quite difficult to not fk up with graal binaries.
There is no garbage collection, so everything needs to be statically analyzable at compiletime.
What? Writes all software in Shell?
You can but you shouldnāt
Because that'd be so masochistic and awesome at the same time
surely
Nah graal
oh lol
well because i want people to be able to change the messages in config and choose the color
use some serializer
the graal substrate vm does have a gc
You should use & instead and translate that into the section symbol
Thatās why you use & and translateAlternateColorCodes
Or minimessage or minedown or whatever
uhh
ok buddy
?services probably
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
But thats useless for compiled binaries which compile to llvm bitcode
Its only viable for running jvm bytecode or javascript, R etc
Hypixel actually runs in web assembly
It runs in javascript. Without node. Some poor guys just have a blank website open all the time which run all the servers.
just compile your entire server including resources and plugins to an exe guys
š
I wonder if any of hypixel is in Kotlin
probably not
Or Scala
groovy
Honestly i should look a bit more into Graal and do some benchmarking with it.
Just to see if has general benefits over an openjdk for example.
Fun fact: It's actually a web applet
(/s)
Knew it
buildbattle.war
Choco can you disclose if there is any Kotlin usage?
buildbattle.bat
Dont tempt him
I can probably say that the job listing doesn't require any Kotlin knowledge
So, do with that what you will
fair enough
Fair enough
to be fair, being a java dev and going to kotlin isn't hard
NO not kotlin
why are docs to annoying to make š
haha
how do i make this in a gitbook
I would be astonished if a big project actually decides to use Kotlin. The language is so scripty, i wouldnt want
a bigger team to throw their infix and extension garbage into every corner of the code.
explain
this thing
mcc and mcci
Would it not just be `this` in gitbook as well?
blah
It's just Markdown so
yeah
you can write ```java
this
```
and whatever
I'm positive gitbooks has language highlighting
Depends on the installed style. But it has on default.
fail
hm?
//test
every native image includes a substrate vm, it doesn't compile everything ahead of time
I wanna compile the spigot server with Graal now
it's probably possible without too many drawbacks
i didn't even make alot of actions and i spent an hour just writing player actions
I mean reflections are just dead -> Plugin loading will not work. Anything that does classpath scanning wont work.
Serializations based on marshalling wont work.
Thats what i imagine the drawbacks gonna be.
No plugin loading seems like a bit of a drawback
datapacks >>
Aaaand it died. Motivation gone. Im gonna do something else.
Datapacks should load as long as you have IO
Any way to add hearts to the player but not show it past 2 bars? (1.20.4)
since they're all data driven
Use the wacky health scaling system
Player#setHealthScale()
Couldn't we theoretically rewrite it a bit so it will compile with the plugins inside or something
Shure you can just add your plugin as a dependency and shade it in.
Just need to find a way to run your onEnable and onDisable without the plugin loader.
mixins /j
Or dont use JavaPlugin at all, since you are writing code directly into spigot in the first place
I bet every second plugin that uses mixins would just break all the other plugins
pretty sure the mixins in mod has a solution to that
Well yes there is some effort to make 2 mixins to the same method not conflict
It's called not using seven layers of abstraction (spigot api)
But that doesnāt stop people from being dumb
loading order and mixin weight system could possibly be a solution
We need some kind of nms plugin system
highest weight applies the mixin if it conflicts
I think that'd be cool
What does that even mean
im ngl fabric devs seem so much smarter
Mixins are nice
You use nms instead of api, and some kind of solution so it doesn't die every version cuz relocation and obfuscation
if 2 mixins conflict it sees the 'weight' of the mixin for each of the plugins and the highest 'weight' applies
if both are equal then it just picks whatever plugin loaded first
Mod dev intelligence is above plugin dev intelligence
random
imagine spaam restarting the server for that one plugin to work properly
š
Lmao
LGTM
Feeling cute might mixin Player.getItemInMainHand to always return a potato
šæ
That sounds like the most mixin shit of all mixins
so real
they could limit mixins to only add code and not modify the return value
to head or tail
Then they are pointless
u got a point
I always wanted to make cos always return 0.4719154
but this wouldnt be cool
mixin to the bukkit class so it returns null for everything
mixin getServer to return null
and getPluginManager
watch 500 exceptions of plugins trying to register listeners
mixin JavaPlugin so you cant getconfig and similar stuff
honestly adding a plugin from a dummy can do abunch of stuff anyways
they can break a plugin with reflection
they can break the entire server already so mixins wouldnt be that bad
I think I broke something šhttps://imgur.com/a/xV9TNNV
exactly my point ^
My command aint working
mixin so the server owner cant do anything š
put the command in plugin.yml
and has a diff name
bukkittask ban the owner
Uhhh I don't have one
bukkittask ban everyone with perms that isn't u
add
commands:
commandName:
description: description here
permission: add a permission if needed
usage: usage here```
to to end of plugin.yml
if u dont want a permission u can remove it
it's better to delcare permissions properly
Why tf are those even required in the plugin.yml
infact i do that for test commands all the time
Like, what made bukkit devs think people should hardcode their commands into fucking yaml files
you technically dont even need to put it in plugin.yml but it's better to than messing with command map
AFAIK ACF does that
why cant u just make a command executor class with getPermission, getUsage, getPermissionMessage, getDescription and register that
Yep It works now
Yeah there are plenty of frameworks to do it without plugin.yml
try ACF
how do you sent colors in console?
to avoid bugs
brigadier?
you dont
you can do getLogger().warning
or .severe
.severe is red but .warning is better
this actually works for me (pterodactyl)
You can with ConsoleSender
yeah
So long as your console supports colours
most likely not
colours in console are a bitch for logs
honestly dont even tell the console itt cant run that command
most plugins dont pretty sure
i personally dont, it's pointless
Better than just doing nothing with no message
if ur command for example opens a gui, what is the console expecting
is there a pathfinder so that the entity does not move further than a certain distance from spawn?
nms
yes
or use listeners and teleport the entity back if it got too far
but is there such a pathfinder?
kinda, but it's dragon logic
cant wait for his skeleton to fly
this applies to husk zombies?
?
Well it now gives me the usage and shows the command but the command doesn't work
and now my loop is broken
uh how do i fix /untitled in gitbook
well, you know, for them such a target/goalselector?
or I can't avoid creating my own
I donāt think thereās any that will work out of the box
Whats the link
?past
?paste
?paste
fml
Main.java
https://paste.md-5.net/mucakujite.java
SetMaxHealthCommand.java
https://paste.md-5.net/tuyiluleka.java
plugin.yml
And this is the console msg
Idk what I did wrong so
You misspelt the command in your plugin.yml
damn lmao
Now it works š
Well now I have this
It doesn't do what I expected very nice
Yea I figured out why
How can I avoid numbers showing like this?
nms pathfinders. how to cancel the move of an entity through getNavigation?
§r or just give them a white color
§f
they mean the number format
I mean, the price
oh xd
yea
Use the NumberFormat class
But it doesn't allow more than integer limit
or DecimalFormat if you want decimals
At least what I tried
DecimalFormat should allow that
I'll try that thanks
Uhhh the maxhealth variable isn't player specific
However I was looking to show numbers like 3k 5m or 7b is that possible with decimalformat? I was using numberformat and it worked, but not for more than integerlimit
Use the players attributes to change their max health
I've always used my own method for that
Specifically attribute.GENERIC_MAX_HEALTH
There's probably a better way to do it though š¤·āāļø
That's how I've been doing it, not sure there is another way
Yea, I was told that, i'll try that ig
I'm trying to use like a custom one tho.. like the one hypixel uses in skyblock
how do i check if a crop is grown from a Block object
declaration: package: org.bukkit.block.data, interface: Ageable
can that be used to check if a block is a crop
There is actually a formatter for that in newer java
Would be more performant to check the material yourself
CompactNumberFormat
wait wouldnt CropState work as well?
They create a custom object for each player and then map it to their uuid
Or something similar anyway
oh nice
an error is saying that this message is null:
sorry for the question, but something like this would work? Xd
String pattern = "##.#";
DecimalFormat decimalFormat = new DecimalFormat(pattern);
if (money >= 1000 && money < 10000) {
String format = decimalFormat.format(money);
} else if (money >= 10000 && money < 100000) {
String format = decimalFormat.format(money);
}```
Guess it's null then
but i set it here:
did you set a wrongUsage field
^^
I assume EasyBanGUI is the plugin and you're looking for the static field
yeah
and when is that called
it would be nice to see more than 1 line at a time too
and maybe as text
?paste pls
this is my main class https://paste.md-5.net/sofokeviqo.java
i think so, kinda new to java tho
alr then stop the static abuse
Aboose
reminds me when i was so noob i used to abuse static :p
static abuse is using static when you shouldn't
how should i be doing it then?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Use di
but doesnt it work either way?
Ideally you'd split things up in to more classes
is this what you call static aboos
Yes
Yea
i have way more but i wont go over it
more like companion object abuse lol
ill do that after but why is the message resulting as null?
is this better? (other project)
you can move JSON & RESOURCE_PACK_URL to the top level of the file
its like a "trust me bro" sorta thing
that's because you're never loading your messages file in to the messages variable
You instead create an empty config
and then load the file ignoring the result
and how do i do that?
Use the loaded messages file
save it to the messages variable instead of ignoring it
like this?
no
is it bad for performance
why would it be
then why shouldnt he
why do you want errors in your console for that
if it fails to save the config
how do i then?
ooh i didnt know throwing an exception would shutdown the server
It doesnāt
is it a runtime exception thing?
Unless itās in a critical part of code that triggers a crash
oh so throwing a runtime exception after failing to save the file would cause it to shutdown
It shouldnāt
wut
catching an error and throwing another one also isnt good
Itās best to log a message and then either disable the plugin or do something to recover
at that point just dont trycatch
@chrome beacon i dont really get how im meant to do it
should i be changing createCustomConfig();?
yes
any clue lol?
What part of your code could do this
createCustomConfig(); creates and empty config right?
sweats 
because im not giving it the file?
sort of
because youre not giving it a loaded file
^^
you called?
wrong slime
so i gotta change something here?
private void createCustomConfig() {
messagesFile = new File(getDataFolder(), "message.yml");
if (!messagesFile.exists()) {
messagesFile.getParentFile().mkdirs();
saveResource("messages.yml", false);
}
messages = new YamlConfiguration();
YamlConfiguration.loadConfiguration(messagesFile);
}```
yes
fOr ThE 500tH tImE yEs HeRe
Try asking better questions
you've asked the same thing like 3 times now
If you can't find the problem try explaining row for row what the code does
so it sets messagesFile to messages.yml
then if it doesnt exist it creates it and saves it
then it makes messages a yamlconfiguration
wait the probems here
mhm
oh yeah oops
so it loads a new configuration(messagesFile) instead of loading it from messages?
?
You're loading the messageFile and doing nothing with it
if that's what you're asking
more like doing nothing with it then loading it?
no
oops sorry
messages will always be an empty config because you're just making it an empty config
instead of using the loaded one
youre not using the one you need to use but instead making an empty one
i got it!
Not quite what I had in mind
messages = YamlConfiguration.loadConfiguration(messagesFile);
YamlConfiguration.loadConfiguration
Doesnāt throw any exceptions
Actually I think it can still throw invalid
But not io
oh ok
how can I get amount of lines in TextDisplay?
You can use a regex to count line breaks
like it? and than .length?
Does the line break even get added server side
It's just a string?
What do you think about SmartInvs? It's good to use or something else?
or am I missing smth
I know you can manually add line breaks
But you can also just set a size for it to automatically break
I guess it would be a component and Spigot doesn't expose that
ah didn't know that
Idk if the breaks are added on the server or the client though
Never used them
If transfers are made automatically there, then I canāt find out? or how?
bump
The heck is smartinvs
Why?
how do i make an api for a paid plugin without accidently giving free access to the plugin
is it related to development?
it seems like it updates the invs every tick
It's a library I think
i wouldnt use it
Split the API out from the main plugin
to it's own module and jar
then how does the api interact with the plugin
Your plugin contains the api
guys do you think i should make my own placeholderapi?
no fork my own plugin
PlaceholderAPI with Component support
making a placeholderapi doesnt seem to hard, or is there anything i might have overlooked in terms of how hard it can get to create one?
The hardest part is getting people to use it
im not planning to publish it, i just wanted to create it myself so i dont rely on a plugin
Then no it's not hard
I mean papi is kinda standard, can't see reason to not rely on it
Im trying to shade BoostedYaml into my plugin but i get this error when building https://pastebin.com/7jitAWr4
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
why boosted?
try updating maven-shade-plugin
a friend told me its easier for begineers
wdym?
he lied
i just like how boostedyaml is
fork me over your pom
Snake Yaml that is already bundled with Spigot is simplest to use
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Update line 33 to 3.5.2 (latest version of maven-shade-plugin as per https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-shade-plugin/)
Consider updating the other plugins too if you are already at it and they aren't updated yet - I don't know the latest versions from the top of my heart though
reloaded maven
Flush caches and restart the IDE
the other plugins are on latest
how do i flush caches?
Unless you provide me with a good enough log it's an IJ issue and not something I can support you with
what other stuff do you need?
Just restart the IDE
Else, wait until some IJ fanboy arrives. Here, I'll summon them for you: Eclipse is the best IDE ever
intellij is full of bloatware and is good for begineers like me
Oh, and don't duplicate the maven-shade-plugin entry
why does maven even allow that?
Does it at least build regardless of it being hinted as invalid?
nope
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
What is the build error?
that is using the old maven-shade-plugin version...
what pom are you using right now? This shouldn't be that complicated
In fact, shading in maven is miles easier than in gradle (though you give up quite a lot of control in the process)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Remove lines 51 to 63, they are redundant
done
Why that is a valid POM is beyond me, but I suppose it has to do with how maven evaluates super-POMs being a bit too hacky which ends up being all too lax
Does it build now?
it did
lemme try and do something with boosted yaml
and see if it acctually shaded
Great, you may need to restart your IDE though.
Also, it'll shade unconditionally so you can simply look at the filesize and if it is inflated it did some shading
Regardless of whether a dependency is being used.
Also, beware: This pom shades in adventure-api, which is provided on paper already and won't work as-is on bukkit.
As such, I recommend to set scopes explicitly (provided for stuff that doesn't need to be shaded [as it is provided by bukkit or by another plugin] and compile for dependencies that need to be shaded [usually 3rd party libraries])
the plugin is with paper's api
its a paper plugin
"where i am"
then don't shade in adventure-api
its only minimessage
Hell, I wouldn't even declare the dependency
Well shading the dependency does cause issues (the least of which is inflated file size)
1mb at most
hence, the least. The bigger one is that you'll get classloading failures if the paper classloader isn't smart enough to ignore your shaded adventure classes
Removing the dependency means that you'll have access to the same version of adventure that paper uses which means that you'll not be troubled by out-of-date stuff or other incompatibilities
how do i listen to all events?
public void onEvent(Event e) throws
org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.Event. Static getHandlerList method required!
at io.papermc.paper.plugin.manager.PaperEventManager.getRegistrationClass(PaperEventManager.java:124) ~[paper-1.20.4.jar:git-Paper-430]
at io.papermc.paper.plugin.manager.PaperEventManager.registerEvents(PaperEventManager.java:84) ~[paper-1.20.4.jar:git-Paper-430]```
its a general question
At least I think that is the correct article
For some reason I am now forced to enable 2FA to view threads?
i found this which looks simpler
RegisteredListener registeredListener = new RegisteredListener(this, (listener, event) -> onEvent(event), EventPriority.NORMAL, MAINCLASS, false);
for (HandlerList handler : HandlerList.getHandlerLists())
handler.register(registeredListener);```
but im not sure what it means by MAINCLASS
Nah
ah
?jd-s
Couldnāt be that easy
I would assume that is placeholder text
yeah
At least use JavaPlugin.getPlugin(ExamplePlugin.class)
But no, it has to be MAINCLASS
But I digress
RegisteredListener registeredListener = new RegisteredListener(eventListener, (listener, event) -> eventListener.onEvent(event), EventPriority.NORMAL, this, false);
like this?
Hm great, the email of my account is technically speaking a deadname, so I'll probably end up doing 2FA the hard way
anybody know if it's possible to intercept network streams before any handshaking has been done on a Spigot/Bukkit server using mixins?
I suppose you already use ignite or comparable?
But I don't think mixins is required here, you can plainly attach you code to the netty channel handler
They are most likely not
can this be done with protocollib?
I need to be able to intercept the raw streams and take control of them if the data received passes some checks
Okay thanks
https://pastebin.com/eFyYh3Uq this is an error im getting in the server console
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it was something with boostedyaml
can someone help me w my server rq pls
dont ask to ask
what
Is it possible to intercept data this before the player actually "joins" the server? I need to read right from the connection of the client to listen for a custom handshake format
pls someone help me
I don't think so?
Sir, this is a Wendy's
cool anyways
[17:58:13] [Netty Epoll Server IO #1/WARN]: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.RuntimeException: Unable to access address of buffer
at io.netty.channel.epoll.Native.read(Native Method) ~[server.jar:git-Spigot-21fe707-741a1bd]
at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.doReadBytes(EpollSocketChannel.java:678) [server.jar:git-Spigot-21fe707-741a1bd]
at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:714) [server.jar:git-Spigot-21fe707-741a1bd]
at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe$3.run(EpollSocketChannel.java:755) [server.jar:git-Spigot-21fe707-741a1bd]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [server.jar:git-Spigot-21fe707-741a1bd]
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:268) [server.jar:git-Spigot-21fe707-741a1bd]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [server.jar:git-Spigot-21fe707-741a1bd]
at java.lang.Thread.run(Thread.java:840) [?:?]
:3
And what does that have with us?
help :3
thanks for the help
wrong channel stay in help server
this is #help-development FYI
I'll bully you off this channel if I have to :meanfaceemojiiiiiii:
Well I mean you only have to get access to the netty pipeline. But given that I never touched NMS I cannot assist you further
Unfortunately that error isnāt very helpful in finding the cause
eh I know what the issue is
Has anyone ever tried implementing NuVotifier in Minestom? Or even something that is platform agnostic
Just going to delay the answer since they decided to try and ping @here
It shouldn't be hard to do
Isnāt it fairly platform agnostic already
It is
Ah, nice
Since itās mostly just dealing with http stuff
Yeah
I guess Iāll see if i can implement it without any commands or config though as thatās what Iād prefer in a Minestom environment
Is protocol V1 used any more? Do I need to bother supporting it
You most likely could make use of the common artifact as-is as it has Velocity support it shouldn't depend on anything NMS-related anyways
and the bukkit implementation is incredibly stripped down
Ah, yeah! Iāll take a look through common and see
with a custom classloader?
oh god, that does not bode well
i might have a custom classloader and i woudlnt know
You probably do know given that I mean anything being an or subclassing ClassLoader with that
unless you don't mean the same with addon system as I do
it's basically just the good ol' addon system where you register an addon object with stuff like skript
Isnāt that what the Bukkit API is for?
Do you guys have any ideas how I can format this better?
[Sword] 2 is the amount of danger that item has.
+1 [Shield] is the percent of damage you take. (100% is 1, .75 is 75% damage)
+1.02 [Crossed Swords] is the amount of damage that you deal in 1 damage (Currently deals 2% more damage, no limit)
ah well then, yea. I was thinking of something else. But then again, I do a bit too much with classloaders so I immediately jumped to the conclusion that you decided to go down that dangerous path
ah
im still insanely proud
cuz of how hardcoded my code was
which is a bad thing
but now i dont have to worry about adding 500 actions and 600 events and 300 placeholders
danger versus damage is rather confusing, but I cannot help with the formatting.
Perhaps represent danger with a flame instead if that is possible?
Swords are almost always associated with damage in video games.
And the shield is a bit confusing too given that usually higher is better when associating it with green text and pluses
For the incoming damage either use something like "x1.0"/ "x0.75" or "100%"/"75%", which is probably the best way out there (and use hex colors to make 1x be red and 0x green, and neatly color the rest in between)
it should be a new line for each stat
maybe bold the 2 swords abit
That's too much bloat in the lore tho
limit double to 1 decimal point
that makes it cleaner
the 2 swords are too thin
the new line is optional
the main problem I see are the symbols that are used and what they convey
We are playing minecraft, a pixel is rather large here
though honestly you can't be talking about a pixel here
just make it bold and compare both
Nah
ok so now how do i disconnect my api from the plugin so people cant get the plugin for free
Remove the key
just delete the api key
?
what are you doing
im talking abt an api like a dependency
Bad
amazing
^
explain
how does one explain this
Remove the implementation of methods, https://github.com/Geolykt/TTDeploy/blob/main/src/main/java/de/geolykt/ttdeploy/TTDeploy.java-style
uh
š„
making an rpg?
it can be anything
No, a danger level plugin. Basically players kill other players for danger and gain stats on their danger
oh
interesting idea, are you a fan of smps?
I dabble.
make a cooldown on each account
so people dont spam kill alts
DangerSMP incoming?
I promise you, we've thought all of that through.
that's cool
I think I want to change the crossed swords to +1.02 to +2%
what would be the equation for that
1.02 times 100 - 100 = 2 + "%"
I got it
The order of the icons isnt consistent
?
1st parameter has icon first
Icon number number icon number icon
good?
looks good
But the green part is a little misleading
green part defense?
I would assume as a player, that the higher the green, the better. In reality, it's actually the opposite. The closer to 0 green is, the less damage you take
yeah, I already outlined possible solutions there
in this case, why not invert the system
Also, green = good; red = bad. Keep this video game logic in mind
Yes, red = bad
If you have higher danger, you are inherently more dangerous = more outlawish
Yeah, damage is the only real place where this rule doesn't really apply tbh
Japanese Symbol For Beginner or Shield emoji?
shield
How can I convey that the player only takes that amount of damage
Maybe I invert it and make it +7%
hello guys, i would like to know how can i get the truth item's name
item.getItemMeta().getDisplayName() doesn't works
I like that
Welp, I think that's wraps
thank you guys
The server only has the english language file
Ideally you wouldn't get the name yourself and use a translatable component instead
change the world of hell in mc
can you make it so that entities other then sheep and that mushroom cow can be sheared ?
specifically when it comes to PlayerShearEntityEvent.
F
that's not that bad
true, can you play the sheering sound when that happens ?
yeah, i am not that familiar with spiggot or plugin developments so that is why i was asking for the sound part.
i have only been doing it for like 3 days or so š
but yeah, it is WAY easier then mods.
?jd-s
search for playsound
š
For a chest shop plugin, do you guys think i should just use normal chests, or should i display if a shop is empty/closed/open with colors like that?
Scaled up heads kinda look a bit pixelated, even for minecraft
Nvm i have a better idea. Ill decorate the corners of the vanilla chest with colors.
i have a problem , its 7am my brain stoped working xD
so when i click on enchant book , it open gui with the items can be enchanted = done
my problem is when i click on the item that is displayed in the gui , it get enchanted , but when it close the inv , it does not update the item in player inv
this is the enchanting code :
show addEnchantmentToItem method code pls.
//ToDo thing is the most cursed thing i've seen
It's // TODO: thing. End of story.
Looks like my todo comments
https://ae.advancedplugins.net/for-developers/create-custom-effects trying to do this (idk java so im using gpt to code it) but its failing misserably, can someone possibly help me please.
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingāgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! š
i dont particularly want to spend months learning java for something il only use once
then ask chat gpt
im not tryna make a massive plugin for a massive server, im just tryna get help making a very tiny thing that just adds a single effect to a plugin...
And you'll still want to know java
ok, let me clear this up
i dont want to learn java, i want help making this one thing, then il most likely never touch java in my life again...
i already established i just want help making this one tiny thing
i mean you can ask the devs in that plugin's community to help create it instead of asking here.
Yes
thats the first thing i did
And if you are lacking java knowledge, they'll tell you to learn java
We aren't a java support discord, this is spigot
Because you need java to code a plugin
why are you so adamant about telling me this when im just asking for help with this one thing?
you see how that says "advanced plugins"?
Because you will most likely ask the most fucking stupid frustrating questions that can be solved by
- Googling for 2 seconds
- Learning java
...
This can not be done without a basic knowledge about java and the spigot api.
Hire a developer or learn to write code. Those are the only options available.
Some people š
did they leave
ĀÆ_(ć)_/ĀÆ
looks like it
Imagine you are trying to use an API without knowing the programming language
and trying to do an advanced project for a "small plugin"
Lmao
I think not knowing it is fine, people start somewhere, is fine but not wanting to know it is just ignorant
But idk what that guy was trying to achieve
Usually when I try to write in a language I never wrote in before I try to not ask questions in any communities and just google
And that's how I learnt java
xd
thanks emily
Are you two best friends?
she says more
To be honest either you have such basic questions that noone feels like responding or you have enough knowledge to respond to the basics yourself and stumble on questions that noone can help you with
alright its a new day, need to figure this out and hopefully all my other problems will be fixed š
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
i swear i literally had that in 2 seconds ago and it didnt work smh
er but i was told yesterday that i need just the spigot and not the spigot-api
because i need to fix these 2 errors
Ah you need craftbukkit.
In that case: Change spigot-api to spigot and make sure to run BuildTools for that version.
Using NMS requires you to locally build spigot at least once, because the sources cant be distributed.
Running BuildTools will do that for you.
What do you need nms for btw?
right and thats where i got stuck yesterday having installed buildtools but not really understanding what exactly i needed to do with it
You can just import packages now?
Thats crazy
I'm forking over a core plugin that one of my buddies made for a prisons server several years ago to make it work on 1.20 rather than 1.8, just going off of his code rather than trying to redo everything from the ground up but I'm realizing now that that is probably the better choice lol
and he uses those imports for CraftPlayer and a couple other things
A lot of stuff which needed nms and crafbukkit back then, is now supported in the API.
It has been 8 years after all.
haha yea i figured
a little annoying cuz i fixed pretty much everything else that it was telling me was wrong, but oh well
Now imagine your code doesn't run and there are no errors. That's so much worse
yea lol
im just gonna redo the whole thing from scratch š
now that I understand and organized everything I have a much better idea how I want to do everything
Yeah, understandable. But make sure that you don't fall into the trap of rewriting the same thing 100 times. Speaking from personal experience.
Because if you just keep rewriting your old code, you'll never get further.
This is to say, don't get stuck trying to perfect something if it isn't necessary. But instead, learn when to rewrite something.
imo
I like to think of stuff functionally before I introduce OOP, or else you get this eerie āEnterprisenessā feeling where suddenly X can be turned into a builder, Y can be a delegate etc etc and in the end youāre wasting hours working on abstraction which you donāt even end up needing
Language also helps, Kotlin for sure is easiest to prototype in
sure :
the problem is it update and add the enchant to the item that is in the opned inventory and not to the item in the player inventory!
Yo, is the best way to listen for if a spawner has changed type by listening to PlayerInteractEvent? is there really no specific event?
And assuming alot of servers will disable this feature, is there a way to see if its disabled or not? just check if event is canceled? is there a gamerule or anything in spigot.yml I should be aweare of?
i got everything working now , only 1 bug left ..
it duplicate the item when i enchant :
- enchanted new item
- old not enchanted item
both are in player inventory :p
how i can fix it?
clickedItem wouldnāt be in the players inventory though right?
Its in the UIās inventory
Please use guard clauses, not arrow anti-pattern
if (clickedItem == null) return;
Beautiful depiction
yes so how i can remove the item in player inv or update it
:p
Just set its ItemMeta
So im quite confused
How is the item ending up in the player inventory
Does this only occur on shift click
can any1 explain me why this shit works in one method and not the other?
gameSession.addPlacedBlocks(location);
basically
copied
when i add that method
it adds an item but also replaces the all old ones with the new one
Show your method
where it works ```java
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.SURVIVAL)
{
Location location = event.getBlock().getLocation();
gameSession.addPlacedBlocks(location);
}
}```
where it doesn't works
private void setBlockLayer(Location location, Material material, int xOffset, int yOffset, int zOffset)
{
location.add(xOffset, yOffset, zOffset);
location.getBlock().setType(material);
System.out.println("Item: " + location);
gameSession.addPlacedBlocks(location);
for (Location _location : gameSession.getPlacedBlocks())
{
System.out.println("List item: " + _location);
}
}```
please ignore the debug souts
So what exactly doesn't work ?
in the setBlockLayer method
the list should be like this with every call
[location1]
[location1, location2]
but is rather
[location1]
[location2, location2]
- Can u show your GameSession thingy?
- Please clone the location before applying an offset (especially if it's loc from a player)
package net.jamnetwork.fireballfight;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class GameSession
{
private static GameSession gameSession;
private final List<Player> players;
private final int maxPlayers;
private List<Location> placedBlocks = new ArrayList<>();
public GameSession(int maxPlayers)
{
this.players = new ArrayList<>();
this.maxPlayers = maxPlayers;
// this.placedBlocks = new ArrayList<>();
gameSession = this;
}
public static GameSession getGameSession()
{
return gameSession;
}
public boolean joinPlayer(Player player)
{
if (players.size() < maxPlayers)
{
players.add(player);
return true;
} else
{
return false; // Game session is full
}
}
public void leavePlayer(Player player)
{
players.remove(player);
}
public List<Location> getPlacedBlocks()
{
return placedBlocks;
}
public void addPlacedBlocks(Location location)
{
placedBlocks.add(location);
}
public void removePlacedBlocks(Location location)
{
placedBlocks.remove(location);
}
}

its from variables so double x = config.getDouble(path + ".x");
double y = config.getDouble(path + ".y");
double z = config.getDouble(path + ".z");
Location location = new Location(world, x, y, z);
? i like that way with starting the braces from new line
Do Location have a proper toString method?
What is the output when you print a location?
when printing the location which is the param it prints correctly but when lopping it messes up
first two method calls
List item: Location{world=CraftWorld{name=world},x=93.0,y=58.0,z=-4.0,pitch=0.0,yaw=0.0}
Item: Location{world=CraftWorld{name=world},x=93.0,y=59.0,z=-4.0,pitch=0.0,yaw=0.0}
List item: Location{world=CraftWorld{name=world},x=93.0,y=59.0,z=-4.0,pitch=0.0,yaw=0.0}
List item: Location{world=CraftWorld{name=world},x=93.0,y=59.0,z=-4.0,pitch=0.0,yaw=0.0}```
When do you call setBlockLayer?
Is it safe to use timestamps as unique identifiers or is it possible for 1 player (with autoclicker) to click twice in the same millisecond?
I mean, even if you'd immediately process two interaction packets, the event handler would not be called in the same milli second
if you wanna go real sure, nano second exists too 
tho the values of those are ehhh, not as well defined
Hello, does someone know how I could spawn DragonBreath ?
I think nano is fairly unique for the current runtime. But dont persist it.
Yea
Isnt that just a lingering potion entity?
I mean, or you just go the normal uuid route and safe yourself the trouble or something doing something stupid.
It's for auction listings within a UUID, to identify the specific auction
yes thanks !! I was searching the word but couldn't find it !! š
But I'll just add a check to cancel the creation of the timestamp if it already exist. No one would ever notice except cheaters š
Yea but why base it on a timestamp when you can just add a uuid?
You mean a UUID or UID cause every UUID(Player) can have multiple auctions
no like, for every auction you just create a new random uuid for its id
You can just give a UUID to an auction
a lot of time
like, SQL wise you'd have like
identifier UUID,
owning_player UUID,
creation TIMESTAMP
double x = config.getDouble(path + ".x");
double y = config.getDouble(path + ".y");
double z = config.getDouble(path + ".z");
Location location = new Location(world, x, y, z);
setBlockLayer(location, Material.getMaterial(26), 0, 0, 0);
setBlockLayer(location, Material.getMaterial(5), 0, 1, 0);
setBlockLayer(location, Material.ENDER_STONE, 0, 1, 0);
setBlockLayer(location, Material.getMaterial(26), -1, -2, 0);
setBlockLayer(location, Material.getMaterial(5), 0, 1, 0);
setBlockLayer(location, Material.ENDER_STONE, 0, 1, 0);
I'm using mongodb but I guess I could use an ObjectID instead of a date of creation as I can extract the date from the _id
You can use UUIDs as primary ids in mongo. Indexing is very quick even.
Universally unique id. Close
oh lmao I was getting confused, I kept thinking they were talking about the player uuid
Nah you can just generate a random one
It's just a combination of two random longs, basically
but doesn't it have to check if all the other uuid's don't match the new one
oh wait nvm cause they use the timestamp for creating it
what's the difference between
FishHook#setMinLureTime
and
FishHook#setMinWaitTime
and
FishHook#setMinLureAngle
which one sets the fishing speed, if any even sets it
Wait time is before a fish bites, so that's probably the one you want
Lure time is the time it takes for a fish that is currently swimming (the little particles) to reach your bobber
declaration: package: org.bukkit.entity, interface: FishHook
luretime and wait time are the same
No they're different :p
what's the difference
One is before the fish particles show up, one is after
Lure time is the fish particle duration
intresting
Wait time is the time between fish particles showing up
what abt lure angle
That's just the angle that the fish is coming towards you at (while its particles spawn)
So if you want you can prank everyone by making the lure time longer and the wait time shorter š
š
Just did a quick estimate.
If you start to generate a million random UUIDs every minute from now on, the chance of a collision would be around 1% after 15 million years.
last thing, can you listen for armor change event without looping all players every second or using paper api?
We don't have an armour change event in Spigot unfortunately. We've had one PR'd for some time now but nobody's updated it to the latest version to get merged
I was told diamond was just busy!
Yeah she was busy. I ACTUALLY GOT TO CHAT WITH HER LAST WEEK THOUGH. SHE'S ALIVE
is there a way to listen tho
I just didn't wanna prod her the first second I saw her though 
Like "Hey, nice to see you again! Wanna get back to work on the armour PR?"
people in the future gonna have problems with this xd
Like this or should I use a non-spigot method
UUID.randomUUID();
That is a non spigot method
ooh
Time for spigot to invent our own!
The SUUID: Super Universally Unique Identifier
256 bits
Its backed by a global database which checks every single instance ever created to make sure its actually super unique
Uh, how would I get the timestamp from a UUID? Cause I heard the timestamp is used in generating it
Instant.from(timestamp);```
oh
i guess I'll just use MongoDB's ObjectID then so I have an identifier and a timestamp at the same time
Or you just use a UUID and a timestamp...
But muh bytes!
^
i learned that in code less is more
Why get a music app AND a streaming app if I can just get youtube premium š¤·āāļø
I mean really you're talking about the difference between 8 bytes and 12 bytes :p
I don't know how unique you want to go but you could also just use a single integer as the unique id, but if you're going to access the timestamp often, store it as a separate field
I'm storing auctions like this in MongoDB and I need to use the timestamp to track when to expire the auction, and I need the UUID to know which auction to set to "sold: true"
But I load all auctions once onEnable so i'd only convert the ObjectID to a timestamp once
But in your case it wouldnt be youtube premium. It would be a streaming app where
you use the sounds channel for music and the video channel to save random images.
You are using the objectid outside of its intended purpose.
Just use a UUID and a timestamp.
Honestly I will probably not even need a UUID as it's extremely unlikely for 1 player to create 2 auctions in the same millisecond considering you need to type a command & click on confirm. And I can add a check to see if the timestamp doesn't exist already incase some hacker with a super fast script comes along
I told you. You have to copy the location
Because right now you just add x times the same location to the list
Without cloning the location, changing its values will affect the origin object
So even if you add it to the list you will just have multiple references to the same object
(that will change over time)
But if I ever need a UUID which can't be the timestamp + a timestamp I will just use both as I didn't know it's not intended to use the timestamp from the objectid
See pass by value and pass by reference to better understand
yeah it worked
tysm
is .startsWith reliable to use when comparing? Or what counts as "startswith"
if it starts with, it starts with
.hashcode then .equals is faster
Ofc if youāre only checking if the string contains another substring, you canāt use this methof
tahts what i was about to say, in my case i think this will not work
the fuck
?
What's the error
huh how
no
Haven't worked with it in a while
the string is deprecated
Uhh
it should be a player profile
Oh that's fair
that's better
Though they all seem to take a String
how did someone make it that scuffed
doc i think
yes
https://hub.spigotmc.org/jira/browse/SPIGOT-7603 doing triage for you guys
do I get a role
Man why does Mojang use private static final
It's static and final just let me access it :c
re
what is private static final even good for š
isnt static only for constants
Making me sad
me too
local constants ig
like constants that aren't useful outsdie of a class
imagine if theres kotlin in mc codebase, we wouldnt know bc they'd prob remove metadata
Welp time to do a little jank
We would know because that class would have the least legible decompilation out of all classes ig
instaneof
event.getEntity or whatever the method is called instaneof Player for exmple
if it is a player cast the entity to player
if(e.getDamager().getType() == EntityType.ZOMBIE) {
}
or
if(e.getDamager() instanceof <ENTITY-HERE>) {
}
i dont think so
I mean ideally but thats pure idealism I suppose
i think instanceof is faster so if you care about perfomance use instanceof
use == for checking enums, and EntityType is an enum
and == for primitives
^^
how check if custom flag allowed or not
wg api
i mean not like exists or not
i mean really boolean state
== is very fast
lmfao i was looking at this EXACT link
isnt instanceof like 2 nanoseconds
i wonder if there is CommandSender#getType š¤
Instanceof and other stuff like iirc exception handling used to be quite costly, I think the difference is negligible between instanceof and ==, Iād guess tho that at best instanceof is equally fast to ==, but in a worse scenario it may be super ultra negligibly slower
basically == is a SSD with dram cache and instanceof is without :p
lol
can u show your code
because it is a living entity?
e.getDamager returns Entity tho
yes but look at what he does LivingEntity entity = (LivingEntity) event.getDamager();
oh yes
if(event.getDamager() instanceof LivingEntity) first tho
is Arrow a living entity
make it check if the damager type is instanceof Arrow instead of Entity and cast to Arrow instead of LivingEntity
isnt there a ProjectileHitEvent tho
hello how do i get the corresponding Sound enum instance from a minecraft key
like lets say i have minecraft:music.nether.basalt_deltas, i need the Sound.MUSIC_NETHER_BASALT_DELTAS, but there is no function like getByKey
Arrow is a Projectile so you can check for that

