#help-development
1 messages Β· Page 65 of 1
gradle πͺ
gradle is just way too complicated and sooo bloated although it has no features
I prefer maven
gradle cannot even shade stuff π₯²
wdym
(unless you use a plugin made by some random github guy)
(also gradle thinks that it needs to run a daemon the whole time)
shadowJar {
relocate 'dev.dejvokep.boostedyaml', 'me.kidneybean.generalutils.shaded.boostedyaml'
relocate 'org.bstats', 'me.kidneybean.generalutils.shaded.bstats'
}```
boom
shading
(and it needs to download itself first, and it's like 150mb from a slow server)
haha no
you need a plugin for this to work
its like 1 line to add that plugin tho
but again, I dont hate gradle. it's awesome. but maven is just better π
yeah sure, if you like to depend on random people's plugins, go for it
maven however has an official shade plugin
IIRC gradle cannot even use your local maven repo without an explicit declaration
gradle is just overly verbose
people claim maven is verobse because of XML
but thats kinda bs
i gtg
I mean which one is more readable?
compileOnly org.spigotmc:spigot:remapped-mojang:1.19.2-R0.2-SNAPSHOT
or a nicely formatted xml file
aight, have a nice day β€οΈ
Can someone help me?
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 a plugin Im getting help building, and I cant get it to drop the item. d:
Drop this item instead
static VillagerVault plugin;
public villager (VillagerVault plugin) {
this.plugin = plugin;
}
public static void init() {
}
public void createdvvilager(Location location) {
Villager vvilager = location.getWorld().spawn(location, Villager.class);
vvilager.setCustomName(ChatColor.GOLD + "Item Safe"); //Color and name of mob//
vvilager.setCustomNameVisible(true);
}
@EventHandler
public void onInteractEntity(PlayerInteractEntityEvent event) {
if(event.getEntity().getType() == EntityType.SILVERFISH) {
if (event.getRightClicked().getType() == EntityType.VILLAGER) {
if (event.getEntity() instanceof Villager && event.getEntity().getCustomName().equals((ChatColor.GOLD + "Item Safe"))) {
} }
}
}
}```
on eventhandler, theres an error on getEntity..
'Cannot resolve method 'getEntity' in 'PlayerInteractEntityEvent''
But its PlayerInteractEntityEvent ??
hey lol
Hey
I need plugins Devs DM me
?services
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/
I've compiled my plugin using 3 different JRE's (18,17,16) and every time it's telling me the same error
has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0
I have no idea how it's still building in runtime 62
version 61 correlates to jdk 17, so compiling with 16 or 17 should work
I'm using intellij, I've updated the pom, I've updated the maven run config, I've updated the project settings source language level and dependency, I've updated the project SDK settings and language level...
are you sure you have been using different jdks to compile?
you need to set the source/target not the JDK you use
^
I set that in the pom
how
?paste pom
InteliJ or Eclipse?
InteliJ
Artifacts or lifecycle to build?
I'm using lifecycle
package?
yes
add teh compile plugin to your pom as thats the only reason it would be broken
The compile plugin?
if everything is as you specified above
I didn't understand what you meant yesterday, but I think I do now. Because the Flood class is registered as both an event and a command, it opens one instance of Flood when the command is triggered and a new instance of flood every time the event is triggered, right?
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>```
Ahh, plugins is getting a red line under it when I use that
it goes in the <build> section
How can I target an instance of a class to make sure they both use the same one?
ah perfect, I'll reload maven and try building again
Just gotta restart my server to see if it works
Jeeze, still reporting the same error,
io/github/klaustrix/greentext/GreenText has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0
update your java
you are trying to compile/whatever something that uses a newer java version than you do. where does this message come from? maven?
From the minecraft server on load up
#help-development message @tender shard is their pom which looks correct
You can;t be correctly updatign yrou jar on the server
then you're in the wrong channel. go to #help-server. and update xour java
My guess is you have the server running and fail to update
make sure you haven't got multiple jars in your server for the same plugin
PC crashed so catching up
Update the server java?
I started on Java 18, I stop the server, delete the old file, upload the new one, start the server again
are you using maven @digital basin ?
yes
he is, lifecyles package to build
read this pls
Your pom is now fine. you are either failing to build or not uploading the correct jar
when in doubt invalidate caches and restart
yeah that's usually a good hint but not if the problem is the java version
https://imgur.com/a/rkuJGLk
This is everything I've updated
SO MUCH TO DO, SO MUCH TO SEE
?paste your pom.xml file
are you using intellij?
yes
File -> Project Settings -> set the java version to 17 or above
set java to 17 instead of 16
do you have maven installed on your computer separate to intellij? you could try build using mvn package to see if intellij is messing anything up
java 17 is fine, it's what the server is running on
Confirm, you are using the menu on the right, Maven and package in the lifecycle section? Not building via artifacts
I tried 18, 17, and 16 but I can bump everything back up to 17
https://i.imgur.com/T1lmVfk.png
The highlighted option
k
Maven is part of intellij I think
okay lets start from scratch. send the FULL maven log pls
Where do I get that
not just the error message. please ?paste the WHOLE maven log
ok wait
i'll explain, lemme start IJ
the error is coming from the minecraft server, not maven
we need the maven log to see if its even building
everythign you changed shoudl have altered the target version and its not
oh
So we are guessing there is a build error
when it builds, the bottom pane should show a maven window with the build logs in
then your server is running java 16 or older
its running 17, bytecode v61 is jdk17
https://paste.md-5.net/ayidajevor.cs
This is the build output?
then I also cannot help
I'm running Spigot 1.19
I am like 1000% sure that your server runs java 16 or older
on an apex host
Is there a way to verify the java version?
Maybe a console command?
yeah, looks good
confirm there is only 1 GreenText.jar plugin in your plugins folder
versioning sometimes messes that up
you move the file over and it doesn't overwrite the old one because they are different versions
(usually spigot uses the latest file if 2 .jars have the same "plugin" name)
but yeah cant hurt to double check this
not in my experience
Each time I delete the old file, a new one generates, I delete the one on the server and upload the new one, even changing the version number to make sure it's different each time
There's only ever one file in existence at a time
do java -version or paste your whole latest.log
?paste
just paste your whole latest.log there ^
oki
you need to set a java home environment variable if thats the case
?javahome
fuck that, just let them paste the log
we need a command for it tbh
dont think thats the problem, intellij finds the jdk fine
I am like 99.9% sure that they run java 16 instead of 17
its path is manually specified in intellij
intelliJ has nothing(!) to do with your server
just because intellij found the jdk doesn't mean your computer has
just paste your latest.log pls
thats not the full log
restart your server, then open latest.log again and paste the full file pls
Okay one sec
the log gets rotated automatically at 0 or 1 in the night
so yeah pls restart it and send it again
Do you guys know that feeling when you're facing a problem while programming and eventually you come up with a 3 line solution xd
yep
It's so relieving
mostly the 3 line solution involves NMS though lol
:(
I just have to dc my players to restart so I gotta explain whats up
the server isn't the problem here
take your time. but we can't help you until you posted it
its intellij/maven not compiling with the right target
huh
I thought that was the problem
I thought it compiles fine
class file version 62 is java 18
yes it compiles fine
just not with the correct target
does your plugin compile fine, or does it not?!
It compiles but the compile version is always too high even when set lower
does maven say "BUILD SUCCESS" or does it say "BUILD FAILURE" when you compile?
ok ok good
it DOES matter?
if it says "build success" then its obvious that the only problem is the server running java 16 π
show your pom
the fact its successfully built doesnt matter if the target is still incorrect
the srever
The problem is that the server only wants java 17 or lower, but the plugin is always being built in version 18 for some reason even when I set the settings lower
is not
it compiles fine
running 16
their only problem is the server runing java 16 instead of 17
can you try this...double click on Package, not using any of yoru other bits.
the problem is that maven isn't targetting java 17
compiling isn't their issue, their issue is compiling for the wrong java version
no
no
oh wait
kinda true
in order to fix that, I need to see their pom
think the version has been bumped since
that's the only difference
they compiled a plugin for java 17 but their server runs java 16. that's the problem. so either update the server's java or downgrade the compiler target in your pom
https://paste.md-5.net/ivevoyenin.xml
This is the latest pom
they haven't compiled for java 17
^
oh yeah
Yeah it's compiling through java 18 despite changing all the settings
youre right
The problem is teh pom says its compiling for 16 but its not
which means he can;t be using the pom
personally, i would download maven separately
and run it in the command line
remove intelij from the equation
he has to be building using artifacts
or intellij is using some other weird option in its maven settings
possible
ctrl ctrl and type mvn package
seems like you're missing something in your compiler plugin
should have a config section like that
not necessarily required :s
doesn;t need it, its in the pom properties
ah, mb
pom properties isn't used anymore
at least not for targeting java versions
? it is in Eclipse
used to work in intellij with me?
eclipse does its own thing
yo guys it's not christmas today, so enjoy my latest christmas song https://soundcloud.com/le-crochet/kunsumgellschaft-ich-konsumier-auch-wahrend-der-heiligen-zeit
HΓ€ngst du schon am Haken? Knusprig Paniert und JEFF & Jefferson ergeben zusammen: Le Crochet!
but this is why i haven't used maven in a long time
Well I fixed it for you, should work now for the version you are wanting
multiple places to define everything
I'll try these pom changes
btw Klaustrix is the one with the issue, not me
ah
π
well either way
Uploading and testing now
so
<properties>
<maven.compiler.release>17</maven.compiler.release>
</properties>
standalone doesn't work anymore?
hello, why i have this signs pls ?
maven stopped using the properties for java version targeting because it was getting too confusing when the compiler plugin already accepts a tag for it
eclipse has its own compiler and they do their own thing
something with your ide seriously can't expect anyone to help you with so little info given
when did maven drop that?
when did this happen?
do you know the version?
is that just because i have an error in my code ?
I don't fucking know
you have provided 0 info on your IDE or anything
how am I supposed to help you
around java 11 I think @eternal oxide
shouldn't matter what java version
i mean, i was expecting for a misclick combination of keyboard
I guess I never noticed as I use Eclipse
dude I ain't got a clue what your going on about are you messing with me or something
how would i remove just 1 item from a players inventory?
for the most part, eclipse compiler works the same as the maven one, but they have some minor differences here and there lol
instead of the whole stack
get hte item set the amount to the amount -1
set an amount to the itemstack iirc
Wow still getting the error I'm just genuinely cursed
looks like you have whitespace characters turned on
which ide?
looks like eclipse
okay, i would suggest installing maven separately
you shouldn't o.O try doing a clean build
yup, eclipse
Window >> Preferences >> General >> Editors >> Text Editors:
[x] Show whitespace characters
the only other thing I can think of is that you are making IntelliJ build it and not maven
staight from stack overflow
I can try downloading and installing maven, while I try that, how do I clean build?
my thoughts
Mvn clean
double tap ctrl and type mvn clean package
i have a item stack but how would i set it?
setting it needs the index
ItemStack#setAmount
my server is paper 1.19.2, and i keep getting that chat message validation failure so i decided to try and go back to a later version like 1.19. Except now it makes my server crash because its trying to load chunks from 1.19.2, is there anyway to go back a version and not have it crash like this?
loop
You dont need to package if youβre just cleaning
they are pretty fucking awesome
should that be in help server
while that is true, they still need to compile
but they'll need to package afterwards
Ah
Yes
ok mv
π
@dim bronze in wich section ?
Gyser
the response was quite old so might have changed
We have 0 context from this video
;/ have you tried fixing your problem yet
can you search the settings for the term 'whitespace characters'
thanks
np π
yes
I use GeyserMC In Java server but It does not work
Znpcs
after install, unzip and move the folder somewhere and then add the bin folder to your PATH environment variable (check google for OS specifics)
?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!
IT WORKED
ask what
ask your question 0 provided 0 context 0 possible solutions
so what you must had been doing was using IntelliJ's ant build instead of maven
Frostalf's pom + clean package
could anyone help me with some playerInteractionEntityEvents ?
@dim bronze thx, i foud it
just ask
I want a solution
do someone know how to calculate the angle (-180 to 180) between player direction and a location ?
Well I super appreciate all the help guys
π₯²
you never even stated your problem buddy
Thanks for sticking with me β€οΈ
you just sent a video
i mean it makes sense. no code changes so maven doesn't recompile
so class version never changes
should have seen that coming
?paste
do someone know how to calculate the angle (-180 to 180) between player direction and a location ?
please
oh
can I get the stack trace
you have a syntax error
π do someone know how to calculate the angle (-180 to 180) between player direction and a location ? π
remove getClickedEntity after event
still wont work
what's your new code
bruh don't know how to fix a syntax error π please see what your IDE is telling you and fix it its very descriptive
take the location as vector, subtract the players location as a vector
and get the direction of the vector
my problem is in plugin znpcs
When I write command
/znpcs create
And write the requirements, the red letter appears to me, and it does not spawn the npc
What it tells me doesnt fix it
is it your plugin?
organise your code dude
Nooo
bruh this aint the right channel
plus go bug gyser / plugin creator
yes but with this method it's always positive
I need to know if the location is at the left or the right of the player
so -90 or 90 in example
The problem is not with them, I have already asked them
then ask the plugin creator
if its not an issue with them ask geyser
if geyser says not our problem than figure it out yourself someone is lying spigot isn't the issue here
I don't have the server discrod
then find it
How π€
don't ask me I don't own the plugin If its not on their plugin page dm them on spigot
or how to get a hold of them
π
Ok sorry
Anyone knows if there is a plugin that makes inventories "stackable", e.g. you open a chest, and there is a chest inside, if you idk, right click? that chest it opens that chest's inventory, etc
I'm go here #help-server
so a chest in a chest?
I mean equally speaking no one in help server will also beable to help you
that would cause so many issues
oh you mean like shulkers
yeah something like that
just checked the javadocs, you can probably just use the angle method which gives it in radians. If > pi rads then to the left?
shulkers dont stakc inside of eachother
he could just prevent the items from being nested
Do you guys think it would be even possible to do smth like that?
yea probably very easily
yes, with nbt easily
and when you close that inventory, the previous inventory opens (if there was any)
idk, was just something that came to my mind :d
just a gui I'm assuming
because if its a physical chest you're asking for a bookban chunk
didn't mojang fix book banning
did they?
iirc they now allow chunks to store more than 1mb of data
Well, let's say you have a chest with items inside, you destroy that chest and have it in your inventory, if you place that chest into another chest now and right click on the chest that you just put inside another chest it opens a gui with the stuff stored in that chest
this is surely to cause a lot of problems and potential duping
better to use something like vaults
What do u mean, I don't understand
where there isn't a physical chest required
hm true
just sounds like a vault with extra steps
is there a way to get the player's client brand using the Spigot API? If not, how else could I do it?
depends on if the client mimics the notchian client or if it sends its own information like i assume lunar and badlion does
what this information is, however, i have no idea
i don't think its intended to be public knowledge because it can be faked but its probably been reverse engineered
Client signatures can indeed be faked very easily
Many plugins like an anticheat I know will show you the client brand, I wanna know how to get that
if your using it to prevent hackers don't bother
I know it can be faked, I just want to be able to get it
which is why intended to be public
I dont think you can easily with the spigot api
it probably is
but Paper has a method for it
no point of this in an anti cheat clients won't identify themselves and someone on forge isn't that much more likely to be hacking than on a client not identifying itself as forge
but you just have to find it online
I would recommend you dig into their implementation and see how they did it
really? hmm
i don't think most alter this?
I saw on a thread that it's possible to do it with ProtocolLib, is this true?
iirc its sent in the handshake packet
i didn't realise you meant this information
so yes, possible with protocol lib
π thanks
i may be incorrect on this
can't see it mentioned in https://wiki.vg/Protocol
hard to read the patch without surrounding code
. @dim bronze
not something i can confidently speak about without testing
seems like a common enough question, had any luck with google?
bro I just searched like while 3hours
nobody have a solution
something that work
what do you need this angle for
to find hiden treasures underground
I remember trying to do this before I actually got taught vectors and resolving in school so if that's not something you're comfortable with then maybe read up but this looks helpful https://www.spigotmc.org/threads/calculate-angle-between-two-players.282430/
public void onPlayerWearsItem(PlayerInteractEvent event)
{
Player player = event.getPlayer();
player.sendMessage("Checking for helmet on player " + player.getDisplayName());
if(player.getInventory().getHelmet().getItemMeta().getLore().get(0) == "Β§2These goggles grant you the")
{
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 1, false, false));
Bukkit.broadcastMessage("PotionEffects!");
}
}```
I'm trying to make it so when you wear a specific helmet (custom ItemStack) you get night vision, but this code doesn't work. Any suggestions?
right now im checking if the lore on the helmet being worn matches the custom helmet i made
and i tried checking to see if ItemMetas matched and if they were the same ItemStack
but its not working
?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.
ok ty
Don't compare strings with ==. Use .equals()
Surely we have a command for that, no?
ok well thats not the problem because i tried by checking if itemmetas matched
?strings
{
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 1, false, false));
Bukkit.broadcastMessage("PotionEffects!");
}```
ItemManager is a seprate class and Goggles is the static ItemStack
?
why not just ItemManager.Goggles.isSimilar(player.getInventory().getHelmet())
hi
it will compare meta too
Doesn't isSimilar only check the amount tho
everything except amount
I'll give that a shot! I'm somewhat new to java, I mainly do C#
?nohello I feel like this fits
@dim bronze hi can you do a voicechat real quick? i'm in hokib's team and we've been trying to figure this out for 3-4 hours
do you study the cmds
ive been in here for a long ass time
at some point they just come naturally
I have 32k+ messages lol
@worldly ingot can i get some helps please its very urgent
?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!
you havent even asked a question
It worked! Thanks a lot
also, is their anyway to tint the screen a color?
finally figured it out
Hey guys, i'm trying to show to players an arrow in their actionbar pointing them to a block location, according to the direction their looking at
i'm struggling a lot with vectors and I would like to know if someone could help me doing this
by the way, as I need to convert angle to arrows, a basic angle will not be enough since I need to tell to the players which way they need to turn
use the generic look at method
loc.setDirection(entity.getLocation().subtract(loc).toVector());```
and get the pitch which you convert into an arrow
what
that is
not true
First: get the displacement vector
blockDir = blockLoc - playerLoc
then get the facing director
playerLoc.getDirection
yeah but then how can i get the angle ?
Vector.angle
since I need to know like if the player needs to turn to the left or the right i would need something negative or positive
yes exactly
and vector.angle is always positive
you can use blockDir.dot(playerDir)
that will give you a vector that is positive (to the right) or negative (to the left)
can I use > / < on a vector tho ?
huh?
how can i check if the vector is positive or not
oh
the y value
of the dot product
will be positive/negative
or you could just use a compass
i should also mention
the y values of these vectors need to be set to 0
what are you trying to do?
@spiral birch see above btw
This depends heavily on whether or not you're using reflection, or if you just want to invoke some method with a given signature
trying to get a list of command from a category of my config and link him to my categor'ys name
use a functional interface
not even
just use the list as the value of the hashmap
and then do Dispatcher(map.get(key)) or whatever
and also lowercase Dispatcher
loc.getBlock().setTypeId(31:2);
I can't put this id, can I how to solve?
setTypeIdAndData
hi i have issues with a plugin
i had a tab list plugin and when i delete this plugin the tab list dont disappear
what can i do to fix it?
wdym
loc.getBlock().setTypeIdAndData(31, 2);
So it doesn't work the same, what did I do wrong?
np
what would be the best way to save boolean data about the player
how can i create a fallingblock using nms? using new FallingBlock it asks for a properties object, what is that and how do i make it
because only 1 person see it
You should use World spawnFallingBlock
declaration: package: org.bukkit, interface: World
That spawns them for everyone tho
that isnt nms
oh, you want just one person to see it?
you need to send the spawn packet to just that person
Well, generally falling block entity is what you wanna base your stuff on
this is the issue
i would look up how this method works and send it to just that player
yea, what I mean is you should look in the source code how it is done
and instead of sending to everyone in the world, just send to the player you want to see
theres hundreds of files in the source code idk what 1 its in
look in CraftWorld class
Just a yes or no, should I run database "preparedStatements" async?
Yes
yes
most database stuff should be done async
Technically not too needed
looks like it is done in EntityFallingBlock#fall
alright thanks ill look at it
Thread
I see then, thanks! =)
is this 1.19.2 do you know?
that is a nms class, you gonna have to decompile it
that didnt work on 1.19.2 BlockPosition doesnt exist but i fixed that but the method is completely different and i dont rly understand it FallingBlockEntity entity = FallingBlockEntity.fall(s, new BlockPositionSource(loc.getX(), loc.getY(), loc.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState(), CreatureSpawnEvent.SpawnReason.CUSTOM); the loc.getX() y and z and all of that says its unrecognized
is there any way to put a player in a sort of spectator state in survival. The main issue I'm theorizing is the restriction of hitting another player if the player in "spectator" is in the way. There are a couple ways I could think of doing this, but I'm not positive
- Player#hidePlayer(Plugin plugin, Player, Player) hide the player for all online players
- Player#setInvisible() my note on this one is the possibility they can still be interacted with.
- Packets (I would like to not do this), but I know its possible
Now this is one of those things I wish i could try and see, but I don't have enough resources to run 3 minecraft clients and a server on my pc
that is FallingBlockEntity not EntityFallingBlock, plus that method sends to everyone on the world, you should look in it to see how the packet is sent and the fallingblock object is constructed, so you can send it to just one person
EntityFallingBlock doesnt exist
that class is in net.minecraft.world.entity.item.EntityFallingBlock
huh?
you gonna have to decompile the nms and look on it
You need to store player state and cancel specified events for specified players
yep fully aware of this I am more affraid of them being a blocker for players in hte game e.g. you can stand infront of a block to prevent another player from breaking it as a spectator
or cause collision to a player running across a bridge and throwing them off into the void
hmmm I actually should beable to pull off tests with another mob and 2 clients I should be fine catually for trying and seeing this
Then i guess you have to hide player with protocol lib, not sure how tho
i have a few questions about persistent data storage.
- does it save when the server reboots?
- can i store data on offline players?
- are there better methods?
wdym by "better" methods
but yes it does save over reboots
NMS' Material isn't the same as Bukkit's Material enum. Blocks and Items are the two corresponding classes
and no, i dont think you can set pdc on offline players. I may be wrong
to confirm, is tehre something like EntityShootBowEvent but for all projectile items?
Is there any way to find if there are any data packs installed?
i mean theres ProjectileLaunchEvent but thats as far as it goes iirc
can make your own custom event out of it
just a note don't use persistent data to replace a database
Use it to store small bits of data on things like items players etc
im using it to store mute data
Well if you want to be able to mute offline players you will absolutely want to use a db
eh it doesnt matter much
also can someone reset my nickname, its set to my old username
hos something in java changed where if you do like if (null) it throws an error?
because im getting all sorts of errors i didnt used to get
Hi, i'm trying to return a list of string (commands in a config) while key is called (with an hashmap) and executes theses commands in the consol but actually, only the first message is spaming in the consol without never stop (until the serv crash) do you see something that goes wrong in my code pls ? :
String rewardname1 = getConfig().getString("Rewards.1.name");
String rewardname2 = getConfig().getString("Rewards.2.name");
String rewardname3 = getConfig().getString("Rewards.3.name");
String rewardname4 = getConfig().getString("Rewards.4.name");
String rewardname5 = getConfig().getString("Rewards.5.name");
List<String> rewardcommand1 = getConfig().getStringList("Rewards.1.command");
List<String> rewardcommand2 = getConfig().getStringList("Rewards.2.command");
List<String> rewardcommand3 = getConfig().getStringList("Rewards.3.command");
List<String> rewardcommand4 = getConfig().getStringList("Rewards.4.command");
List<String> rewardcommand5 = getConfig().getStringList("Rewards.5.command");
public Map<String, List<String>> reward = new HashMap<>();
public void configAddList() {
if (rewardname1 != null && rewardcommand1 != null) {
reward.put(rewardname1, rewardcommand1);
}
if (rewardname2 != null && rewardcommand2 != null) {
reward.put(rewardname2, rewardcommand2);
}
if (rewardname3 != null && rewardcommand3 != null) {
reward.put(rewardname3, rewardcommand3);
}
if (rewardname4 != null && rewardcommand4 != null) {
reward.put(rewardname4, rewardcommand4);
}
if (rewardname5 != null && rewardcommand5 != null) {
reward.put(rewardname5, rewardcommand5);
}
}
public void Dispatcher(List<String> list) {
while (list.iterator().hasNext()) {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), list.iterator().next().replace("%player%", player));
}
}```
public class Event implements Listener {
@EventHandler
public void onKill(PlayerDeathEvent death) {
String player = death.getEntity().getPlayer().getName();
Main.instance.grabPlayer(player);
if (Main.instance.lever == true) {
if (Main.instance.args.equalsIgnoreCase(Main.instance.rewardname1)) {
Main.instance.Dispatcher(Main.instance.reward.get(Main.instance.rewardname1));
}
if (Main.instance.args.equalsIgnoreCase(Main.instance.rewardname2)) {
Main.instance.Dispatcher(Main.instance.reward.get(Main.instance.rewardname2));
}
}
else {
}
}
}
(args is my args[0] of my command)
You're never progressing your iterator.
Add list.iterator().next() to the end of your while loop
wait actually
maybe im a dumbass
i already putted in my bukkit consol command
im tired, dont listen to me, i dont know what im doing atm
ahah np x)
try this, hopefully my tired brain didnt screw this one
public void Dispatcher(List<String> list) {
for (String command : list) {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command.replace("%player%", player));
}
}
im headed to bed my brain is shutting down as i type
thx, i'll try when i'll find the way to restart my server lul, i cant stop it by pressing ctrl + c in console
Can I make block items that cannot be placed by modifying MetaData?
command /clearchat:
trigger:
loop 100 times:
broadcast ""
broadcast "chat cleared!"
command /mutechat:
trigger:
if {chat::mute} isn't set:
set {chat::mute} to true
send "chat muted!"
else:
delete {chat::muted}
send "unmuted chat!"
on chat:
if {chat::muted} is true:
cancel event
send "chat is muted!"
ask the skript discord they woudl know better
it worsk, thx a lot
Hello, im trying to code a gmc command,
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0 && command.getName().equalsIgnoreCase("gmc")) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (!player.getGameMode().equals(GameMode.CREATIVE)) {
if (player.hasPermission("pvessentials.creative")) {
player.setGameMode(GameMode.CREATIVE);
player.sendMessage(ChatColor.WHITE + "Set gamemode to Creative");
} else {
player.sendMessage(ChatColor.RED + "You do not have permission for this command!");
}
}
}
}
else if (args.length > 0 && command.getName().equalsIgnoreCase("gmc")) {
if (sender instanceof Player player) {
String playerName = args[0];
Player target = Bukkit.getServer().getPlayerExact(playerName);
if (target == null) {
player.sendMessage(ChatColor.RED+"That player does not exist!");
}
else {
if (!player.getGameMode().equals(GameMode.CREATIVE)) {
if (player.hasPermission("pvessentials.creative.other")) {
target.setGameMode(GameMode.CREATIVE);
target.sendMessage(ChatColor.WHITE + "game mode changed to Creative");
player.sendMessage(ChatColor.YELLOW + "Set " + target.getDisplayName() + "'s gamemode to" + ChatColor.WHITE + " Creative");
} else {
player.sendMessage(ChatColor.RED + "You do not have permission for this command!");
}
}
}
}
}
return true;
}```
This works while im op but doesnt work when i deop myself? I tried adding a no permission message in plugin.yml but the command itelf just doesn't work, it says "Unkown or incomplete command "
?whereami
?
...
Well its clearly a permission problem. Properly remove the permission requirement from your plugin.yml and make sure to compile and copy the jar afterwards
yes but I want there to be a permission?
like if the player doesn't have x permission then u cant do x command so you get the "You don't have permission for this command!"
Then whats the problem?
Hey what's a good example of getting the horn type from a item stack is?
does actionbar not send in adventure mode?
does anyone know how to code flying boots basicly when you put on boots that are named "Flying boots" you are able to fly like in creative mode can anyone help?
Sure. There are several approaches. I would listen for when the player equips the boots and give him fly.
When he unequips the boots then you revoke it. Thats the simplest one if you know how to listen for armor equips.
thank you
How do I save int-type values in Custom Item?
?pdc
I've already read the document, but I don't know if it can store different numbers for each custom item.
Yes it can
Thanks, I will try it :)
Easy way to setup a navigator through diff worlds with a compass?
What exactly does a "navigator" do?
Teleport across different worlds like a lobby and whatnot
And whats the point of the compass?
No point, just as an item that'd be immediately noticible
Since a lot of servers use that
You know how you can right click on it and it displays a GUI that you can select different worlds from
Well then you give the compass some pdc data, prevent people from dropping it,
listen for the interact event and open a GUI that lets you click on different worlds...
Okay will check those out thanks
anyone know what the clientbound message packet is called for protocol lib
there is PacketType.Play.Server.CHAT but that doesnt work
as in, i want to listen to all messages being sent to the player's chat (including plugins)
Hey guys is there a good API/Lib for scoreboards?
Hey, my friend has this minigame that has three maps in three seperate world. Is there a better way than constantly going:
switch(args[0]){
case "World1":
//teleport to world 1
break;
case "World2" etc.
}
I could have a seperate command for each map/world, but is there a streamlined way of doing this?
Yes.
World world = Bukkit.getWorld(args[0]);
if(world != null) {
player.teleport(world.getSpawnLocation());
}
this is brilliant
idk probably both CHAT and SYSTEM_CHAT
system chat? cant see that anywhere
i think chat is supposed to work, just doesnt look like it does on latest version of protoocl lib
u usign the dev vers?
whats the best way to separate different worlds/maps for a minigame?
Separate in which context?
Hi, I wanted to ask. You know how many people use Pterodactyl, to run their networks, which uses Docker to run each minecraft server in a docker container. Isn't it kinda ineffective, when there are running multiple JVM instances along each other? (when there are 2+ servers on one machine)
for example: lets say I have an enum that has game states like IN_GAME, WON etc.
I really dont want to go IN_GAME_MAP_1, WON_MAP_1, IN_GAME_MAP_2...
So is there a way to handle every world on it's own?
have a Game class, which handles it
and a GameManager
for example
You will have to run a different jvm instance for every server anyways. And yes you are sacrificing about 10% of your CPU and memory
when using Pterodactyl. But you also get the benefit of modularity.
how is it ineffective?
aha, I didn't know there's a JVM instance for each process
that makes sense now
What should I do to remove off hand and else?
I just want only Main hand
the jvms for two servers are separate anyway, yeah theres the headroom for the container but its really not much
Sure. There are a lot of ways. Just do some object oriented programming with what Tomasan suggested
Set the EquipmentSlot for the AttributeModifier
ok ty
The worst thing in making minigames is handling Events
with Bukkits imo bad event API
Whats so bad about that? Sounds quite simple to me...
it breaks oop
you don't really have much control over it
It does not break any oop concept. And you have full control over it.
What more control do you need?
hey :D
I used ProtocolLib to spawn Item Frames (entities) for a specific player
and I stored the entityID, how can I remove these Item Frames later with the entitiyID
By sending a destroy packet
can you show me example?
I can see getSlot only, where is setSlot on AttrubuteModifier?
declaration: package: org.bukkit.attribute, class: AttributeModifier
where can I fiind it in wiki.vg/Protocol? or do I just use spawn entity packet and configure some stuff to destroy it?
ty
For plib
PacketType.Play.Server.ENTITY_DESTROY
ty
anyone else available to pull the 5.0.0 snapshot?
Nexus Repository Manager
idk if im typing it wrong
For me it worked yesterday
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>5.0.0-20220727.143709-4</version>
<scope>provided</scope>
</dependency>```
does this look correct?
i tried with every combination of version and public/releases/snapshots on repo
btw someone know when protocolLib comes to 1.19?
Doesnt break any oop concept but the constant rebaking of the handler list is a garbage approach. Thats for sure.
Any reason why you need this super specific snapshot version??
i tried with 5.0.0-SNAPSHOT aswell
Just use 5.0.0-SNAPSHOT
was just throwing stuff at it to see if it works
Ah i see

How much is player's default movement speed
nasusQMeta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED,new AttributeModifier(UUID.randomUUID(), "MovementSpeed", -0.5, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND));
-0.5 just stops player
where can I download that for my server as jar
.2 by default
thanks :)
in maven
just change the version
yea but I also need it in my plugin folder
ty
still not working, i changed -0.5 to -0.1 but still stops
hm with 5.0.0 I get problems using WrapperPlayServerSpawnEntity
cause it imports com.comphenix.protocol.reflect.IntEnum;
what is the equivalent?
just removed that part dont need it
You can't move. A negative speed xD
That's a new one
?paste
https://paste.md-5.net/jafugeqeha.cs
Im trying to add 1 persistentData named Q-Stacks,
but this commands always return 1 and Q-stacks is still 0, what is wrong?
Is 1.19 spigot working and stable to large scale development? Or would it be worth using something like purpur for newer versions as I have in the past?
purpur builds on paper and paper builds on spigot.
So if spigot isnt ready then purpur isnt as well.
anyone ever tried converting a string with chat color to grayscale
I'm aware of that but they make slight changes, is spigot 1.19 released? As far as I'm aware it is
spigot 1.19.2 is stable and released
Tbh idek when 1.19 or even 18 released, don't usually use / work on newer version, but for this project it makes sense to
Aight thanks
OOF the plib wrapper dont work for 1.19
Last update I followed was 1.10, know nothing about everything after that
They do. Just look at the nms packet. I think its an IntList instead of an int[] now
I get this
FieldAccessException
Oh you mean the wrapper classes... yeah they are outdated for years now
how? only worked with wrappers before
How to check if some players from List are close enough to some locations? (every tick)
Go to wiki.vg and look at the fields
What is the best way?
Do newer versions of spigot have a way to set the defense value of armour without giving it protection 1000000?
How to add values in persistentData?
yea and then? I have:
PacketContainer packet = PROTOCOL_MANAGER.createPacket(PacketType.Play.Server.SPAWN_ENTITY);
which methods do I need?
for these:
WrapperPlayServerSpawnEntity entity = new WrapperPlayServerSpawnEntity(packet);
entity.setType(EntityType.ITEM_FRAME);
entity.setUniqueId(UUID.randomUUID());
entity.setEntityID(ID_GENERATOR.getAndIncrement());
entity.setX(x);
entity.setY(y);
entity.setZ(z);
entity.setObjectData(direction);
entity.setYaw(YAW[direction]);
entity.setPitch(PITCH[direction]);
how do I know which fieldIndex for example Type -> VarInt is?
is it 2? or 3?
or can I use packet.setMeta method?
should just use mojang mappings
nah
this correct for setting Type = ItemFrame
packet.getIntegers().write(1, ...);
Do newer versions of spigot have a way to set the defense value of armour without giving it protection 1000000?
I can't find the method for Angles tho
I still can't warp my head around how to seperate worlds efficiently, should I create a new object for each world?
Like if I have an enum of gamestates, could I create a gameMap object that has it's own gamestate? I'm really confused
What are you separating worlds for?
for minigame maps
Could take the hypixel approach and have minigame servers
Bungeecord is the most effective way i believe
yea i know servers are way easier, but is there a way to do this with worlds?
ofc there is a way to do it all in one world as well
Just depends what u wanna make and stuff
if its like uhc or smth then u kinda need multiple servers for performance
if its tnt tag then u can do it on one
assuming ur code isn't shit
Yes, all I want to do is handle all the events/game states for the worlds seperatly. But I also want to minimize duped code, what's the best way of doing this?
a simple minigame that has parkour, and two players with bows trying to shoot them off, I already got that mostly sorted, but now I need to add more maps so the whole thing kinda breaks down
there is only one world, (ie. one game at a time, dumb, I know, but it's a really small server)
It's probs because you hardcoded alot of it around one map
I can't see your whole project so idk how to help you but you should be able to figure it out yourself, just use enums for gamestates and you can have a var in the enum for the world or smth and use that
All good
you want to make a fake itemframe map?
yea but I think I got it
you gotta send like 3 different packets
and for destroying:
ENTITY_DESTROY
player.sendMap(view)
I alr. got it to work for 1.18 but 1.19 packet wrapper doesn't work anymore
you send the mapPacket yourself?
can't I get the Array of VarInt EntityID's using
packet.getIntegerArrays().write(0, ...);
or is it IntLists?
Automatic creation of different runnables for every player, and deleting it when they leave, is it good idea?
The nms packet contains an IntList
No. Create one runnable and add/remove players to/from it.
Version?
And you are using ExactChoice for ingredients?
ok i tried intarray ._.
Well then its a simple ingredient missmatch. Make sure to never reload your server because it almost always breaks something
Okay, i have list of uuids of players that should be added to some runnable, how exactly i have to do it?
Why do you need a hashmap for this??
Ok this is a really dumb question, but I've gone to StackOverflow at least 6 times now, why can't I call this?
public class WorldManager {
public List<String> worlds = new ArrayList<String>();
public void setWorlds(List<String> worlds) {
this.worlds = worlds;
}
setWorlds() //Can't call? Invalid method declaration return type required??
}
And i hope that you are always cloning the item and never use the original, right?
You are trying to run code in your class again...
1 - you're not calling the method inside of any code block
2 - your method has params which you are not filling
this isn't python
damn thanks
An i hope that this "item" is never given to a player. Only a clone of it.
bruh hypixel wannabe hackers are forking my skyblock core thinking it's the real shit
mutability
What are you trying to do?
well you gotta save your recipes
it adds to the recipe iterator thing
the server doesn't save recipes
it just has a registry that fills up with contents during startup
No. You are adding it on every restart no reason to save them.
make your own config or something yeah
I have option to hit player from certain location
I need to hit certain players when they get close enough to that location so i have to check player location every tick
huh idk why but my packet spawns a mob (ally if thats the name of the one new mob) instead of item frames ._.
Thats quite expensive but you will see.
Well then just create a runnable that has access to all players and all locations that need to be checked.
No need to add players to the runnable because you can just iterate over Bukkit.getPlayers()
entity type id
calling EntityType.WHATEVER.getTypeId returns the wrong id when it comes to protocol
you either mess with the registry or hardcode it
45
yep
show code
private static void setItemFrameData(@NotNull PacketContainer packet, int entityID, double x, double y, double z, int direction) {
packet.getIntegers().write(0, entityID);
packet.getIntegers().write(1, 45);
// packet -> set unique id
packet.getDoubles().write(0, x);
packet.getDoubles().write(1, y);
packet.getDoubles().write(2, z);
packet.getIntegers().write(4, direction);
packet.getIntegers().write(3, (int) (YAW[direction] * 256.0F / 360.0F));
packet.getIntegers().write(2, (int) (PITCH[direction] * 256.0F / 360.0F));
}
yeah that's not gonna awork
whats wrong
are you using SPAWN_ENTITY or are you using SPAWN_ENTITY_LIVING?
SPAWN_ENTITY
like this?
Yeah
is it field index 0?
yeah
ty let me test
but wait are my indexes messed up cause entityID
somewhat
0 -> id
1 -> xVel
2 -> yVel
3 -> zVel
4 -> pitch?
5 -> yaw
6 -> data (entity type specific)
in PlayerQuitEvent, if i set the player's health to 0 using setHealth, will it actually kill him? well since he logged out already
yes
why xVel etc arent these short?
well
the packet stores it as ints internally
but serializes it as shorts
xRot and yRot are serialized as bytes
still stored as int
okay, and if someone was during combat (more like the built-in system of minecraft) would the death message still be like the person died because the other guy killed him or is it just gonna be "Player died."?
Try it and see
and how do you found out this indexing?
alright, thanks
decompile the nms packet
π€‘
protocollib just writes the fields
I have a guide that does a basic demo on how it worky
wrote it a while ago when 1.17 was the latest ver
but when I use getIntegers.write(); which index do I need? the same as nms stuff
with class you mean this? from top to bottom? thats what I did
wiki.vg doesn't reflect the nms format
but it's useful for cross-referencing unknown variables
wiki.vg matches this part
this shit so confusing
wiki.vg reflects the true protocol, and not how nms handles it
ProtocolLib just grabs the objects you're writing and uses reflections to write it to the internal nms packet "handle"
Let's take a basic example
and make our own bootleg packet
in pseudocode because I can't bother
np thanks :D
ClientboundWhateverPacket {
x : int
y : int
z : float
write(buffer) {
writeLong(x)
writeInt(y)
writeFloat(z)
}
}
wiki.vg will say:
- x is a long
- y is an int
- z is a float
ProtocolLib will say:
- x is int id 0
- y is int id 1
- z is float id 0
ok so if I want to know index I need to decomp and look myself
yeah
wiki.vg is the list
but it reflects the contents that are serialized and not the fields in the packet class
It's also quicker to decompile
you can just middle-click on intellij
or Ctrl+B iirc
but wiki doesn't give me index
wiki.vg's index is top-to-bottom
I honestly just use wiki.vg to see what packets I can mess with
There is a way to create packets the wiki.vg way
and it's to like
create a bytebuf
write the contents with the wiki.vg format
and use the bytebuf constructor
Example
ByteBuf byteBuf = Unpooled.buffer();
FriendlyByteBuf buffer = new FriendlyByteBuf(byteBuf);
buffer.writeVarInt(123);
PacketWhatever packet = new PacketWhatever(buffer);
sendPacket
tho it's hacky
and I've only seen it use in a plugin once
ok thank you very much, let me try to
in EntityDamageByEntityEvent, e.getEntity is the entity who attacked and e.getDamager() will be the one who got attacked, right?
or is it the exact opposite
thanks
this is kinda wrong I think
this should work if yours would be true but I get this error:
Caused by: com.comphenix.protocol.reflect.FieldAccessException: Field index 6 is out of bounds for length 5
at com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[?:?]
at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:289) ~[?:?]
at com.squidxtv.frameui.packets.PacketManager.setItemFrameData(PacketManager.java:56) ~[?:?]
at com.squidxtv.frameui.packets.PacketManager.sendItemFrame(PacketManager.java:36) ~[?:?]
at com.squidxtv.frameui.core.Screen.loadItemFrames(Screen.java:70) ~[?:?]
at com.squidxtv.frameui.core.Screen.<init>(Screen.java:49) ~[?:?]
at com.squidxtv.frameui.commands.ScreenCommand.onCommand(ScreenCommand.java:36) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]
... 23 more
or did I smth wrong
oh ok
where can I find it in my ide?
nvm found
nvm I found the spigot api but where can I find this nms stuff
uh
plugins {
id 'java'
}
group = 'com.squidxtv'
version = "${version}"
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven { url "https://repo.dmulloy2.net/repository/public/" }
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
implementation 'org.jetbrains:annotations:23.0.0'
compileOnly "org.spigotmc:spigot-api:${spigot_version}"
compileOnly group: "com.comphenix.protocol", name: "ProtocolLib", version: "${protocollib_version}"
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
yeah you importing spigot-api
spigot-api
change it to spigot
if it doesn't recognize, run buildtools
or you can just run mojmappings
ok ty
mojmappings build.gradle
add
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = "https://repo.papermc.io/repository/maven-public/" }
}
}
to your settings.gradle to access it
and change the version as well
should I copy this?
no I want to stay with spigot,
I actually started with PaperMC for this project but I wasn't sure if spigot server could use paper plugins
they can for the most part
if you want to stay with spigot, change spigot-api to spigot
and maybe run buildtools
you'll have obfuscated nms
which is a pain but I'm used to it
Then the packets will be like PacketPlayOutWhatever
and why is it called nms?
its the package, net.minecraft.server - initials are n.m.s
Do newer versions of spigot have a way to set the defense value of armour without giving it protection 1000000?
yes
How?