#help-development
1 messages · Page 988 of 1

It's not meant to be used as a persistent serializable value
wait u cant have display entities riding on display entities
Javadocs pr
You can
For free
u cant
ItemMeta#getAsString does decidedly NOT return a re-parseable snbt value
X to doubt
it just returns stringified nbt
/summon block_display ~ ~ ~ {Passengers:[{id:"minecraft:block_display",block_state:{Name:"minecraft:clay"}}],block_state:{Name:"minecraft:dirt"}} only shows the clay
oh wait
theyre inside of each other
The only thing it excludes is amount and type, so you'd have to insert those into the resultant string
Shit I can't type today

no no, I'm saying the format of the string returned isn't always re-parseable
Then it's broken because that's what it should be doing
It's not NBT anymore though?
well the implementation is converting it to nbt
everything is nbt
nbt is what is used to store items in game files
Didn't that change
everything can be converted to nbt is what I'm saying
yeah, but it didn't change correctly
Lul
Is there a wait, it’s all NBT meme
it changed from toString'ing the data component patch, to toString'ing the Tag
I see
Yeah that should be returning it as a component-compliant string, not as NBT anymore. The idea was so that it could work in tandem with ItemFactory#createItemStack()
or whatever I called that method
well its not doing that either, its turning the full itemmeta, components and all, into nbt
I'll make a PR. md might want it to be a different method though
which I kind of disagree with. I specifically didn't call it getAsSNBT() for a reason
Another free pr??
the docs do say "an NBT string", so kinda expected
It does, yes, because that's what it was
I didn't know components were coming when I wrote the PR lol
well sure
how would i get the mc version of a server (just mc version, not spigot)
Probably smartest to keep it compatible with the item factory stuff
I'll throw it down in a TODO and do it today
yeah, but it's not. I know I don't care that people wrongly use it as a serialized value
Well yes that's their issue lul
:p If they wanna use that to serialize it to a file or something, sounds like a them problem
I wrote rather clearly that it's not meant to be used that way, so, not my problem
The idea was so it could be put into config files or something
That’s a file
Does it not go through DFU
The ItemFactory method does, yes, but I mean y'know... your mileage may vary
I see
At least I think it goes through the DFU
If the /give command argument does, then yes, it does
I kinda just hijacked the ItemStack command argument
what part of the Transformation constructor is the "position"
Translation
what do i put the rest?
You can keep them as unit matrices/vectors if you'd like. new AxisAngle4f() will give you a unit one
The give command argument certainly does not
Then no, it doesn't 
Idk how either would, they don't include a version
I think the weird yaml representation does maybe
But it's a tad scuffed
no, it does not
item item argument doesn't either
Keep the 2 quaternions as their identity form (just new Quaternionf) and set the other vector to all 1
oh lynx beat me to it
This is why we NMS :(
for a block display i want the scale to be 1, 1, 1 right?
Probably. That will keep it at standard scale
new Vector3f(1) should do the trick there
I wonder if it’ll ever be possible to do NMS between versions without updating
Probably not
Haven't used the bukkit api in years
I mean if bucket didn't relocate you could probably come up with some form of delegation system
Not always
The more NMS you have the higher the chance something will change
There obfuscated names change
I mean I do quite a bit of nms and my dif is pretty small
But sadly not 0
And thus modules go brrr
Meanwhile I somehow managed to have direct code modification for stardew valley last for a few versions
Magic
do i just calculate the difference between the center block (the block containing all passengers) and the currently iterated block and set the transformation translation to the difference x, y, z
Yes
Pretty much
hello, i seem to have an issue with the current build 1.20.6 with build tools. my problem is when I build it and use maven and change the pom to 1.20.6 everything gets imported besides Material? I'm not for sure if I have the correct build.
wdym?
Shulkers have a full block sized hitbox
So you can't easily do a stair block for example
its always a full block so idrc
aw
You can of course do collision server side
But the client will be quite glitchy in that case
for some reason my npc have a really weird body rotation
and yes
they have the same value for pitch and yaw
oh wait how do u teleport the main display and it's a vehicles?
What is the animation id for Hurt? Everywhere I've been googling it says 2 or the wiki 0x22 Neither of them apply the correct animation.
only works for the person who you send it to
i need it for other players to see as well
then hit them with 0 damage
returns a stackoverflow error when i try to do that.
why
🤷
i did test with fire damage.
lava damage i should say
but i have a delay with that to only fire every other sec
EntityDamageEvent
right..
so thats the stackoverflow
each time you get damaged, you try to damage yourself
which calls the event again
i cancel the event tho
whats the goal with this feature
well too late
the event already reached you
then you create another event by damaging yourself
So then yeah i would need th packet animation anyways. to avoid the double calling.
i dont understand
in the event java if (damaged) { damaged = false; return; } damaged = true; //now damage the player
why do you want to damage the player when they are already getting damaged
good question
xd
its my own damage system
i want to go above the default health value
cant you modify the event so its fixed automatically?
then do e.setDamage?
there is also already max health and scale
wdym by that?
what drvoss is saying
yeah i need to ovveride that. that's why I am going outside. canceling all daamage events and passing my own values.
event.setFinalDamage(value)
change parameters on the damage event
i need to go above 2048 yhealth
thats the cap
i want 20k. So i have a value in a map for the real health and do all calcuations on that. if that reaches zzero then i kil the player
then reduce the damage to 0 and do your own thing
then do event.setDamage dawg
why do you feel you need to go to 20k? seems a ridiculous value
no need to cancel the damage if you want the hit effect anyways
setHealthScale can help maybe
he wants to go above the limit
and then u just "emulate" high damage
20k for rpg. i am creating an rpg baed plugin.
yes ik
well for the milioth time just do event.setDamagr
that just displays the amount of rows of hearts. THat wont even show on my server i will have custom texture pack that turns it into a bar.
but I mean, ur system can have high numbers, then u normalize those before visualizing it
so make 1 heart = 2k health
cant you set the position?
Guys how do u check for a logout from a player?
Thx
oh you edited it, detect a logout?
I did my first seen plugin, I am now making a last seen plugin
do you want to see when they log out or as you first ask, when they last logged out?
ok
playerQuitEvent
If a player logs out, store the date in my config
meh at certain scale it still makes sense to store it yourself
its cross-server
possible api compatible
etc etc
for us, we might have a use case. He won't
also true
No but I mean, i need to store the date of the logout if the player leaves the server in my file
So I need to check for that
how?
If player leaves the server, store the date of the log out
no you don't. getlastPlayed IS a date
How do I store it then everytime a player leaves the server?
its already stored in OfflinePlayer. It's a date
Huh
did you even look at the javadoc I linked?
oh or use the teleport function from Entity
u cant
Yes
if it has passengers u cant
it yoinks the passengers or doesnt teleport at all, i cant remember
what?
getLastePlayed can’t be checked
idk then
youd have to ask the guy who made a whole ass plane
of course it can be checked. its exactly what you are askign for
No it cannot bc it’s not a true or false situation
who was that?
If I use that
coll?
what the hell arew you talking about? true false for what?
its a date
DATE
a measurement of time
when they last played... a date
I need to literally if (player leaves the server) { plugin.getConfig.set(blah blah blah) }
no you don't
how many times do I need to say it
YOU do not need to store it, it is ALREADY stored in OfflinePlayer
Huh, but I need it in my file
ok you do you
why?
Bc then if a player does /lastseen player it can retrieve the info from that file
I give up
And not from your OfflinePlayer
just get that info from OfflinePlayer
Player extends OfflinePlayer so just cast it
wait i think it's the opposite
But what if I want it stored in my file? Isn’t it possible?
if player types /lastseen <name> you do Bukkit.getOfflinePlayer(blah).getLastPlayed()
oh look you have the last time they were seen
you can also do new OfflinePlayer("playerName").getLastPlayed();
There is no reason to store it in your file
can u make a sound play for longer?
and why does ender dragon growl at 0.2 pitch sound like a goddamn monster
i think you can specify the time in args
But what if I wanted to? I know it’s not optimal but is there a way?
Tell me a good reason why you need it stored in your file and I'll write the code for you
Bc then I can see with my own eyes if I open my file?
void playSound(@NotNull Location var1, @NotNull Sound var2, @NotNull SoundCategory var3, float var4, float var5, long var6) what's var6
not a good reason, you can just type /lastseen <name> in console
idk look at docs
What if the server explodes, and I want to remember those good days and I have that file?
Nah
Just do what we all told you, read it from OfflinePlayer
but it is useless and uses more resources than needed
The seed is used to determine what variation of the sound is played
If you don't care about that, just use the version without that argument
so i can change the sound basically?
What sounds have variations?
A lot
I thought most of them were pitch shifted?
i think there are multiple versions of the same sound and you can choose which one
oh wait
there like 6 variations of some cave sound
Wdym?
i tohught u were forced to have a random variation lmao
Ohhh, that kind of variation
it uses more resources to save to a config file and its pointless
That's actually a nice addition.
Yeah
If you run /playsound minecraft:entity.villager.yes master @s ~ ~ ~ you will notice several different sounds
That are all considered minecraft:entity.villager.yes
anyways how do i make a sound last longer
That you can't do.
you just replay it i think? but thats different
You can make it last longer by making the pitch really low, but it will also change the sound.
rip
why do you need it
OfflinePlayer target = Bukkit.getOfflinePlayer(...
LocalDate date = LocalDate.ofEpocMilli(target.getLastPlayed());```
litterally all you need for a seen plugin
hey elgar how do you schedule something for a set time?
like i want to schedule a live event for sunday 6pm est for example
hwo do i do that
ScheduledExecutorService
whats that
btw coll how did u move the "center" display block and u cant move entities with passengers
you cant?
You can
Just not with the Spigot API iirc
Paper and NMS should have methods for that
I appreciate it, but let’s remember I didn’t ask to get spoonfed
how do i do it with paper
oh wait im prob not gonna get paper support here
I did it via NMS iirc
Idk a while ago
nms sucks to use right?
^^
what happens if u do Entity#setPose on entities thata rent armorstands
The most annoying thing is supporting multiple versions
Agreed
Though that's also gotten better
dude my client asked me that and i have no idea how to do that 💀
Modules
i have to rewrite code for every version right?
You have code for each version and the plugin uses a bit of magic to load the correct core
alex has a tutorial on modules
whos alex
?nms
packets are confusing for me aswell
What about them?
is the paper method in Entity.class?
^^
just using them and kinda everythign
I need examples of this D:
I saw your link btw
You can also use reflection if you prefer that
how do i get spigot 1.20.6 build for development
cause apparently its not working for me
do you use maven or gradle
Hi, so I tested my plugin (firstseen) but I get something strange
In the config file, the date has been stored
But when I do /firstseen player, I get Player Was First Seen On null
Why does it say null, if in the config file, there is the date?
You missed a period
BRUH
thx
Btw Elgarl
Your code doesn’t work, it sends an error null in the console
nah, your code shows null, mine is fine 🙂
it does. It means you did something wrong.
I just used day instead of millis
The code I showed would never produce a null error
So the solution is to make it millis?
But I want a date like 03-05-2023
With months
And year
create a new Date()
and use SimpleDateFormatter
Date is old, you just need to format it
ofEpochMillis doesn’t exist
That’s what I used with firstseen
what's the problem then?
I’m making now lastseen, I need to literally do this. if (player leaves the server) { plugin.getConfig.set(blah blah blah)}
yeah you'd need Instant
getLastSeen()?
But some ppl told me to better not to store it in the config and instead, better to use OfflinePlayer
you should never use the config
you can create your own files to store data
this mainly is terrible because actually saving the config removes comments
Is there a structure equivalent to what a RegionAccessor does for biomes? I'm trying to detect the nearest structures to a location but iterating through a list and using World#locateNearestStructure isn't very efficient :p
(im so dumb i put this in general 😭)
World#locateNearestStructure isn't very efficient :p do it async
not in modern versions smh
World#locateNearestStructure is exactly how Mojang does it for /locate
Caused by: java.lang.IllegalStateException: StructuresLocateEvent may only be triggered synchronously.
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:42) ~[paper-1.20.2.jar:git-Paper-318]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[paper-1.20.2.jar:git-Paper-318]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.event.Event.callEvent(Event.java:45) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at net.minecraft.world.level.chunk.ChunkGenerator.findNearestMapStructure(ChunkGenerator.java:130) ~[paper-1.20.2.jar:git-Paper-318]
at org.bukkit.craftbukkit.v1_20_R2.CraftWorld.locateNearestStructure(CraftWorld.java:2257) ~[paper-1.20.2.jar:git-Paper-318]
at org.bukkit.craftbukkit.v1_20_R2.CraftWorld.locateNearestStructure(CraftWorld.java:2246) ~[paper-1.20.2.jar:git-Paper-318]
don't think that'll work unfortunately because paper greg
why do you do this vencord i actively have nitro
#help-development message anyone happen to have an answer?
I don't think my question was "are packets scary" 😁
if you only want to imitate the animation, then packets
So the answer to my question would be "there is no API that would trigger this animation" I take it?
yeah, probably
could some1 help me at my server dm me and ill give more info
?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/
is there an easier way of making a plugin multiversioned?
i dont like having to write my code 5 items over
and i also dont understand how modules work lmao
no
so is it even worth it?
you can abstract some of it but not much
also what if i want to convert a 1.16.5 plugin that uses PDC to 1.12? theres no pdc in 1.12 so i would have to rewrite the whole plugin logic?
dude wtf
you can't simply back port features
that changes the whole plugin it wouldnt be the same at all
🤓
nope it's jsut delusional
use github copilot to generate code for you
dw
very simple
transfer code from 1.8 to 1.16.5 please
boom it does it for you
sometimes its dumb but you've gotta insult it
if its wrong and it'll get it right eventually
github copilot is a slave ai
i dont get why people r so against using it
super useful for writing code i do not wanna write
not like the software engineering field is gonna be alive in the next 5 years
ive never used it honestly
whaaaat
yes it will
github is working on AI that learns from its mistakes
basically github copilot
is being the pilot
um, who are you HyperSkys? Just signed up to Spigot yesterday and yoru profile on your .dev site created 5 minutes ago?
unless ur working on AI, or something similar
but someone has to program the AI tho
my .dev site was not created 5 minutes ago
theres no way software programming is going anywhere
well yeah
that'll be the only job
you cant stay in the same place
making plugins or websites
full stack dev will not be a job in the next 5 years
it'll be rlly changed
not really
thats a 1 minute reading time i'd assume
my old posts
lo l
also is github copilot priced?
yeah if ur not a student
theres some more on there plus reading time is kinda innacurate
its simple math function
yes
ohshit
Does it count if you're in a bootcamp
probably?
r u not in high school?
or middle school
Nah I dropped out mate
i wanna make guest book kind of thing on my website no clue how to get started though 🤔
Currently not in a school system so I don't think they'll budge for me
wdym
whats that
also i didn't sign up for spigot yesterday? my profile was not created 5 minutes ago
what are you on abt
am I reading it wrong?
we are not in the month of march
nope, I'm just asleep on todays date 🙂
were in may elgar
plus my discord got limited lmao
but yea hyperskys is obv an alt look at his other accs on social media
like twitter 0 posts 0 followers 0 following
my twitter got termed
lmao
check my youtube
or steam
or github?
any1 know how to help me w this i have no idea how to create or use a component
ur using paper
go to paper support discord
could just be that youve always had 2 accounts or an extra acc
i believe unless spigot converted to components to
nope, that is indeed paper-api
my main alias is hyperskys, i just got "termed" on discord for being "underage" cuz I said I had a certain number of years in experience in Java
lol
and i sent my id to discord and everything
yeah same but i didnt have an id at that time
i got an ID 1 month later but it was too late
no response at all
a guest book so people can leave comments on my website
so kinda just like a comment section ok
do u want them to have to sign up for account
if so that might be a little more tricky
cuz if its just comments have a post request open for POST -> /comment/create and a GET -> /comment/getAll
and store it in an SQL or MongoDB db
and then have a ts, javascript, vaadin (java) frontend load it all
maven, but ive already tried to make a new project and 1.20.6 isnt in there
yh ik that the only problem is making a functioning api
i'd use spring
not hard to do all in Java
javelin is nice and small
well u could just use default java
3.4.1 is latest and it does exist
do maven install
see if that fixes it
try symlink instead
isnt symlink linux?
windows has some scuffed version of it
no it's also on windows
Yeah, i dont know... lol.
just have your server pull a new jar at startup
whats the api-version option for in plugin.yml?
the only attempts i had at apis before was in js so ig this is gonna be fun
why not use the api version of the server version directly
the version of the api you're using
spring is very easy
whats spring for
websites
I always used paper/spigot api to create my plugin, when are you supposed to use the bungeecord api?
for writing bungeecord plugins
Boring proxy stuff like bans, load balancing, redirecting, e.t.c
it displays once and then after leaving the territory it doesn't display anymore
and yes my code is in different classes, I just chose to show this snippet because I thought it would be the most relevant
hope that helps
why r u using uuids?
i might be dumb....
but how do i set / get a list on pdc
PersistentDataType.LIST.strings() for a List<String>
i'm trying to save a list into a chunk
okay?
how do i increase the impulse tnt deals on other tnts ? i was looking into velocity but idk if that if very reliable
😔 🔫
how do i detect when a player drinks a milk bucket
Good evening, I would like to ask why my survival pack + plot has been recognized as someone else's work.
i assume playerbucketemptyevent is only for water/lava then right?
yep
bruh
you cant empty a milk bucket
how do i make client-side buildings with packets? like in mmo servers on maps there are usually these "spawner" blocks. on top of the blocks theres a tree that you can break for resources etc or other buildings. but the tree isnt actually there on the server, its using packets to generate it for seperate players
not real but funny
?
Today, when I was uploading another update of the pack named "Survival+Plots", it got banned after an hour due to "Redistributing someone else's resources", even though I spent many hours to do it, the pack's description contained all the links to the authors of plugins used in this pack.
You can't upload others plugins without permission
The pack contained a ready-to-use configuration, along with Polish translations. The entire pack was created for a survival server.
Doesn't matter how much work you put into it. You do not own the plugins so you can not upload them
how do i check if a block is in a certain minecraft group of blocks? like #minecraft:deepslate_ore_replacables or #minecraft:minable/pickaxe
what if I rewrite so much of the plugin that it's no longer anything the original was?
the plugin of theseus
well, debatable
If you admitted to starting with their code base and the plugin is not OS, then bad person
?paste
:(
armorstand is null CustomBalloons.java:65
armorStand.teleport(playerLocation.add(0, 2, 0));```
armorStand is null
I don't understand
the Field you are referencing, called "armorStand" is null. It's not assigned to an Object
Hey guys
oh
I got a small question, so I’m making a new plugin, an investigation plugin. If I would have done /investigate <player> that player, and me would be teleported to an investigation room. When I do that command, the target ( the other player, not the sender) can’t send any commands
So I understood I would need PlayerCommandPreprocessEvent
But I need to make it in an Event class
I made my event class but it tells me Class must either be declared abstract or blah blah blah
What’s the solution for this?
Here’s the code
Implements listener?
try it and see
?tas
Another question
So I have the command on another class, and the PlayerCommandPreprocessEvent is in another class, how would it know that if I do that command, at that moment the player has not the ability to send commands?
Here’s the other class’ code
It would come under line 33
How do I implement the PlayerCommandPreprocessEvent there?
you don't
How does it know then?
you have to flag the player (PDC) so when they are in the room you can see in teh preProcess event that they are blocked from all commands
PDC? Wdym?
How can I get the author & name from Music Disc? (This in the Toolbar)
?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
Yo, so I'm trying to create a new Enchantment and I'm watching a video/tutorial that tells me do add this, can anyone explain me what's happening?
bruh
thank you
is there any way to do that?
I mean, I don't really need an enchantment, i just need the itemstack to glow without showing any enchantment name
Well, what version of spigot are you coding on
in 1.20.5 that can be just done with API
i'm in 1.20.5 is that a problem?
no, that is perfect
my bad
well in .5 you could use the above method ^
Well i plan to run my server on the latest version
.4 you'd have to dive really fucking deep
or just add a vanilla enchantment and hide it via item flag
is it that fucked up to change the version?
not really
but .5 (well .6) is experimental
so you wouldn't want to run it in a production environment
alright
so, I'm gonna try this
👍
damn pretty weird the fact that this stuff is that difficult
We love item components
Even if they’ve put us in a bit of an integration hell for now
it reduced my NMS code footprint by so much
Any plugins that are public that add uuids or serials to every item ? That can help with anti duping ?
i have plugin where player click on item it opens GUI why it takes 5 seconds until the GUI opens
really 5 seconds?
yes not 4
really really bad code or you are accessing a database to read data, slowly.
a slow query
how do i fix it
cache the data you need
Hello, I'm creating a direction plugin that displays the direction in which the players on my team are facing and I'm displaying it in the actionBar.
I have a problem where I can't determine the direction (because if my player turns his head, the direction won't be the same).
I've started by finding the vector between the two player positions, but how do I adapt it to the Yaw?
use eye location
thats the position of the head, including the direction th eplayer is looking
I know how to retrieve the yaw but I just can't apply it to define the other player's direction.
teh vector between two players will be the same no matter where they are looking
if a player is at 0,0 and another is at 1,1. The vector between them will always be 0.5,0.5 (normalized)
Yes, but if I display it on the screen and look in the direction of the player, my arrow will be the one pointing up, but if I turn 90degree the arrow will be on the left.
both players can turn around as much as they like but the vector will remain the same
so you want them all to be relative to you
Yes that's it I'm sorry it's been a while since I've been on it so I'm having trouble explaining x)
you are going to need to calculate teh dot product
In case I want to see if the chunk is loaded at this moment and if I do this quite often with this approach might it be too much resource consuming?
I believe there is a faster/better way to do it
that would most likely load the chunk
This one is better. Its actually is relative using the dot product https://www.spigotmc.org/threads/players-facing-direction-relative-to-the-entity.420843/page-2#post-3712420
ty
Just get the Vector between the players, then getDirection of eyes and dot product them
be sure to normalize so you are using unit vectors
none
Spigot
ACF ftw
it's impressive
Working without a command api isn’t that bad
tab completion can be a bit painful
Maybe if you were making a plugin with a ton of them it would be a bit annoying
especially removing the ones that don't match with current input
i mean spigot and all that has been around for so long and I don't see any main stream command library yet
there is like 10
I think majority still works with the original api
two main ones are acf and cloud
There is actually quite a few as mentioned but most people tend to just end up having their own since they dont usually need something like acf lol
If my plugin has like 2 commands not going to add acf to manage those be quite the overkill
A
Attempting to modify an entity's nametag by intercepting the serverbound entity metadata packet
For reference, the Entity Metadata packet I'm attempting to transform: https://wiki.vg/Entity_metadata#Entity_Metadata_Format
I'm getting the following error: java.lang.ClassCastException: class [Lcom.comphenix.protocol.wrappers.WrappedChatComponent; cannot be cast to class net.minecraft.network.chat.IChatBaseComponent ([Lcom.comphenix.protocol.wrappers.WrappedChatComponent; is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @7ac8591e; net.minecraft.network.chat.IChatBaseComponent is in unnamed module of loader java.net.URLClassLoader @255316f2)
Applicable code:
StructureModifier<List<WrappedDataValue>> watchableAccessor = packet.getDataValueCollectionModifier();
List<WrappedDataValue> read = watchableAccessor.read(0);
read.set(2, new WrappedDataValue(2,
WrappedDataWatcher.Registry.getChatComponentSerializer(true),
Optional.of(WrappedChatComponent.fromChatMessage(nameTag))));
watchableAccessor.write(0, read);
use WrappedDataValue.fromWrappedValue instead of calling the constructor
doesn't seem that static method exists
although I got past that error with the following
@Override
public void onPacketSending(PacketEvent event) {
if (event.getPacketType() != PacketType.Play.Server.ENTITY_METADATA)
return;
PacketContainer packet = event.getPacket();
Entity entity = packet.getEntityModifier(event).read(0);
int levelViewer = plugin.getLevel(event.getPlayer());
int levelEnemy = plugin.getLevel(entity);
String nameTag = entity.getCustomName();
for (IPluginConfig.ViewerEffect effect : plugin.config().nametagViewerEffects()) {
if (effect.applies(levelViewer, levelEnemy)) {
nameTag = effect.apply(nameTag);
break;
}
}
StructureModifier<List<WrappedDataValue>> watchableAccessor = packet.getDataValueCollectionModifier();
List<WrappedDataValue> read = watchableAccessor.read(0);
read.removeIf((it) -> it.getIndex() == 2);
read.add(new WrappedDataValue(2,
WrappedDataWatcher.Registry.getChatComponentSerializer(true),
Optional.of(WrappedChatComponent.fromChatMessage(nameTag)[0].getHandle())));
watchableAccessor.write(0, read);
}
I guess my next problem is that entity is null 😭
I've got 5.1.0 imported
your own command or a different plugin's command?
Mine
bukkit's command api?
Yes
it was added for 5.2.0 lol
oh lmfao
let me get latest
although, do you know how to read an Entity from the packet?
so confused, wasn't there a getSuggestions or something in CommandExecutor or am I crazy
onTabComplete
no clue
onTabComplete return an empty list
I think that's what I did and it didn't work
```java
@EventHandler(ignoreCancelled = true)
public void onTabComplete(TabCompleteEvent event) {
if (event.getSender() instanceof Player) {
Player player = (Player) event.getSender();
event.setCompletions(new ArrayList<>());
}
}
it's not an event
that event is effectively useless
in your class that implements CommandExecutor, implement TabCompleter, and inside onTabComplete return an empty list
Ok thabks
the gui is still in delay i dont know how to fix it
cache the data
how to do it
?paste
tysm
at net.noscape.project.supremetags.guis.TagMenu.handleMenu(TagMenu.java:108) ~[?:?]
at net.noscape.project.supremetags.handlers.menu.MenuListener.onClick(MenuListener.java:22) ~[?:?]
https://paste.md-5.net/idicotuzoj.js (TagMenu.java)
To begin with, when I click on an empty space I get that error
of an inventory (menu)
?stacktrace
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
I'm not as experienced in Java as we might say, but what should I change in the code so that this error no longer appears in my server's console?
paste the full error
.
thats the class not the error
but
the rest of this
that is the error
in this link I pasted the error
in fact it is about
Could not pass event InventoryClickEvent
in a seperate paste put the entire error
This is the code of the class that contains that error
it's all the mistake
in your console is there more of this
look
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
the item has no display name
dont check items by name use pdc or in your case nbt tags
mmmh you mean the code of that class right?
So what should I change to correct that error?
dont check if its the item you want by name. use nbt tags
NBTItem nbt = null; ?
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
I know I don't know much Java that's why I said I should change the code, but thanks
💀
I have this issue where I'm trying to hide all commands except for the ones that the player should have access to (from my custom plugin and a few selected plugins.
How can I do this?
Ver: 1.20.5
Ive tried:
TabCompleteEvent
Implementing TabCompleter and setting/returning an empty list
Those didnt work
I am using a custom commander btw
just set a permission for the command in plugin.yml
I'm using a custom commander. That has permissions on it already.
if permissions are properly set they wont show
The developer of the API said to wait 20 minutes (it's been 3 hours)
Here, let me show you how one of the example commands are written
public class HealCommand {
@Command(name="heal", description = "Heal command")
@Permission("dufjismp.heal")
public void execute(@Sender Player sender, @Optional Player target) {
if(target == null) {
sender.setHealth(20);
sender.setFoodLevel(20);
PlayerUtils.sendMessage(sender, "You have been healed.");
} else {
target.setHealth(20);
target.setFoodLevel(20);
PlayerUtils.sendMessage(sender, target.getName() + " has been healed.");
}
}
}
we can only help you with spigot API
if you are using different command API then we can't help
@sullen marlin yoo ive seen u on github
u help with bungeecord servers right?
please help me too
in spigot api, you set plugin.yml
commands:
heal:
permission: dufjismp.heal
and it will all work like you want
I created a bungee cord server using Spigot and whenever I try to start it, it just keeps me in the encrypting screen and shows "ReadTimeoutException : null"
Does anyone know how to fix this?
I see, would you recommend using commander apis? or doing everything bare bones?
yo u use a bungee cord server?
No, not yet anyway.
ah man. I really need help setting it up
it just does not work
is md_5 good at this?
well maybe
thats why i came here
to figure out whatever i did wrong
eventho i configured everything right
start by reading the channel names
is this not the right channel to ask that bruh?
I think I'm just going to start writing my own commands from scratch rather than using Commander APIs.
Is your question a development question?
or a server question?
well i asked the question in general chat and they read my question and told to come in this channel
my bad i didnt read the channel name properly. But still, any of yall know something about this issue? To cover it up more in #help-server ?
need dev.java
currently my fav learning resource.
saving an inventory via JSON itemstack in a mongo isn't worth or is it?
wtf are you doing
Why does this library exist? The code is just 10 lines long..
return new String(Base64Coder.encode(outputStream.toByteArray()));
you could just make it on your own, correct
Doesn't Base64Coder.encode() returns a string?
🤷
Why the need for a new string object? 😭
probably returns a byte array
I want to spawn an NPC in my world but for that I need their UUID, what if instead I want their skin to be imported from my local PC files? Is that even possible?
declaration: package: org.bukkit.block, interface: Furnace
Look for cook time
if you set it to 0, it's instant iirc
Is there a way to have a downloadable text file in chat, or something similiar? I want players to be able to get a full report on the server and commands issued, but I think that could get very cluttered in just the chat
declaration: package: org.bukkit.event.inventory, class: FurnaceSmeltEvent
FurnaceSmeltEvent instead of FurnaceStartSmeltEvent
not sure what are you talking about
and 1.20?
iirc the cook time is in ticks
yeah
because you put 1 tick
try different values
for cook time, total cook time and burn time
yeah, sounds like you are wanting to change burn time not cook time
or both idk
but cook time wont change charcoal usage
decrease the value
FurnaceBurnEvent for fuel usage
for both
yes
i would just set up the furnace burn time/cook time every time the FurnaceSmeltEvent was called
I guess I'm just dumb now for not knowing.
Hi, I was just wondering. How long should we wait for the tool component to be added? I understand that Mojang was "lazy" to do everything properly?
Magic 8 ball says - try again later.
Hey, i'm tryig to compile a plugin and it is compiling an older version of it, i'm trying to check the maven but nothing seems wrong, why could this be happening?
maybe do you want my maven file? ask for it 👍
is there way to listen to world loading start or finish during start-up?
declaration: package: org.bukkit.event.world, class: WorldLoadEvent
that?
yes, you can use that event. however, make sure you set load: STARTUP in your plugin.yml otherwise your plugin will load after worlds are loaded so you won't get that event; you would only get that world for any new worlds that are loaded later on
during start-up
Like onLoad() method?
it works during startup, you just need to make your plugin load earlier. see my message.
if it is building an older version of it, then the code you have is older
will test rn
😍
But the code I have implemented isn't there, also set the versión to 1.1 and it is compiling 1.0
nothing about your maven file would cause it to ignore your code, so i'm not sure
I haven't changed anything there so I don't Know
Also in the target carpet no puglin is being compiled
?nms for me
@sterile axleso i found the problem but don't know how to solve it xd
it is replacing the jar from a folder that it shoudn't
how can i change that? xd
which lifecycle are you running?
package
clean before
I removed the commander for now and it still shows tab completions for stuff like LuckPerms, Spark, Tab, etc :(
Any Fixes anyone?
Add a permission to your plugins. Players dont receive commands which they dont have the permissions for
Yes, that's what I did. But It still shows for Luckperms, Spark, and other pluguns for some reason.
can I use PlayerInteractManager class to detect entity press or is it something else? I want to open GUI when I click on NPC.
?jd-s
declaration: package: org.bukkit.event.player, class: PlayerInteractEntityEvent
But I spawned an NPC with packets, afaik it is not registered in the server
is there any good learning resource for NMS
Nope
There is a lot of mod code, and some plugin code that utilizes nms
Using mojang mappings can also help
If you use fabric, vineflower is supposed to help w nms decompilation
then I should increase my Design Pattern knowledge to better read the Spigot API
does anyone know why playerinteractevent would trigger twice?
when i right click it does a left click animation
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
i have hand disabled
well then
so i set isStartingIn5Seconds to false in a task but i actually forgot to save the object in my hashmap.
i have move event listener that checks isStartingIn5Seconds and doesnt let player move if its true.
problem is it works without resaving object in hashmap? how
saving what object in what hashmap
i have Game object that is inside Request object and i save the request object in the hashmap
but i didnt in this case
i cancelled it and now it's fine
the interact event is called twitce for right click and once for left click
makes no sense
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
its called once per hand
Main hand no?
hand is main hand isn't it?
it is
i cancel and return as you can see
what isnt working
he does
look at the code
No you are using getHand
its not on the link
its in the screenshot of code
so i could debug
use a debugger or sysout values
it's left clicking when i right click
i wanted to see where the left click came from
they're correct
i've looked a bunch
the interact event is triggered twice
twice for right and once for left based on the stack dump
all coming from bukkit
and interactevent
add a sysout for event.getAction and fully restart ur server no /reload or plugman
are you actually clicking a block
