#help-development
1 messages · Page 979 of 1
i need to maintain a boolean on true for certain time
There is literally no value for that. Not described on the wiki and looking at the nbt tags doesnt show anything either.
so?
perhaps it was added, I don't recall, code is old
Clone the repo and let your IDE resolve the usage i guess
intellij is useless
pls, help
has never had it. Old exp bottle plugins store a value in the lore.
No, this will result in random behavior for around 2 seconds and after that its always true.
ok, then is there way to set tags in itemstacks
can you sow me? pls
new BukkitRunnable(){
@Override
public void run() {
combat = true;
}
}.runTaskTimer(main, 0, 50L)
and this is right?
only this code
BukkitTask run = new BukkitRunnable(){
@Override
public void run() {
combat = true;
}
}.runTaskTimer(main, 0, 50L);
run.cancel();
combat = false;
or this? xd
This would set the combat boolean to true every 50 ticks.
This does nothing besides setting the combat variable to false once.
the second one woudl error instantly
can;t cancel the task thats not yet scheduled error
I need to set that variable to false forever until the event is executed again
public void entitydama(EntityDamageByEntityEvent e)
Then set it to false, and back to true when the event is called...
BukkitTask run = new BukkitRunnable(){
@Override
public void run() {
combat = true;
}
}.runTaskTimer(main, 0, 50L);
combat = false`
like that?
can you explain me with code pls? im not expert haha
Nope. This code doesnt make a lot of sense.
can you explain me with a code?
pls
I dont even know what you are trying to do...
im trying to do this
@EventHandler
public void entitydama(EntityDamageByEntityEvent e){
if(e.getDamager() instanceof Player && e.getEntity() instanceof Player){
Player p = (Player) e.getEntity();
Player k = (Player) e.getDamager();
BukkitTask run = new BukkitRunnable(){
@Override
public void run() {
combat = true;
}
}.runTaskTimer(main, 0, 50L);
}
}
when the event is called the boolean combat sets to true
and after 10 seconds set it to false
why?
I want to make a combat logger type
you realize this is a single boolean so it will be set for anyone attackign anyone?
Track a timestamp when the player is damaged.
Then every time you want to know when he was last damaged, just check the timestamp and how far it lies in the past.
Thats another issue
...
Is that a moment for a certain suggestion?
So, the biggie question, is there a Spigot API for DataComponents?
yes, but i have 2 messages
p.getName() fall into the void
and
ItemMeta
p.getName() fall into the void by killer.getName()
and i working with that with booleans
can you explain me how
scrap the boolean
can i set this to false after a certain time¿
how?
for custom data
pdc?
add a tag to the Player PDC with the last player attacker and the time
thats a waste of your and my time
why
it will not do what you think it will
how can i do that
In EntityDamageByEntityEvent (if both are players) get the attacked players PDC, set two entries. "last_damager" and a PersistentDataType.LONG for System.currentTimeMillis().
In the death event read the players PDC for last damager and the time, if it's within 10 seconds you send your second message.
?pdc
so, what is the best way now to store custom data for an item
and this custom tag container is per item?
Yes
no different than it was a year ago
I want to cancel the fact that an item get damaged on the BlockBreakEvent, I don't want to set the item to unbreakable tho
how do i do that
Generally with the PlayerItemDamageEvent. A bit more context would be nice.
I made a slimefun item that uses electricity as durability, so when the electricity is 0 the event of breaking the block gets cancelled altogether and a message pops out saying "Charge your tool", I didn't define the itemstacks in a static context and now ofc it fails if i try to set it to unbreakeable within a static context, so i either use another event or when blockBreakEvent is called i make the tool unbreakable, but i am worried that if doing so it will damage the item by 1 witch is a pain in the ass
What prevents you from just making the ItemStack unbreakable if it never uses any durability anyways?
I created the items in an enum thinking it would be more sustainable however it was a stupid decision, if I just made a class filled to the brim with static public variables "like slimefun does btw" i could have just reference the item from a static context and set it to unbreakable like this
static {
item.getMeta().setUnbreakable(true)
}
but i don't want to refactor lol
Am trying to set it to unbreakable on break, if it doesn't work I guess i will just use that
yeah doesn't work guess am gonna use that event
that was it ty
anyone know why this doesnt send if they arent on 1.12 and lower?
Print out the protocol version
i think its the scheduler
I mean... 762 is in fact not <= 340, so the code works as expected
Print out the protocol version
Print out the protocol version
im aware
then don't join with 1.19.4
this value should not be trusted when viaversion is on the server
no way its retrooper
the way viaversion works is it modifies the protocol version so that the server thinks the client is the same version, allowing it to join
so if viaversion is on the server use viaversion API
oh
smh
same applies for protocolsupport
there?
it wont print. its the scheduler

That doesnt make any sense. Just print out the damn protocol value when you join with an 1.8 account
So it prints 762 when you join with 1.8?
yes
Alright then you have a protocol mapper installed like retropper suggested. Viaversion i suppose?
?
Ah i see. Do you have ViaBackwards installed or is your server on 1.8 running viaversion for forward compatability?
first you need to check if viaversion is on your server, with an if statement somewhere. if that is the case, use via api to access protocol version
if that is not the case
read it from the packet
In which event are you checking the protocol version?
my join event
Then delay the check by a few ticks
no
Its in ticks. And this doesnt delay the check.
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
Bukkit.getScheduler.scheduleSyncDelayedTask(() -> {
ViaAPI api = Via.getAPI();
int version = api.getPlayerVersion(player);
if(version <= 340) {
player.sendMessage("Go somewhere else with your garbage legacy software or whatever");
}
}, 80);
}
80 ticks is about 4s
there
I'm being too hopeful but is there anyway this magical 1.20.5 update also added support for crafting with multiple items?
No but you can handle that yourself
Minecraft fundamentally doesnt support this, and the chance that this ever gets implemented is quite slim
thought so yeah
But with some trickery its possible
hm?
I mean worst case I can always remake the crafting table
it's not too horrible
You can make use of the crafting events for that
PrepareItemCraftEvent and CraftItemEvent
There's a mod for it 👀 So it's not like it's impossible
Good ole Polymorph https://www.curseforge.com/minecraft/mc-mods/polymorph
I'd imagine the only reason Mojang doesn't add this is because they just don't need to. All of their recipes are and likely forever will be unique
Oh shoot that actually cuts out 90% of the work
Which isn't necessarily guaranteed in a modded environment
This is better
I already have a plugin that does this.
https://www.spigotmc.org/resources/viaversionstatus.66959/
80/20 = 5...? what
You needed to delay the version check as well, right?
Choco you silly that’s not what they want
They want stacked ingredients like hypixel skyblock
pekhui beter
wait that isnt a scale mod
decieving name smh
Oh multiple ingredients
No, I don't think so.
I delay the message to the client so it doesn't get lost in the MOTD and so that displayName is set.
But I can get the client protocol in the join event.
You think this'll be possible with the new components system?
punches air
But nothing happens since no event is fired
emotional damage event gets fired
new api?
spigot releases client side mods fabric mods to add new api to stuff when
when the ProjectileHitEvent is called, the projectile's location is not the actual hit location. How can I get it? I am currently using ray trace, but i want to know if there is a better way
Yeah if minecraft doesnt let us force inject java code into any client that connects, what is it even good for?
That’s what log4j was for
Let me check that
Schrödingers ProjectileHitEvent
Anyways since i had arrows and particles setup i made this weird spiral arrow thing
anyone know why remapper is throwing an Unsupported class file major version 65 errors
thought i was
You could also just be using outdated plugins
remapper is 1.4.0
You need to use the latest version
Idk what it is 1.4.3 maybe?
1.4.2? 1.4.1 idk? Check it
i didn't see any mention when i looked for it, it is because of updates to specialsource?
2.0.3?
Sounds about right
2.0.3 was released yesterday
where would I find the remapper version
oh, i didn't see it
Discover specialsource-maven-plugin in the net.md-5 namespace. Explore metadata, contributors, the Maven POM file, and more.
i look on maven central myself
yes, it says the Mojang Spigot Remapper version for gradle is 1.4.0
thats what i got
wait, how come maven central doesn't receive updates?
what plugin do you use
io.github.patrick.remapper
it most likely isnt updated
You might be able to make it use a more recent ss
is there something else (perhaps better) to use?
But idk gradle
theres loads on gradle central but idk how good/trustable they are
yeh, gradle and kotlin
best bet is either make ur own or update patrick's
right, lemme see if i can just compile that plugin with latest ss
Epic where is your version smh
uhhhhhhhhhhh
its a lot of effort that my braind oesnt have in it
at the moment
mayb soon
Only half a brain cell
bit of an over-estimate
cant believe you gave me half a brain cell
ive got like a tenth
welp, not making any progress to update this gradle plugin
Hello! My name is Jordy and I am trying to set up an AWS t2.micro EC2 for a minecraft server. Is there anyone with guidance?
Shouldn't be that difficult
Introduction This blog covers how to deploy your own personal Minecraft Java server on AWS. Hosting your server on AWS can eliminate common networking challenges and security concerns associated with at-home servers. Because you have control over the virtual machine, you can configure any mods or plugins that you want. We will use Amazon Elastic...
yo thanks so much lol
Sounds expensive
Hard bc paper has devbundle zips
That im pretty sure contain paperclip
spigotclip when 
do you think it's expensive if it's just a personal server? also what do you think could be the player limit for just a small server?
its hard to tell the limit before you know what plugins you’re gonna run, how many chunks on average that the server is gonna have to tick concurrently etc
but maybe 20-30 given an educated guess
just guesswork tho
But there's a chance right? ...right? 🥲
do you mind if I add you for any guidance I may need in the future?
I don’t mind :)
AWS bandwidth is very expensive. Linode, DigitalOcean much much cheaper
Thank you so much for that insight
am i allowed to paste an image for help?
only verified users can paste images
I suspect most people here both use and recommend intellij
delete module-info.java
because 1) plugins dont use modules; 2) if you really did want to try and use modules, then you need to put the corretc info in module-info which you didnt
gotcha literally happiest man alive right now
How can I get the state of a player's skin hat layer visibility?
While they're connected to the server, I should have access to that information, right?
?bt
The server itself never downloads the Skin, so it wouldnt know.
All visible skins are just a URL and signature which are sent from the server to the client.
The client then requests the Skin from Mojang and displays it
What you could do is actually download the skin (possibly as a BufferedImage) and then check the layers
ohhh so skin urls are not processed by the server
the ones in playerprofile
i'm gonna replace my value signature system for urls
and make md happy by using the api
I'm talking about this functionality: Players can toggle the outer layer of different sections of their skin on and off
https://i.danidipp.com/_lHod.gif
It's transferred via the server to other players in real time, so I should have access to read it's state, right?
It does some checks on the URL but otherwise its not doing any requests
I am not sure if it is in the API, but you can listen to this packet.
that might work thanks!
whats the approach for talking between servers? If I use redis and send packets between them, is it out of scope for the packet to know it behaviour? (should the packet only contain data and the action is processed on the reading side)?
Redis is one option. You can use packets that contain only data and create your own protocol on that, or you can use something like PRCs (Remote Procedure Calls)
so packets that have a method to use their own data is out of scope?
What are you trying to do?
a lot. this can be used for kicking players if you are not on the same server as they are
or send messages to them
In those cases you dont need a response from the server, right?
yes, why?
In which case you should create a concrete protocol with packets only containing data
so an event system
I had a plugin made for me and I'm trying to set the configs right now, but I can't get the attack speed to work right. Any suggestions?
I've put 0, 1.6, -3, stuff like that there
Idk what to put to make it normal 😭
how do i ensure that the listener do the right thing :( everyone can listen to the packets and theoretically do anything with them
You just have the same plugin on all servers. Then you define the protocol in your plugin and everyone knows what to do when they get a packet.
if all of them have the class, then why not have the method in the class too?
i thoguht the data approach was for when the class is not there
1.6 is the default for swords.
Yes I know but like I said that doesn't set it to 1.6.
Sounds like a problem for the dev of the plugin then
There wouldn't be anything in the code that would do that
It's just the attribute we're using
I dont understand what this is even supposed to mean...
can i turn an integer (that hit the integer limit) to a biginteger
maybe
if(myint == Integer.MAX_Value) {
BigInt bigInt = myint;
}
honestly for simplicity sake I would use a long
i can't
i want to get Player#getExp even after int limit
without keeping track for the xp myself
32 bits are 32 bits. There is nothing you can do unless you want to lose precision.
I want to place a structure layer by layer, is there an alternative to hardcoding a 3dimensional array and cyclicing thru it?
what if i do the formula for xp increment backwards on a long
Not really. If you want to place one slice at a time, then you need to iterate over an array and place one slice at a time.
No idea what thats supposed to mean
I have slabs and stairs in the mix, i tought using setType was a good idea but it doesnt keep track of the orientation of the stairs/slabs, what can i do?
Use BlockData instead
i can place a blockdata?
there must be a formula that minecraft uses to increase the xp you need every time you level
what if i do the formula backwards on the level
on a long
Block is really just a position in the World. even setType technically just changes the BlockData.
So setting the entire BlockData and not creating a new one through the Material, is the way to go.
what method allows me to do that? i only know settype
didnt work with blocks a lot
How fast does your levelling system level players up? Are you giving them like tens of millions of xp every second or something?
There is a formula which determines the xp needed for a levelup.
The data is stored in an int.
You have no long and a mathematical function can not be "done backwards".
I have literally no idea what you mean by that.
if you struggling due to hitting the total xp cap, you can always use sendExperienceChange and keep track of the internally total exp yourself
He doesnt want to track the xp himself
He wants to store trillions of xp in an integer, no matter what
well not like they have an option if they decide to go over integer limit on the total xp
In theory, if they are fine losing some precision, they could convert the integer bits and manually calculate a mantissa, base and exponent.
Which means you would probably only be able to increment your xp in steps of 8, 16, 32 etc, based on how much precision you want to lose vs the incremented size
Yea
But thats bonkers
I mean going to the trillions is already a bit goofy
How can I get all NBTs Tag in 1.20.5?
What for?
Spigot api doesnt really expose nbt, it abstracts over it
I need to take all nbt tags (key and value) of an ItemStack
Alright, we got so far already. But what for?
for a plugin that set and get custom metadata to itemstack
Pdc?
thanks
they can afk for weeks at a time
and they get like 100 xp every 4 seconds
Keep track of the xp yourself and just store it in the players PDC
I can compile --rev 1.20.4 with the latest BuildTools.jar (#181), but I cant compile --rev 1.20.5 with the same BuildTools.jar. The error I get is "[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project spigot-api: Fatal error compiling: error: release version 17 not supported" but i'm using OpenJDK 22 (also tried 21 with the same result) on a Fedora server. If I go digging, and i dont know if this is related, I find that the ./Spigot/Spigot-API/pom.xml which gets pulled down from the git repo during the build process contains the following:
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.5-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Spigot-API</name>
<url>https://www.spigotmc.org/</url>
<description>An enhanced plugin API for Minecraft servers.</description>
<properties>
<skipTests>true</skipTests>
** <maven.compiler.release>17</maven.compiler.release>**
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Anybody got any ideas to build on this for a solution please?
public static long getXPFromLevel(int level) {
if (level >= 1 && level <= 16) {
return (long) (Math.pow(level, 2) + 6 * level);
}
else if (level >= 17 && level <= 31) {
return (long) ( 2.5 * Math.pow(level, 2) - 40.5 * level + 360);
}
else if (level >= 32) {
return (long) (4.5 * Math.pow(level, 2) - 162.5 * level + 2220);
}
else {
return 0l;
}
}```
i found this online which turns level to xp as a long
and it looks accurate to me
What event is used that can check when you swap a item in your inventory with another? https://cdn.discordapp.com/attachments/154927412394590208/1233344169376743477/MedalTVMinecraft20240426110742.mkv?ex=662cc0c4&is=662b6f44&hm=220d2977ec94b1eaa2002fd8a21cd2764df503bf6d10404ab5b991cea0d66818&
First off, thats creative so good luck with that
did you check to see if there is an updated buildtools jar?
also, do you have git installed or are you using the provided version from buildtools?
As smile said, just keep track of it yourself, free real estate
this seems like a better way ngl
It looks accurate yep
keeping track would be pain
Nah not really
There are some major advantages if you track it yourself, for instance being able to access it even if the player is offline, or if you wanna do some data analysis on the levels and exp
Yes. Definitely using the latest BuildTools.jar. I also double checked by grabbing a new copy to see if that was the problem
and git?
And I do have a regular git version installed. How would that make a difference?
be surprised in how much issues it causes for whatever reason
anyways, maybe see if it can be updated?
smile said to keep track of it through PDC so you cant access it while theyre offline
oh also probably wise to check on your maven install as well
if anyone has ever played bedwars can you tell me what entity type is the diamond cube spinning in diamond generator
Im already using git 2.44.0 which looks to be the latest version
I mean PDC is one way, I probably wouldnt stick w PDC but yea
I Can remove the package and let it use the maven version if you think thats worth a try?
nah, typically using git and maven installs instead of the ones buildtools pulls in generally clears up many issues
but if your git and maven are up to date, then it points to openjdk being the most likely issue
or you need to clear out your maven plugins
and let those get re-downloaded
I dont have my own maven install. Im not a java developer in any way, so while im using a vanilla git, im using a BuildTools maven
well you don't need to be a developer to have it installed lol
Yeah I know 🙂 But i was wondering if its worth me installing maven myself instead of relying on the BuildTools version
maybe see if installing maven specifically clears up anything? It may not solve anything but it rules out that possibility
So you dont think this in the pom.xml is related?
<maven.compiler.release>17</maven.compiler.release>
it just tells the compiler to use java 17
well compile for java 17
if you are using a higher version, it still can compile for lower versions
Which isnt compatible with 1.20.5 tho, is it?
and is more of an issue if you had less then version 17
it should be
Mojang as far as I am aware hasn't updated the java version to be used since java 17 I think it was or 18
which was increased from 8 to 17
Java Version
Mojang has decided to make Minecraft 1.20.5 require Java 21 or later. This is a Long-Term-Support (LTS) version and will be the recommended Java version until either a new LTS is released or Mojang requires an upgrade. For Linux users in particular, because this version is still quite new, you may need to install it from a third party such as Azul Zulu if it is not available in your package manager. Note this must be a JDK not JRE.
oh guess they did do that
Cuz it looks like the pom.xml in the spigot repo is incompatible with itself if thats the case
well in that case the only way to get around this issue of yours is to install maven and run maven on the parent project for spigot
so that the changes you made in the pom are reflected
Yeah I tried changing the pom myself, but BuildTools just downloads a fresh version during build and overwrites my changes
Theres probably a way to override that, but i havent got that far
If this is an upstream issue, I figured that was the best place to fix it
I am aware, hence I said you need to install maven and run the maven command to invoke the parent pom
buildtools just runs a bunch of commands for you just fyi, so that means anything it does you could just do manually yourself if needed or wanted to
I cant be the first person to discover this tho can I? This would mean that nobody has been able to build spigot 1.20.5 since it was releaased
@kind hatch any ideas??
so, install maven, make your changes to the appropriate pom, then go into the directory called spigot
and run mvn package
and it should build from the parent pom and then give you a jar in the spigot-server directory
It builds fine for me
version 1.20.5?
I would guess that your JDK distro doesn't like release mode Java 17
yes
yeah that was going to be my next thing was that its something with open jdk
which this wouldn't be the first time someone had issues with open jdk
Fair comment 🙂
The only people I've seen have that problem are all running OpenJDK
yep, hence I have always stuck with oracle jdk lol
I think there’s a bug that causes the build to fail if the directory contains spaces.
Spaces work fine
I use eclipse turnium
People kept running into issues like that yesterday.
same
I am pretty sure that was a windows issue wasn't it? I don't recall ever having that issue on any linux distro
Directory contains no spaces
I've been using a space in my windows path for a couple of years now
That bug must be very old if that's the case
it is
Idk. People using Fedora and Kubuntu were having issues too.
Try a different jdk and come back after
Just grab adoptium
My only other thought is that there is a bug with the jdk.
Ok cool. Thanks everyone. I'll try a different JDK and see how that goes
well as I said, this wouldn't be the first time there was issues with using open jdk
its like every so often open jdk decides it is just going to be weird for no reason
I do know that I have a slightly older jdk than some other people who have been having issues.
I’ve got openjdk 21.0.2 installed and not 21.0.3
Entity death gets logged at console for some reason. My plugin gives them a custom name tag but there is no EntityDeathEvent or anything to log them.
Hey. I was banned on Spigot but I don't know why. Can you help me?
I'm guessing cloudflare. Get off a vpn or change your ip. You got an IP that was banned for mischief by happenstance
Yes refuse to listen to me than admit to something that is frowned upon 💯
?
He said he doesnt have a vpn
🙃
or
or use vpn basically
You can ask your isp to change your ip
Haha
Many thanks @wet breach @river oracle and @kind hatch . That seems to have solved the problem. Cheers!
Just call them or just restart your internet most ips are dynamic now days
It's not hard

glad its resolved for you
Most ISPs won't give you a new IP as they are dynamic. Turn off your modem for a day.
If it's dynamic you don't even need to wait
Yeah you might. Here in teh UK with Virgin Media your ip stays the same for years if your modem stay on
In the US it's fairly standard AFAIK to have its that refresh every x amount of time
It does refresh but you still generally get the same IP assigned
Ah Bad luck
only way to drop it is turn off your modem so some other schmuch gets your IP assigned.
in 10 years my IP has changed twice, usually when there was a service outage.
Wow I can change my ip as much as I want in a day
in the US usually its like 3-7 days and with the larger carriers it can be as long as 30 days. But that is for automatic refresh. Generally you can force the refresh if you do as Elgar said and restart the modem
There's not a event that checks if a item gets swapped ?
click event
but you are using Creative inventory so theres pretty much one event for that
declaration: package: org.bukkit.event.inventory, class: InventoryCreativeEvent
I tried that, but that didn't work?
@EventHandler
public void inventoryBlacklistMoveEvent(InventoryCreativeEvent event) {
if (event.getCursor().getType().name().endsWith("CONCRETE")) {
event.setCancelled(false);
} else {
event.setCancelled(true);
}
}```
Have you tried debugging
no
yeah, I know..
what exactly are you trying to prevent?
If the player grabs anything that isn't concrete I cancel the event
It's a blacklist for my server
from teh looks of that code, you want to cancel only if the item on teh cursor (picked up) name ends with concrete.
oh no actually
you cancel everythgin except for concrete
Yes
So your code cancels if they DONT have a stack of concrete already picked up
It detects when I grab concrete, but it doesn't cancel the event if I don't pick concrete
that code you posted will only cancel if you have already picked up concrete
um no
yes. Debug it so you can see
sysout whats on teh cursor
?
sysout event.getCursor().getType().name()
It says creative
I can't upload images here
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
There
@EventHandler
public void inventoryBlacklistMoveEvent(InventoryCreativeEvent event) {
event.setCancelled(true);
event.getWhoClicked().sendMessage(event.getClick().name());
}
}```
That is not what I told you to do
uh you can't stop a creative mode player from picking up an item in their inventory
sysout results in an error
The client has control over that
No but I mean switching an item with another one?
The client is boss in Creative
Oh
Any alternatives? Since I kind of don't want players to get anything else except concrete
you should still be able to set the contents after the event
however I doubt you can prevent dropping
But you still can prevent picking up
create yoru own inventory instead of using creative
creative gives too much control to the client
I remember I watched a video where there was a command like /printer which would give creative without letting you take items but it allowed for duping
fill the inventory with items you want them to be able to get. Cancel any click events in that inventory and put a copy of the ItemStack (they clicked) on their cursor.
Alright, guess that's better.. Thanks
You can't reload config with a command while server is running?
You need to support that yourself.
what you mean?
I already made the command with reloadConfig, command works but it just doesnt reload it
a
How do I run a runnable in a syncronized way? I need to break some blocks that is why i can't use an async
?scheduling
Alr, can you place blocks asyncronously?
No
In general don't interact with the world at all async
most things need to be done sync for it to be safe
What i want to try to do is place blocks like an animation, so first layer, second layer, third layer etc
yeah but how do i pause it from placing blocks? i can't jus do Thread.sleep LOL
like place first layer, wait 1 second --> place 2nd layer
The scheduler runs a method
and you can tell it to run that method with a 1 second wait
(20 ticks)
so if i have smth like 7 layers i start 7 runnables 1 layer at a time with delay?
Quick question, how do I loop all blocks and see if any of them are concrete? (not blocks around player)
or just one runnable that keeps track of the layer to place
All registered blocks? All blocks in an inventory?
Registered
Loop over Material#values and check if it ends with _CONCRETE I guess
Unless there is a tag for that
Alternative just manually make a set for it
That's my last option
I am trying to build stuff using block data, if blockdata is null it just places air in its place, why does this not work tho? The loggers work as intended
if(b == null) {
Bukkit.getLogger().info("AIRRRRRRRR!");
w.getBlockAt(x,y,z).setType(Material.AIR);
} else {
Bukkit.getLogger().info("place!");
w.setBlockData(x, y, z, b);
}
There is a setType() on World you can use instead
when using redisson, is there a reason to or not to, create multiple RTopics? When I create a lot to seperate the message transfer, will this be expensive or when only using one will this just struggle with all the messages?
I would simply write a default replacement:
BlockData blockData = ...;
blockData = blockData == null ? Material.AIR.createBlockData() : blockData;
world.setBlockData(blockData, locationOrWhatever);
And pls dont use single character variables
w is the world, neither setType or setBlockData are placing/editing block
It is the same thing but with a ternary, also setBlockData requires a location, but sure
setType with Material just calls setBlockData with the default blockdata anyway
that snippet of code in an isolate is correct and works fine, the issue is somewhere else
are you running this async by any chance?
Probably the offset. I assume its being placed somewhere, just not where he is looking
yeah this is what i just thinked of too, printing location while i am at it
ok i found it ,-,
found the mistake ty for the help in bugfinding
lets see if it works now
works nice ty
hey, is this the right place to ask for help about packet modification?
?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!
Hello, I made very fast and simple plugin for create shower. It isn't work. Idk why, there's no console or game error.
Here's the code:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
Block block = event.getClickedBlock();
// Controlla se il giocatore ha cliccato con il tasto destro del mouse su un blocco
if (action == Action.RIGHT_CLICK_BLOCK) {
player.sendMessage("1");
// Controlla se il blocco è un bottone di pietra
if (block.getType() == Material.STONE_BUTTON) {
player.sendMessage("2");
// Crea un nuovo task che genera particelle d'acqua
new BukkitRunnable() {
@Override
public void run() {
// Controlla se il giocatore è ancora nella zona della doccia
if (player.getLocation().distance(block.getLocation()) <= 3) {
player.sendMessage("3");
// Genera le particelle d'acqua
player.getWorld().spawnParticle(Particle.WATER_SPLASH, block.getLocation().add(0, 1, 0), 10);
player.sendMessage("4");
} else {
// Se il giocatore ha lasciato la zona della doccia, interrompe il task
this.cancel();
}
}
}.runTaskTimer(this, 0L, 20L); // Esegue il task ogni secondo (20 tick)
}
}
}
}```
I have this ProtocolLib PacketAdapter class that should modify a ClientboundLevelChunkWithLightPacket but i cant read the buffer (FieldAccessException: Field index 0 is out of bounds for length 0)
?paste for code walls
there are 2 code walls right now
a new one gets posted and no one sees yours
just use a pastebin
many here don;t even bother reading code walls. Formatting is all bad.
that's one reason why
updated my message
You didnt properly create a spigot plugin, you didnt register your Listener, you dont even have a Listener.
https://www.spigotmc.org/wiki/spigot-plugin-development/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
can somebody make cafebabe automatically detect messages with code blocks spanning 20+ lines, delete the message, upload the code to md5's paste and resend the message? :evil_giggle:
ProtocolLib doesnt let you write directly into the byte buffer. It uses reflections to change the fields of the packet object before its being deserialized.
Check the NMS class and see which fields you have there to change.
but i get a error when trying to read the packet
right when i try to read the ByteBuffer in line 3 of the paste
You are getting the error when reading a field from the packet. The packet simply has no byte[] field.
I create it properly, and I don't know how to register a listener, the code is already in the main class cause it's very short
Read those
according to this page https://wiki.vg/Protocol#Chunk_Data_and_Update_Light there is a Data bytearray, is this outdated information?
Nope, but this describes the packets in their serialized state. So after being written into a bytebuffer.
Again: ProtocolLib doesnt let you read those bytes. It accesses fields of the java object, before its (de)serialized to/from bytes.
ok how would i approach this problem then? i know about block updates but im not sure if its smart to send hundreds of individual block updates, every time a chunk gets loaded
You can use ProtocolLib, listen for outgoing packets and modify them before they are being sent out.
What is this for btw?
super(plugin, ListenerPriority.HIGH, PacketType.Play.Server.MAP_CHUNK);
this.plugin = plugin;
}
@Override
public void onPacketSending(PacketEvent event) {
Player player = event.getPlayer();
if (player == null) return;
PacketContainer packetContainer = modifyChunkPacket(event.getPacket());
if (packetContainer != null)
event.setPacket(packetContainer);
}```
(hope this doesnt count as a code wall)
This is where the code from the previous paste is triggered.
its for a "clientside" mining plugin that lets players mine in the same region with different ores they can unlock
ProtocolLib is just a funny reflection utility for packets
I'd recommend cancelling the packet and sending it later to avoid blocking the IO thread and upping the ping
:)
Print out the runtime class of the packet. Because it looks like this should in fact have a byte[] field.
ty good tip
No. Read the blocks from a Database and send the packet right away. It improves the coolness and street cred of your code.
I'd re-compute and re-send the chunk packet on the PlayerMoveEvent in order to ensure the client and the server are 100% in sync

Yes, cant have desyncs
lmao
Let me check how cursed my code was
But send an unload and a load chunk packet after another to have a cleaner map for the player
oh no
And call System.gc() after that so the server is kept clean as well
And to ensure the client has all blocks, make sure you send a block update packet for each block on the chunk
On top of the chunk packet
Just in case
In case the dumb client missed a block yeah
Also send a particle wireframe of each block so you know if any of them aren't there
Hello there, I'm experiencing some issues with using POJO objects. Even after cloning them, when I modify elements in the cloned instance, it also affects the ones in the original instance. Can you please help me?
GuiDetails guiDetails = defaultGuiDetails.clone();
this.setPlaceholders(player, guiDetails);
public GuiDetails clone() {
GuiDetails clone = new GuiDetails(inventoryLayout, guiType);
clone.setHolder(holder);
clone.setInventoryName(inventoryName);
clone.setInventorySize(inventorySize);
clone.setPlaceholders(new HashMap<>(placeholders));
clone.setText(text);
for (Map.Entry<Character, GuiElement> entry : elements.entrySet()) {
clone.addElement(entry.getKey(), entry.getValue().clone()); // GuiElement#Clone gets executed
}
return clone;
}
public GuiElement clone() {
return GuiElement.builder()
.material(material)
.displayName(displayName)
.lore(lore)
.amount(amount)
.glow(glow)
.onClick(onClick)
.build();
}
Shallow clone vs deep clone
That's a deep clone
Partially
My problem is with the elements, here:
for (Map.Entry<Character, GuiElement> entry : elements.entrySet()) {
clone.addElement(entry.getKey(), entry.getValue().clone()); // GuiElement#Clone gets executed
}
Oh wait, should I recursively clone also there?
.material(material)
.displayName(displayName)
.lore(lore)
.amount(amount)
.glow(glow)
.onClick(onClick)
.build();
Material.getData() is deprecated, what is the alternative? i need to spawn the particicle of a block being broken
Use the BlockData as the data argument for the particle spawn methods
Problem was here, thank you.
lore(lore != null ? new ArrayList<>(lore) : null)
Hey, is it possible that plugin messaging is broken in 1.20.5?
I'm not receiving any custom payloads anymore.
Any code changes on your side?
I want to access the inventory of a chest what is the difference between
getBlockInventory()
getInventory()
getSnapshotInventory()
@NotNull
Inventory getBlockInventory()
Gets the inventory of the chest block represented by this block state.
If the chest is a double chest, it returns just the portion of the inventory linked to the half of the chest corresponding to this block state.
If the block was changed to a different type in the meantime, the returned inventory might no longer be valid.
If this block state is not placed this will return the captured inventory snapshot instead.
Returns:
the inventory
@NotNull
Inventory getInventory()
Gets the inventory of the block represented by this block state.
If the block was changed to a different type in the meantime, the returned inventory might no longer be valid.
If this block state is not placed this will return the captured inventory snapshot instead.
Specified by:
getInventory in interface InventoryHolder
Returns:
the inventory
@NotNull
Inventory getSnapshotInventory()
Gets the captured inventory snapshot of this container.
The returned inventory is not linked to any block. Any modifications to the returned inventory will not be applied to the block represented by this block state up until BlockState.update(boolean, boolean) has been called.
Returns:
the captured inventory snapshot
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Chest.html#getBlockInventory()
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Container.html#getInventory()
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Container.html#getSnapshotInventory() -> just for querrying
declaration: package: org.bukkit.block, interface: Container
declaration: package: org.bukkit.block, interface: Chest
Recommend downloading Javadocs in your ide.
The text Contained in those links can be found
here
ty how do i download the documentation on intellijidea
Ur using Maven or Gradle?
Maven
(do you have)
pom.xml
or
build.gradle
pom.xml
For gradle: the highlighted button.
i won't need to do it for every project right?
alr nice ty, i won't need to do it everytime right
asset?
plugin probs
define asset
no idea what you mean with asset
this did not make it clearer
Probably a plugin
ohh u want to delete ur plugin post or somethn?
just report ur self with the message "delete pls, thanks"
and mods will get it done
Is spigotmc.org slow rn or is my internet just dying?
See the checkbox on automatically download ? That option ensures that download is done automatically for new projects.
lmao
Hello, im using Mac os. If I run the buildtools, what java is it using?
JRE or JDK?
What version should I use?
For 1.20.5 there was a change that you need the JDK
No, I haven't changed anything
@quaint mantle
more specifically. right here
Then it could be a bug. Feel free to open a bug report on Jira with a minimal reproducable example.
Alright, thanks! Can you give me a link?
you got it!
thx 🙂
then its not your resource...
are you logged in?
if its your resource. you will have an edit button
like i do
either verify or upload to an image hoster
Ok, and what version do you have installed and have used for the buildtools?
You need at least Java 21 for it. No I did not use it.
did you post the resource in the same account ur logged into right now?
if you go here. does it show up?
ye
and now when u click it there is no edit button?
tf
ohhh
gotta enable 2fa ig
uhh yea?
make sure to save ur backup codes?
What's the best attack speed for like a dagger sort of weapon
Has the PotionEffectType DAMAGE_RESISTANCE been removed or renamed in version 1.20.5?
it is, i printed the byteArrays size as well but it doesn't seem to be populated
when i use the nms class i can access the array but i prefer using the protocollib api for compatability reasons
show code
why is there no bungee api stuff in the spigot api overview
https://hub.spigotmc.org/javadocs/spigot/
Because those are completely different types of software
Likley renammed
?jd
thanks
I believe we renammed a bunch of fields to match the Mojang names
So it's probably RESISTANCE
mh right, but why was that not noted anywhere
Does that mean it's gonna be another thing to legacy classload?
just drop support as soon as the new update rolls out for your plugin
easy
no legacy bs
yeah they should update
or play the version of the plugin last released for that version
maybe have lts for game breaking bugs on separate branches
Is there also an overview for older api versions?
but apart from that I usually dont bother
if you find it let me know 😅
I have not found anything so I ask 😄
https://helpch.at/docs/ (Unofficial)
also commit by build tools :kekw:
They really should fix that
Why does it need to configure a global user
Anyone knows why my local maven 1.20.5 repo has no sources and docs jars?
https://postimg.cc/gallery/9zxJ8tm
ah you did nice
(Well, Shadow did :p)
Did you tell BuildTools to generate them?
also I'm not sure if they get installed automatically
No, i didnt. How would I do that?
?bt
Like I said, I have used the buildtools before and never have to to something special to generate those
BT only builds source and JD if you tell it to. Your IDE may download them from the spigot repo if you ask
wondering how many people actually installed java 8 with this
There are indeed flags for --generate-docs and --generate-source, but im 100% sure I never used them before
yeah they're present in the maven repo
They've never worked for me so I just assumed they weren't
if you are using IJ you can click the download sources button and it will search repos for them
I always generate jd/source for every build, so I use switches
I let the buildtools run with the flags, but the stuff is still missing. I was already wondering, why the buildtools are that fast this time. Only about 3 minutes. Guess its because it is skipping most. But why?
If you’ve already run it for a given version a ton of stuff is cached
also, even with the flags it will not create teh final jars for jd and source
Can I delete it somehow before?
How do I create jd and source then?
you zip the produced files
theres probably some way to force it to make jars but I don;t know how
its never made them for me
@chrome beacon just want to tell u I can't believe what what canceling interection event 🤣
it was default spawn protection by mojang
which is in server.properties
is it possible to ignore that for events?
I wonder if event priorities might override that?
I don't remember if it was just priority over other (same) events
I tried with low and monitoring an high
well looks like event is not even fiered
I think I will just add warning in console spaming they should disable that
anyway servers use WG or some other big plugin for protection
That's quite an old source, I feel like there might just be some other way around it. I am not aware of it though
Not that I know of
How to clear persistant data container? Like without namespaced keys
hm? why
for (NamespacedKey keys : container.getKeys()) {```
Rip other plugin data
anyone knows the code to check any spawned unit's base health and how to modify it? same for damage
did you find something?
Since Minecraft is now based on Java 21, what will happen to those plugins based on Java 17? Will they work correctly?
No, need update
The amount of english
Thats cool
Thanks
Now I m going to change all of my 10 plugins :/
Sounds like a question for #help-server
Why do the update?
Most servers wait for the plugins to update
What is the reason that mojang decided to switch to components for items?
It's not like its a big update tbh
It is quite a big update for a minor version
eh
dog armor hammer wind charge
maybe for mojang its big since they do updates once a year
There's a lot more than that
^
Plugins don’t need to update
especially in the way that the server works internally
Really?
Java 17 plugins should run fine on 21
but not the other way around
Correct
Java 8 plugins should even still run
As long as they don’t do janky reflection
Components are good
They are working towards data driven systems
They also did it for performance
any of you familiar with the extended view distance plugin?
FartherViewDistance
I'm wondering if it can be improved, seems to be completely hit and miss on my end
I never sent chunks via packets but I assume the way this would work would be to get the chunk data and send a packet to the player?
Pretty much
but no feedback on what view distance a client has right
I wonder if there's trick around that
I think the client sends that info now
wait, really?
Yeah
oh my god
how the times change
oh I wonder if that might be what broke fartherviewdistance then because I'm using the distant horizons mod
so technically I'm seeing a lot farther than my view distance
does anyone know how I could listen for and potentially cancel any kind of item interaction in an inventory? I don't know why but a simple InventoryInteractEvent listener seemingly doesn't trigger at all
InventoryClickEvent and InventoryDragEvent
hm I was hoping to avoid that split. Oh well then, thanks!
right different problem: Is there an inexpensive way to distinguish a block's inventory from a block-less inventory? I'd like to somehow check if tehre is e.g. a dispenser, and ignore cases where I'm clicking in a player inventory or an inventory opened by the server
the best I could come up with myself is checking if there is a non-air block at getInventory().getLocation() but that seems clunky
Doesn’t work for entities
You can check if getHolder instanceof Container or Instanceof Entity
Oh wait you want to single out blocks
Then yeah just instanceof Container
I suppose that works, thank you so much!
i got my approach almost working but im stuck on reading the LevelChunkSections, it requires some kind of biome registry but when i try to access the net.minecraft.core.Registry there are no entries except for a DEFAULT one. As far as im understanding there should be lots of entries like in the org.bukkit.Registry
https://paste.md-5.net/anazeqegen.cs
What are the types of operations/methods that are resource expensive when using spigot? I want to know them so if i can i dodge them
What do you define as resource expensive? IO calls?
io operations like writing to files and databases
Registries.BIOME
Hi! What is the correct way now to get PotionEffectType from config string? This one is deprecated:
PotionEffectType.getByKey(new NamespacedKey("minecraft", name))
Hey all. My premium plugin was removed- was there some notice about anything happening ?
?support
For help
I haven’t yet logged in to my account I imagine there should be some kind of correspondence there would you know? I just got temp locked lol
Maybe it wasn’t removed and I just can’t view premium plugins when not logged in?
^
IO and everything that changes massive amounts of objects in a single tick. There is nothing inherently slow in the api (besides loading worlds)
Hey, so I have this expansion that is giving an error when loading the plugin:
@Override
public @Nullable String onPlaceholderRequest(Player player, @NotNull String params) {
FileConfiguration data = plugin.data.getConfig();
if (params.contains("_")) {
String[] parts = params.split("_");
String uuid = parts[1];
if (player == null) {
return "";
}
if (params.contains("mission")) {
return data.getString("Missions." + uuid + ".mission");
} else if (params.contains("progress")) {
return data.getString("Missions." + uuid + ".progress");
} else if (params.contains("goal")) {
return "Missions." + uuid + ".goal";
}
}
if (params.equals("money")) {
return String.valueOf(plugin.rewards.getConfig().getDouble("Money"));
}
return "UUID not provided";
}```
this is the error
does someone know why does this happen?
Did you use the /reload command?
i'll try
that didn't work
You cannot
I just finish my plugin and when I went to start the server I received a string error
I'll have to do it when I get home. I was trying to send the screenshot that I saved but can't
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
!verify
Usage: !verify <forums username>
I don't have a forums account.
Then the second part
is it intentional that plugins continue to enable when onLoad throws an exception? 🤔
thats pointless then
its called before onEnable when the plugin is found by the server and it says "loading xyz"
Then it is the other eay around
never mind, it is also the exact same behaviour even if you throw an exception in onEnable lol
shit just continues as if nothing happened
gj
Bukkit 💪🏻
When would you use onLoad ? I always threw everything in onEnable and called it a day
just curious, what changed in 1.20.5 with the netty pipeline?
there used to be an encoder, and it still appears to exist on vanilla, but it's not there on spigot 1.20.5 👀
onLoad isn’t too used, but sometimes it’s nice. Ignore it unless you absolutely need it
As long as it isnt a critical exception it wont stop, a null pointer exception will just stop whatever it is executing, but generally from experirnce fucking up some scheduled programmed task makes bukkit choke on the spot
it literally just catches Throwable and ignores it (apart from logging it)
so even Errors are effectively ignored
👍
Does anyone know a plugin that uses Custom Model Data where I could load 3d model textures into the game while still having the blockbench model thing?
given that you can log in and play, i would argue that the packet encoder is in the pipeline


How to make a custom nametag on entities disappear after being x far away ?
What is wrong with this? I place a block and I don't see a chat message ```
package org.timothy.chest_shops;
import net.md_5.bungee.api.chat.ClickEvent;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class MyEventListener implements Listener {
public void onBlockPlace(BlockPlaceEvent event) {
Bukkit.getServer().broadcastMessage("Sign placed!");
}
public void onPlayerInteract(PlayerInteractEvent event) {
}
}
could it have been renamed?
I have the same code running on unmodified NeoForge/Fabric, and checked the vanilla source, those all seem to match :)
And I did register new MyEventListener in the main class onEnable
Or, fix my code that I tried while trying to use custom model data...?
no reason for that to happen
I don't see an @EventHandler
welp, that is interesting
thanks, I guess I'll keep looking :p
Not really development but does anyone know why my game looks like this 😭
How to make a custom nametag on entities disappear after being x far away ?
Okay I got the picture uploaded of the code https://prnt.sc/cgdzMmPZDe5H
That's the error I got when I first tried out my plugin
Got a question. I am using SignChangeEvent because I am coding something for a prisons server. How can I make it so it has access to the chest the sign is on?
The way its going to work is if I do ```
[shop]
<price>
<amount>
<sell/buy>
You didn't define your command on the plugin.yml
Hm alright I'll have to take another look when I hop back on my PC in a few. Thank you
Hello guys, I'm here for my impossible mission. I need to make a custom tab without the player names, only the roles and how much player with this role are online. Something like this
bro idk
If you are fine with NMS taking over the tab is pretty simple
net.minecraft.server
Basically any code from the vanilla server
Not part of the api and undocumented + subject to change
I think I got this. I know how to hide player, now I have to set all the roles and the custom names in the tab
Hey, so i'm trying to reload the config with this code but when i execute it the config doesn't apply any change and notepad said config has been edited, returning to the same as before editing the file, could someone tell me why is this happening?
What order are the bungeecord api events in?
(The following is for the case where a player joins the proxy forthe first time)
For example, does ServerConnectedEvent fire before PostLoginEvent?
If I cancel the PostLoginEvent does the ServerConnectedEvent still fire? If I kick the player during the PostLoginEvent does the ServerConnectedEvent still fire?
someon can help me with this import error: import net.minecraft.server.v1_18_2_R2.World; error: Cannot resolve symbol 'minecraft'
No, No, No
How to update Essentials
use the latest version?
I use the latest stable version and auto tab complete doesnt work and the console says its because of Essentials
?nms
Compare different mappings with this website: https://mappings.cephx.dev
private void endGame() {
why is it telling me i need to put ";" after ()?
show more code
private void endGame() {
Location spawnLocation = plugin.getSpawnLocation();
if (spawnLocation != null) {
for (Player player : Bukkit.getOnlinePlayers()) {
player.teleport(spawnLocation);```
?paste the class
you have a method in a method
alr thanks. ill fix that
Is anyone able to pm me and help with a code for a gui plugin?
No that's kind of the point of asking here
I'm using better GUI plugin and I'm trying to make it when I click one of the items in the GUI it opens another chest with different world teleports that can be clicked and used to teleport with.
Is this a plugin you are coding yourself? Or a plugin that already exists?
If it's the latter, #help-server
gotcha thanks
its the second
I'm working on a temperature system for a seasons plugin currently. That being said, since Biome.custom is the only representation of a custom biome I can get (unless they are my biomes obv but in this case they are external from a datapack), should I just apply a base temperature range?
https://paste.md-5.net/cohuzukizi.java
okay so im trying to get it where if a player gets hit by the arrow it will teleport them to a set spawn location. but when the player gets hit they dont get teleported but they do recive the message
or does it not work if i just shoot my self with the arrow bc thats what i been doing