#help-development

1 messages · Page 1006 of 1

alpine urchin
#

so to me it would be a waste of time

#

but i feel you

worthy yarrow
#

Well sometimes I am kek

#

Still young and (sometimes) dumb

silver robin
#

could I have some examples in an open source plugin (that's preferably not too large) please?

worthy yarrow
#

When updates are needed to be made

quasi gulch
wet breach
quasi gulch
#

so i should to run it async?

silver robin
# worthy yarrow Uh I’m pretty sure you just do saveConfig

i'm not quite sure you understood me, when you have a config.yml within the resources in your jar, and call JavaPlugin#saveDefaultConfig(), it will copy it to plugins/<plugin name>/config.yml, however if you release a new version of your plugin, where the config.yml has some new properties, they won't get copied over

tardy delta
#

what a noob \🤓

worthy yarrow
#

Fourteen

#

Help

worthy yarrow
#

I’ve never had an issue like this before

kind hatch
worthy yarrow
#

And you have to do this?

kind hatch
#

Yes

#

#saveResource() gives you two options

#

Overwrite the file, or don't.

#

So you can't get fine grain control

quasi gulch
worthy yarrow
#

Odd, I’ve never had an issue like that before, every time I add new config options, I just put ‘em in my config startup method and everything “new” gets added

kind hatch
#

But how? That's never been the case with the API.
Are you sure you weren't using some other library to handle the files?

worthy yarrow
#

Yep

#

Literally just .saveConfig

#

?paste

undone axleBOT
worthy yarrow
kind hatch
#

Ah, you use the other approach.

worthy yarrow
#

Copy default (true) ?

tardy delta
worthy yarrow
#

Nvm shadow is faster than you

#

Kek

kind hatch
#

I've always used the direct approach.

tardy delta
kind hatch
#

FileConfiguration loading from disk

silver robin
# kind hatch Ah, you use the other approach.

yeah I came across that while browsing online too, however it seemed bizarre to me that I have to have specify a default value in code. But I realised it might just be the best to loop through plugin's own config.yml that comes in the jar, and then add the defaults to the existing config.yml from plugins folder and call copyDefaults

worthy yarrow
#

I guess I never realized there was a “direct” approach lol

#

I’ve also never had to deal with vcs so maybe that’s another issue

kind hatch
#

But here's the other thing.

#

That only works with the default config afaik

#

If you have any other files that need updating, you don't get those benefits.

tardy delta
#

i have no idea what this is about, too much people yapping

worthy yarrow
wet breach
#

then call that method

#

old configs are saved, new configs are used

worthy yarrow
#

That’s smort frost

kind hatch
worthy yarrow
#

Wouldn’t the new ones be “overriding” the old ones as it were?

wet breach
#

then they should implement 3-way diff

#

git has that fyi

worthy yarrow
#

Man whatever this “direct approach” is, I don’t like it kek

kind hatch
#

If they new ones don't exist, then technically yes.
But any ones that already exist shouldn't be touched. (Even if the default has changed)

wet breach
#

but, its generally not worth the effort to implement diffing

#

its just easier to rename the old config, use the updated new config then let the user handle it from there

#

if the user is too stupid to modify the configs they shouldn't be running a server

#

not sure why dev's want to put the effort into trying to automate everything as if its somehow better that way lol

kind hatch
#

Well, if the config options aren't there then the plugin would likely error out if they didn't use the methods that provide fallback values.

wet breach
#

what config options?

worthy yarrow
kind hatch
#

The ones they want to add/update.

wet breach
#

they should be in the config included with the jar

worthy yarrow
kind hatch
worthy yarrow
#

Other than just having easy fallback values

kind hatch
#

Maybe there's a way to leverage it

wet breach
#

probably

#

but eventually you end up with a big class file of nothing of updating values

#

when you could just....install a new config file

worthy yarrow
#

Why even do that, just use the existing one no? In the way I do it, /myplugin reload will save the new values

kind hatch
#

Yea, but what if the config file is large and heavily modified?
I think it's a nice thing to have where all of those changes I have made I don't have to redo every single time there's an update.

wet breach
worthy yarrow
#

I don’t even see a point in automated config updates, in the sense of wanting a concurrent state of config values, automation makes no sense to me

worthy yarrow
#

Well

#

I put it into simpleton terms 😛

wet breach
#

all that is happening is you are taking the time and effort the user would put in, quadrupling it and you are putting that time and effort in so they don't have to

#

and if its a free plugin

#

even more pointless to go through all that trouble lol

#

the troll that needs slapping has appeared at the perfect time

#

@worthy yarrow you can now let your nuclear fustrations out

merry cove
#

hey, am struggeling to find the right dependency to hook a later version (dev build) for protocollibs. is that even a thing that I can hook the alter one simply using a dependency? or do I need to build it in if so?

worthy yarrow
worthy yarrow
merry cove
#

might try to add the jar file directly in then

worthy yarrow
#

Perhaps that will work, I just settled for the most recent (before latest)

merry cove
#

am updating my codes to 1.20.6 😐

worthy yarrow
#

Eek

kind hatch
#

You know, I think if #setDefaults() is easy enough to understand and actually works in the way I think it does, then I might be able to update the wiki.
Because if it does provide the ability to set default values without changing existing ones, then I think everyone who made their own systems just didn't realize how it worked in the first place. Me included :kek:

worthy yarrow
wet breach
worthy yarrow
#

Like I said that paste is the way I’ve always done it, then to induce the changes I give the user a reload command

wet breach
#

in otherwords it makes use of memoryconfig

#

which is not really an issue

worthy yarrow
#

Should I look into cleanup of config memory?

kind hatch
#

Cause here's my initial thoughts right.
A lot of people have files in their plugins. More than just the default config.

#addDefaults() is accessible through FileConfiguration.

So in theory, we could take the existing files in the resources folder, iterate over the sections and use #addDefaults on them to update the existing config.

#

Which would negate the need for a complex diff comparison.

worthy yarrow
#

There’s no theory about it if it’s accessible through fileconfig, why would it be different just for the default config?

fleet kraken
#

Hi guys, where can I get the direct download link for a plugin on spigot?

worthy yarrow
#

(Download now)

chrome beacon
#

Are you trying to wget or curl a plugin

worthy yarrow
#

Yeah what Olivo said

fleet kraken
fleet kraken
chrome beacon
worthy yarrow
mellow edge
#

thank you it actually worked. I have no clue how tho, the entity isn't registered anywhere...

fleet kraken
chrome beacon
#

That is all it needs

mellow edge
#

oh, yeah, that makes sense, so basically even if the server has no clue what I am doing, the client does

worthy yarrow
mellow edge
#

I just registered it by a deprecated method OfflinePlayer, then set the nametagvisibility to false and it worked

#

first try

worthy yarrow
#

Well now it’s time to rewrite it

mellow edge
#

why

worthy yarrow
# mellow edge why

If it’s deprecation to be removed, then rewrite it, but also because no method should be considered “good” until rewritten a couple times - Bruce eckel (thinking in java 4th series)

mellow edge
#

yeah that is a minor change, I can just change it to its name

worthy yarrow
mellow edge
#

now another problem comes with how to detect NPC click; I assume PlayerInteractManager is for that but I don't know.

tardy delta
#

why not use Path and the Files api?

mellow edge
#

may I ask how to listen to incoming packets, the problem is that I don't want to write my own netty handler for that, although I know how, but I just want to somehow get a packet PacketPlayInUseEntity

meager wolf
#

how do u give a command an optional argument? like this:
if u run /mycommand your "storage" will show up
if u run /mycommand <player> the <player> "storage" will show up, but only if u are an admin

#

my googling skills are so bad 😭

mellow edge
#

simple

remote swallow
#

ruturn different stuff based on the arg and if sender has permission

meager wolf
remote swallow
#

so use sender.hasPermission

#

check based on arg length, permission and arg value

meager wolf
#

all of that will be in the onCommand method, so when the player enters /mycommand in the chat and clicks space, he will see that he can enter a player name as argument, i dont want that, i only want admins to see it

mellow edge
remote swallow
#

you have the exact same arguments

inner mulch
#

Is tracking the player interaction on a packet entity even possible? (server doesnt know abput it)

mellow edge
#

yes I know that

#

but the client knows about it

mellow edge
#

kk

mellow edge
river oracle
#

@remote swallow do you know the answer

#

@remote swallow your role color is different

#

you must

#

come on

remote swallow
#

slag

mellow edge
#

alr I will just write my own handler and just check

mellow edge
#

because I will NOT use protocollib, where is the fun in that?

river oracle
mellow edge
#

maybe if the raw netty channel handler won't work

wraith delta
#

How do you get the spigot api for 1.20.5/6?

fallow imp
#

hi, i have my spigot server up and running and it works great for me, i created a port forward for the ip of my server however my friends still cant join, does anyone know what i can do?

mellow edge
#

OMG IT IS **** WORKING HOW IS IT POSSIBLE?!?!?!?!

stiff crown
fallow imp
#

his error is just a timeout error

remote swallow
fallow imp
#

it showed him attempting to join once in the server terminal

wraith delta
stiff crown
fallow imp
#

in the cox app i added the port foward set to both tcp and udp for my macs ip address (im using the laptop as the server) and he still couldnt join

mellow edge
#

something I've never done before, now that I can detect when NPC is clicked with nms, I can add my own spigot event right?

#

or register it

tardy delta
#

yes

young knoll
#

You need a packet listener

alpine urchin
#

i heard packet

worthy yarrow
#

I want packet lessons from retrooper

alpine urchin
#

if compensated, i'd love to provide those.

#

i'd even give programming lessons

#

if compensated

#

that would be more fun

worthy yarrow
#

I mean

#

I feel like you’d be better than illusion cuz he’d just yell at you the whole time

alpine urchin
#

damn

#

are you taking programming lessons?

worthy yarrow
#

No

alpine urchin
#

you know anywhere to get clients

worthy yarrow
#

I’m reading a book, and have been doing spigot dev for maybe a year

alpine urchin
#

to teach programming

#

i'd love to get back into that

worthy yarrow
#

Though I only say a year because I’ve been doing it on / off the past 4

alpine urchin
#

ok

#

xd

worthy yarrow
#

Trooper doesn’t like to converse D:

nova notch
alpine urchin
#

that was a pretty random fact xd

#

@worthy yarrow how you got 1

#

from on and off 4

#

just say 4, so it sounds better

worthy yarrow
#

Sure it sounds better, but for how I write you’d say 1

alpine urchin
#

When someone says they have 10 years of experience, you can't expect that they dedicated hours every single day.

#

without skipping a single dya

#

XD

#

but i get you

#

stay dedicated though

#

don't stop

worthy yarrow
#

I actually have been doing that since January kek

#

Only issue is I forgot my computer charger for this trip I’m on, so now I just have to read my book 😦

alpine urchin
#

are we in the right

#

channel

worthy yarrow
#

No

storm crystal
#

can I use my own commands inside code?

fossil flax
#

is there a way to format an int like 1200 to 1.2K and 2400000 to 2.4M?

worthy yarrow
storm crystal
#

If I make my own command via commandexecutor

#

Can I invoke it in my code?

shadow night
#

Why

storm crystal
#

To save space

acoustic pendant
#

Hey, could someone guide me on how to reset a world (trying to make a minigame)

#

I don't get how to do this

slender elbow
young knoll
#

Is there a formatter for that

royal heath
#

https://paste.md-5.net/efakamewad.cpp

You could also do this, I just ripped this up. It should work for versions lower than Java 12. There are likely better ways at this but this is readable

#

You could use an array with an index as well

slender elbow
#

NumberFormat.getCompactFormat() + setMin/MaxFractionDigits

royal heath
#

He might want to throw it into a variable and do .setMinimumFractionDigits(decimalPlace); if he wants 1234 to be 1.234k

royal heath
#

@quaint mantle Put a \ in front of the quote. Regarding your question in general

quaint mantle
#

Yeah I figured it out, thanks.

royal heath
#

No problem

quaint mantle
#

Did intellij update their dark theme?

royal heath
#

I’m not sure, they had a GUI update recently though

#

Like within the past year or so

quaint mantle
#

I was used to their old Darcula UI

#

but, i swear

#

they changed the theme

#

to be darker

#

and have circular stuff

#

which

#

is amazing

royal heath
#

Yeah it’s really nice now. I still have the old one on my work pc I need to update it there.

#

I like the old one in its own ways so I keep it lol

quaint mantle
#

The old UI is probably the best in my opinion

royal heath
#

New one is sleeker but old one has a place in my heart

quaint mantle
#

It makes me think of VS Code @royal heath

nova notch
royal heath
#

Lol yeah, I like the font though

quaint mantle
spiral bramble
#

Heya,
At the moment I'm utilizing getItemMeta().getPersistentDataContainer, is there anything similar for Blocks, or an I going to need to spawn in armor stands and use them for persistent data?

young knoll
#

?blockpdc

undone axleBOT
spiral bramble
#

Legend thanks

sacred cedar
#

Hello,

I am currently trying to replace the /version and /ver command with my own /version command that will send a custom string to the sender.
But it still uses the normal /version command from bukkit how do i disable the vanilla one?

Any help is much appreciated ^^

wet breach
sacred cedar
#

like the .jar file?

shadow night
#

Do default bukkit commands exist in the command map?

wet breach
#

not entirely sure if the version command can be overridden easily from a plugin, however the version info is pulled from the manifest in the jar which is created from the pom

#

so the easiest way to change it, is to change it in the pom

#

I recommend though if you intend on changing it you make it known that it is a spigot variant

sacred cedar
wet breach
#

no there is not

sacred cedar
#

alright thats unfortunate

wet breach
shadow night
#

Because if they do, doesn't it mean overriding is as simple as just getting the command, then overriding the executor and tab completer? Might cause some issues with other plugins that do that, but who cares

wet breach
#

but I remember version command being different, don't even think it has tab completion

nova notch
#

those poor 1.8 users 😭

mellow edge
#

how does that make sense? every player has their own netty ChannelPipeline. But I want to just intercept the packet from childHandler

alpine urchin
#

sounds familiar

#

but that's a very odd and specific question @mellow edge

#

I hope you're aware there's projects that already do this for you.

mellow edge
#

I know, but I try to do it by myself since I understand netty

alpine urchin
#

Then you can learn from how these projects do it.

#

They're open source.

mellow edge
#

I intercept a packet PacketPlayInUseEntity, the only problem is that it triggers Caused by: net.minecraft.server.v1_8_R3.CancelledPacketHandleException every 2nd time I get this packet

alpine urchin
#

then figure out the cause

#

look into the source

charred blaze
#

does itemdisplay have its own hologram system or something?

mellow edge
alpine urchin
#

Look at TinyProtocol

#

You might have to tweak it for it to work well today, I don't think it'll be stable out the box. But that's a way to do it.

#

Generally there's multiple ways to actually inject and hack to get the pipeline and insert your handler. So which project you decide to look at shouldn't matter, you could look at ViaVersion or mine. But since you claim to be a netty expert, from there on you should be capable of assessing where your handler should be inserted and proceed from there on.

#

If you are fine with only supporting modern paper, the injection process is like a 5 liner.

mellow edge
#

I mean I injected my handler before packet_handler and used auto-release handler

alpine urchin
#

Did you even consider anything I just mentioned.

#

I'm going to go.

mellow edge
alpine urchin
#

Personally I think ViaVersion's injection is easier to learn from.

#

But with TinyProtocol, I guess you technically could just yoink the code and get it somewhat working.

acoustic pendant
#

Could someone tell me some way to reset a World (trying to make a minigame)

blazing ocean
#

wdym reset

#

i have a world in my plugins/plugin/maps/mygame which i copy over to the server root and create a world of

alpine urchin
#

elaborate, what do you mean by reset? what some minigames do is they a world of the map. and then they have a seperate minigame world which copies the map upon start of a minigame

blazing ocean
#

then you can juts create a new one

alpine urchin
#

yup

mellow edge
# acoustic pendant Could someone tell me some way to reset a World (trying to make a minigame)

well there is multiple ways of doing this, probably the best one would be to use proxy to redirect to the actual minigame server from lobby, but you could also just copy the original world to player world, then when the minigame is over you could delete your playing world and copy it from original source again. BUT do not use an arraylist of "placed blocks" - this is not a good practice

alpine urchin
#

lol

acoustic pendant
#

Yea, I have seen that

#

I'll try Just coping the World

blazing ocean
#

i actually use a list of placed blocks for a minigame

#

lol

blazing ocean
mellow edge
acoustic pendant
mellow edge
#

(Bukkit.unloadWorld)

brittle geyser
#

How to get comment above config key (YamlConfiguration)

blazing ocean
mellow edge
blazing ocean
#

i mean the game would just be over as it's a temp world

glad prawn
mellow edge
#

you have a world copy logic (original->temp) world AND a list of blocks to remove?

brittle geyser
blazing ocean
# mellow edge you have a world copy logic (original->temp) world AND a list of blocks to remov...

well yes, and i also have a reasoning for this.
it's kitpvp duels, i copy over the arena to a tempworld and have a list of actions the players do (blocks broken, placed, etc), and i clear that every round. the reason i don't use multiple tempworlds is because the players can specify how many rounds they want to play, so if somebody wants to play 10 rounds, loading the worlds will lag out the server

glad prawn
mellow edge
#

oh yeah that makes sense

brittle geyser
blazing ocean
#

no

alpine urchin
#

you could have em waiting in some area as they wait for the next round

#

but i feel you tho

#

i understand you

#

whats your server, i want to lag it

blazing ocean
#

especially now that i'm moving stuff over to a temp server architecture, it'll be an even longer wait

blazing ocean
alpine urchin
#

i want to play it*

#

trust

blazing ocean
#

not public atm

mellow edge
#

you want to lag it lol

blazing ocean
#

omg valence compiled in 21mins

#

finally

alpine urchin
#

yk my api collects non-anonymous stats

#

ima find you

blazing ocean
#

you mean PE

#

i removed it

#

lmao

alpine urchin
#

ok

blazing ocean
#

breaks on my paper fork

mellow edge
alpine urchin
#

thanks for reporting

blazing ocean
#

packetevents

mellow edge
alpine urchin
#

non-anonymous was a joke

blazing ocean
#

kekw

mellow edge
#

haha imagine

icy beacon
alpine urchin
#

sold to google

#

it's fine

#

and tencent

alpine urchin
#

tencent is just like the vietnamese google right

#

we can trust em

mellow edge
#

lol

alpine urchin
#

if google wants some user data, they should reach out

#

hopefully we can find a good deal

#

i'll manually type in everyone's data

icy beacon
#

can i get all the data you've collected with a buy-now-pay-later plan

mellow edge
#

I see you made PE. Then I went to see reviews, they were very positive, except this one:

blazing ocean
#

????

alpine urchin
#

omg, i saw the guy in my discord the other day

icy beacon
#

his name "govno" is literally "shit" in russian

alpine urchin
#

that was him

#

bruhh

blazing ocean
#

lmao

mellow edge
#

he doesn't have plugins....

#

wait he has

#

no way... my custom npc click event is working!

drowsy helm
#

poggers

mellow edge
#

this time protocol wiki saved me

twin venture
#

hi , its been a while since i last codded anything , what is the best aproch to deal with local values of kills , deaths , etc? so when game end it reset , a map with String,Integer?

#

in the User class ?

drowsy helm
#

UUID key ideally

twin venture
#

well , can i do it inside the user ? which obv have uuid?

drowsy helm
#

spigot doesn't come with a User class

twin venture
#

for example i can do :
put(kills,+1) etc

#

or is this a bad aproch?

drowsy helm
#

ooh i see what you're asking

#

yeah string, int

mellow edge
#

I mean increasing kills is not bad

twin venture
drowsy helm
#

but can't you make a variable for the specific stat?

twin venture
#

this is local data, so when a game end , it will calucate it for each player , and then add them to the stats StatsUser have

mellow edge
#

what does SkyUser class represent?

twin venture
#

this is Stats user , so i can do skyuser.getStatsuser().setkills(getKills(),localValues.get(kills)))

#

if i wana to set the kills in the db

#

is this a good aproch?

mellow edge
#

it is ok, if it's working it's working

twin venture
#

well i want to make it better

#

any ideas?

mellow edge
#

I mean I would ask myself why I would make it batter.

#

because I don't know what you mean with batter

twin venture
#

so to put it simple , the values in the UserStats class is the user data that will be loaded from database .
and the localValues map , are the ingame (inside arena) data for each user , once a game end , it will get the data from the map for each user and add them to the user Stats data ..

#

better in design , and performance

mellow edge
#

why not directly add it to user stats?

#

and db

#

also

#

databases are meant to store huge amounts of data, why would you load all that data back into UserStats class?

twin venture
#

why would i store the game data ,and user data? that does not make any sense

mellow edge
#

I meant why don't you just pull values from database when you need them.

twin venture
#

iam doing that , and i think you still don't understand what iam trying to do

#

so in lobby , i want to pull the data from database [placeholders] , so i can show

mellow edge
#

well from you've told me I assume you are trying to at the end of the game calculate stats and add them to db

twin venture
#

total kills , total wins .. etc

#

got it?

#

and inside the arena

mellow edge
#

is your system working rn

glad prawn
twin venture
#

that's for total kills , total deaths .. etc

#

inside the arena , i want another set of stats for example kills , deaths will show it inside the game , and it is resetable after each game

#

but the total kills are not

sullen canyon
#

it would be better if userstats was an abstract class containing only players uuid and then you would have SkywarsSoloStats SkywaraDoubleStats etc.. extending your userstats class

twin venture
#

oh do you think so that is better?

sullen canyon
#

ig thats open closed principle

twin venture
#

alr

#

so in lobby i can show this :
but not bedwars stats ..

sullen canyon
#

and then you could make your saving system work based on given abstract user data class rather than some specific class thou I dont know how your system works right now so I cant give you much help

twin venture
#

thanks

quasi gulch
#

When i hit the rate limit of the Mojang API it throws an exeption when i use playerprofile.update and i accept it async. How do i catch that exeption because that method doenst throw one it just prints it in the console so try catch doenst help

eternal oxide
#

How the hell are you hitting the rate limit? Its something like 600 in 10 minutes

#

nope I just looked its 200 per minute

quasi gulch
#

yes i because i wanted to test if i hit it

#

But is there a way to catch that exeption?

#

But i think i will do it on another way. I will just store their profile when the player joins so i dont need to api lookup them

eternal oxide
#

you need to try/catch inside the async call, or use the proper catch Exceptionally

quasi gulch
#

Ok thanks

teal oracle
#

whats the difference between
pluginname.jar
pluginname-shaded.jar
original-pluginname.jar?

eternal oxide
#

Shortest name is to be used on a server

#

shaded is teh same as teh shortest name.

#

original is (I forget)

teal oracle
#

original took less space in bits

eternal oxide
#

yeah, has no shaded depenedencies

teal oracle
#

ok

torpid forge
teal oracle
#

is there a way to teleport to server world spawn? or should i just use a regular teleport event?

teal oracle
torpid forge
#

but Its only in blocks no?

teal oracle
#

i dont think it cna do crops if thats what you are asking

torpid forge
#

like Its not diagonal

tardy delta
#

go to skript support

torpid forge
#

what will they tell me

tardy delta
#

this is spigot, we dont do that nonsense here

torpid forge
#

the version of skript is not worknig on 1.20.5 and Im on spigot thats why I came here

#

Its only with world edit I want to do all of the coal ores in a world

eternal oxide
teal oracle
#

go to aternos support or smth if that exists

torpid forge
#

bruh

#

I just wanna create a regenerating mine broo

eternal oxide
small trail
#

pls help

eternal oxide
#

Try asking a question

tardy delta
#

#general message

small trail
#

so the font doesnt work here but here it works pls help fix it

eternal oxide
teal oracle
#

how can i register commands without adding properties? like not having description to a command and such

eternal oxide
#

can;t have an empty key

inner mulch
#

but you need to add it to plugin yml

silver robin
eternal oxide
#

what?

teal oracle
#

no i mean like only having the name of the command in the plugin.yml

eternal oxide
#

you can't

inner mulch
#

i dont get errors

eternal oxide
#

a key with nothing under it is not a valid section and will be ignored

teal oracle
inner mulch
#

commands:
test:
idk:

works

teal oracle
#

what

eternal oxide
inner mulch
#

what doesnt work?

#

have you tried mr samurai

teal oracle
#

wwo

#

wow

#

i saved 0.03 kb

inner mulch
#

ok

teal oracle
#

lets goo

tardy delta
dawn flower
#

what's a good way to hide plugins to non op players? so u can't do /pluginname:command, u can only do /command

i tried using commandmap but that does it globally (even for opped players) and i can't just listen for tab completions cuz that'd leak my plugins if the server stops (unless there's a way to create a non plugin dependant listener)

tardy delta
#

listen to command pre process event iirc

dawn flower
#

i can't just listen for tab completions cuz that'd leak my plugins if the server stops

#

also that event is after u already execute the command

dawn flower
#

same with that

calm marsh
#

Hello, I'm making a Spigot plugin, and I'm having some trouble with it. Does someone know how to "set" the Text on a WallHangingSign ? Thank you.

dawn flower
eternal oxide
dawn flower
#

it isn't

eternal oxide
#

yes it is

dawn flower
#

no

#

i don't want them executing it nor showing in the tab completions

eternal oxide
#

Its literally all commands that are exposed to a client

dawn flower
#

(even if the plugin is disabled)

eternal oxide
#

you can;t use a command with no permissions

dawn flower
#

not all plugins have good devs

eternal oxide
#

you can;t see a command with no permissions

tardy delta
dawn flower
#

trash devs use if (!player.hasPermission("wtvr")

eternal oxide
#

for those Like worldedit you can remove the command in that event I just linked

dawn flower
#

is there a way to make a listener that is non plugin dependant

eternal oxide
#

remove the damn command in teh event I linked

dawn flower
#

if the plugin dies it leaks everything

eternal oxide
#

oh my god, I'm talking to a wall

dawn flower
#

bro

eternal oxide
#

bro

dawn flower
#

if the goddamn plugin gets disabled

dawn flower
#

the plugin stops handling the listener

eternal oxide
#

That event has ALL commands teh client CAN know about

dawn flower
#

WHICH MEANS IT LEAKS IT

inner mulch
tardy delta
#

then hide it there

dawn flower
eternal oxide
#

if it's not sent in that event the client does not know it even exists

dawn flower
#

the server sends the command update every whatever

#

that's how when u load a plugin during runtime using plugman the command shows up

eternal oxide
#

it updates on join, permission attachment change and world change

dawn flower
#

great it updates on join

calm marsh
dawn flower
#

what if the plugin gets disabled

inner mulch
#

missingreports did you even try before saying elgarL's method doesnt work?

dawn flower
#

then a player rejoins

#

i know it wont work

inner mulch
#

how about trying

eternal oxide
#

if of course it works

inner mulch
#

before saying that

silver robin
rough drift
eternal oxide
#

Stop arguing and try it

dawn flower
#

u owe me 100k if it doesnt work

eternal oxide
#

commands do not leak

dawn flower
#

they do

eternal oxide
#

its impossible for a client to even know a command exists without it going torough that event

dawn flower
#

uh

eternal oxide
#

On OLD spigot you used to get a permission error

rough drift
dawn flower
#

how tf do u even set the commands

eternal oxide
#

today the client has no knowlege of teh command at all

dawn flower
#

oh wait it returns a modifieable list

rough drift
#

the client does

inner mulch
silver robin
# dawn flower i meant if the plugin stops

okay, are you trying to do this to your plugin, or some other plugin?
in the former, i'm not sure what the problem is about, because when your plugin stops, your plugin's tab completer also stops

rough drift
#

Elgar the client gets sent the command tree lmao

eternal oxide
dawn flower
#

wtf

#

fawe commands still show up

eternal oxide
#

commands do NOT leak

#

oh my god, what did I just say

dawn flower
#

just told u

#

it worked first

dawn flower
#

i disabled the plugin

#

THEN IT SHOWS AGAIN

#

THATS WHAT IM TALKING ABT

rough drift
#

show us your code

dawn flower
#

yes

eternal oxide
#

if not shut up

#

noi you did not

dawn flower
#

yes i did

silver robin
#

please chill down
are you talking about non-OPs seeing FAWE commands being tab completed, but not being able to execute them?

dawn flower
#

i rejoined

#

after the plugin was disabled

#

and its back

silver robin
#

@dawn flower just to be sure that I/we understand you, are you talking about this behaviour? (hypixel has a /f command for friends)

eternal oxide
dawn flower
#

i just did e.getCommands().clear()

#

idc abt fawe rn

#

at first it worked

#

only fawe popped up

#

but then i disabled the plugin

#

rejoined

eternal oxide
#

thats impossible

dawn flower
#

and all commands r back

eternal night
#

what plugin did you disable?

dawn flower
#

the listener plugin

rough drift
#

me about to drop Player#updateCommands

eternal night
#

So

dawn flower
#

thats what im arguing from the beggining

#

if the plugin dies all plugins r leaked

eternal night
#

Okay?

rough drift
eternal night
#

If world guard dies, so is your map

dawn flower
#

world guard doesnt die

eternal night
#

idk what your point is

#

neither should your plugin then

dawn flower
#

also i have extra protection

rough drift
#

bro is schizo

eternal oxide
dawn flower
#

can i just create an always existing listener

eternal night
#

this discussion is dumb, if you care to have a minimal surface area, extract that specific logic into its own small plugin that does nothing else

#

no

eternal oxide
#

every command the client knows about goes through that event

dawn flower
#

with refleciton

eternal night
#

No

rough drift
#

you can't

#

you can register to all plugins maybe? but that's dumb

eternal night
#

just, write a two line plugin that does this

#

it can't break, its just an event listener

calm marsh
#

Someone already made a plugin which set the text on a WallHangingSign guys?

tardy delta
#

bruh why, its five lines

silver robin
calm marsh
#

I'm going to give it a try, thank you

rough drift
tardy delta
#

cast the blockstate to a Sign

silver robin
eternal night
#

you don't hacve to call setSide

#

you have to call .update on the sign block state snapshot

silver robin
eternal night
#

just instanceOf it smart

eternal oxide
#

just Tag it

dawn flower
#

what field has the listeners set / map / list?

eternal night
#
if (!(block.getState() instanceof final Sign sign)) return`

sign....
tardy delta
#

why the final lol

dawn flower
#

what's funny?

eternal night
#

listeners are stored in the handler list

rough drift
#

I do that

eternal night
#

best of luck

rough drift
#

final is nice

eternal night
#

final is nice NODDERS

tardy delta
#

extra bloat

eternal night
#

not really

tardy delta
#

with no added value in this case

eternal night
#

prevents you from changing something you should probably not be changing

rough drift
#

^

eternal night
#

you have 0 idea what this case is lol

tardy delta
#

skill issue if you do that

rough drift
#

I don't do it much so I should begin doing it more

eternal night
#

Yea I mean, people tend to run into skill issues tho

#

some people reassign variables accidentlly, others fail to come up with a simple 17 endpoint rest service.

#

It's a nice safety mechanism with no downside beyond verbosity

dawn flower
#

what happens if i set the plugin as null in RegisteredListener constructor

eternal night
#

just patch the damn server man

#

if you care THIS much about your plugins not leaking

#

just patch the server

rough drift
#

chat remember to always call hasCustomModelData, apparently that fixed my code

dawn flower
#

ugh

rough drift
#

HandlerList.unregisterAll(this);

eternal night
#

or, again, write a minimal plugin with near 0 attack surface

rough drift
#

I mean a plugin that just filters has 0 attack surface because it reads nothing

eternal night
#

Yea

rough drift
#

lmao not what I hoped for but

#

works?

dawn flower
#

is there a way to identify commands with ":" in their name and pluginname + commandmap?

#

or do i just use regex

dawn flower
#

commands could contain : for whatever reason

rough drift
#

try parse it to a namespaced key

dawn flower
#

actually commands with : in their name deserve to not exist

acoustic pendant
#

Hey, i'm getting the world folder:

#

But it says it is null

#

I'm getting the world from player location

tidal kettle
#

hey Bukkit.getPlayer produce an error when the player isn't online or didn't exist, how can i check and delete the error?

eternal oxide
#

bukkitWorld is null

acoustic pendant
#

how can that be null?

eternal night
#

I mean, show the more extended code for bukkitWorld

eternal oxide
#

you clearly are not

acoustic pendant
eternal night
#

so you are not

#

you are blindly guessing if a world by that name exists

#

which, in your case, it does not

acoustic pendant
#

no wait

eternal night
eternal oxide
#

Show where you get teh String world

silver robin
tidal kettle
#

okay

acoustic pendant
eternal night
#

so what is world here

silver robin
# tidal kettle okay
Player me = Bukkit.getPlayer("musava_ribica");
if (me == null || !me.isOnline())
    return;
// do whatever ```
eternal oxide
#

that code would not even compile

eternal night
#

it clearly isn't the commented out code OMEGALUL

acoustic pendant
#

but it is to show you lol

#

I have the location and world above

eternal oxide
#

show us ACTUAL code

silver robin
#

send us the entire file for ease

#

?paste

undone axleBOT
acoustic pendant
eternal oxide
acoustic pendant
#

there you got

eternal night
#
  Bukkit.unloadWorld(bukkitWorld, false);
        
GameManager manager = new GameManager(plugin, world);
#

okay so

acoustic pendant
#

oh

#

okay

eternal night
#

yea

acoustic pendant
#

that is a great point actually xd

eternal oxide
#

I'll just unload this world and then try to use it later 😉

acoustic pendant
eternal oxide
#

you can copy the files, even if loaded

#

just don;t copy the lock file

acoustic pendant
#

uuh

#

let me try that

tidal kettle
silver robin
#

at this point, it's a matter of preference
it would be a lot worse if there could be thousands of online players, in which case what I sent is faster (assuming the player name is exactly correct), because it uses a Map, while you would still have to iterate through a Collection

acoustic pendant
eternal night
tidal kettle
#

why?

silver robin
#
File newSource = new File(source, file);
File newDestination = new File(destination, file);``` is this required? since `source` and `destination` variables are `File` already
eternal night
# tidal kettle why?

beacuse getPlayer does the exact same if you rely on the weird prefix behaviour OMEGALUL

tidal kettle
#

with bukkit.getOnlinePlayer.contain() i do not

eternal night
#

you were literally linked the "pls just null check"

shadow night
eternal night
#

the null check is the important part

tidal kettle
eternal night
#

doubt

acoustic pendant
eternal night
#

not that the isOnline check there is actually useful

silver robin
eternal night
#

getPlayer yields null for offline players, non null for online ones

shadow night
#

How to check if player is online? getPlayer(playerName) != null

silver robin
eternal night
#

no

shadow night
silver robin
#

okay yeah I get it mb

shadow night
#

getPlayer will return null if the player is offline

tidal kettle
#

Player target = Bukkit.getPlayer(args[1]); if (target.getName() == null || !target.isOnline()){

icy beacon
#

fyi use getPlayerExact if you are working with names and not uuids

tidal kettle
#

this is gonna work right?

eternal night
#

no

silver robin
#

but if you have a Player object instead of their username or UUID, it's probably better to call isOnline method, no?

shadow night
tidal kettle
eternal night
#

you are null checking the name

#

which means you call getName() on something that might be null

icy beacon
tidal kettle
#

yep my bad...

icy beacon
#

e.g. if you are checking for name123 and the player's name is name1234 you will get the player

#

but not with getplayerexact

silver robin
#

getPlayer simplified is just this java Player found = this.getPlayerExact(name); if (found != null) { return found; } else { return ... /* approximate lookup }

icy beacon
#

yep

#

so just use getplayerexact

silver robin
#

note that getPlayer is deprecated in CraftBukkit

icy beacon
#

in craftbukkit maybe

#

we are in spigot

silver robin
#

well yeah, but at the time being, it's just a proxy call

inner mulch
#

how do servers change an inventories apperance based on the inventory (with a texture pack)

#

I've seen completely different looking guis

#

but there is only one inventory texture in minecraft, right?

echo basalt
#

It's pretty trivial

#

The resourcepack has a font file

#

Where you can define custom characters and such

#

And they can map out to a .png file

#

So you match a utf character (\uE001) to a picture (my-custom-gui.png)

#

The next thing you need is a negative space font to be able to shift the picture left and right

inner mulch
#

oh so i just a char?

echo basalt
#

Once that's done, you just set it on the inventory title (<space.-8>\uE001)

inner mulch
#

thanks

echo basalt
#

For animated guis, you just create multiple characters, one for each frame

#

For fancier guis where buttons can be on/off you can have a hollow main gui and then separate characters for buttons

#

You change their height by messing with the character ascent

inner mulch
#

okay, thanks for the insight

#

im gonna try it out

silver robin
#

I've seen cases where it renders above whatever items are clipping

echo basalt
#

Lang file -> container.inventory.title iirc

#

You can then make a font to add it back with a crazy ascent and just toss a character with some spacing in there when needed

#

If you want lang file support, you can just edit container.inventory.title to container.inventory.customtitle, for example

#

and then still use the font stuff but with a translatable component

#

it's wonky

silver robin
#

seems cool, I've never looked into using custom fonts
thanks

blazing ocean
#

since that is the default chest bg

#

wrong path

#

minecraft:gui/container/generic_54.png

blazing ocean
echo basalt
#

no fucking clue it's been months

blazing ocean
#

works for me 🤷

trail coral
#

how do i spawn an entity at a location and then get the instance of it?

eternal oxide
#

when you spawn it you get the instance back

trail coral
#

oh thanks

quiet ice
#

what do you reckon is the more natural ordering of parameters: x1, x2, y1, y2 or x1, y1, x2, y2?

#

I think I always did x1, y2, x2, y2 but I feel like I have a little bit of temporary brain damage

tardy delta
#

depends on their use, the latter for coordinates

quiet ice
#

well it is for defining a 2D rectangle, so yeah - coordinates

tardy delta
#

ye the latter

echo basalt
#

I usually make point classes for this

ornate heart
#

I've made a custom enchantment system that store the enchantments via PDC. I'm wondering how I should approach displaying the enchantments in lore.

My thought process is: Since Minecraft has its own lore for the default enchantments, I should add the HIDE_ENCHANTS flag and then rewrite the lore myself.
The problem with this is if there is another enchantments plugin that writes their own lore, then that may mess things up.

Any suggestion s on a way to approach this?

echo basalt
#

then just pass min and max

icy beacon
icy beacon
#

There should only be one

#

If they use multiple, it's on them to figure shit out

blazing ocean
icy beacon
#

or that

ornate heart
#

It also makes my plugin pretty heavily dependent on another plugin.

icy beacon
#

I'm saying that they SHOULD NOT use other enchantment plugins

umbral ridge
#

schnitzel moment

ornate heart
#

I know. I'm just saying: Lets say my plugin depends on a plugin like AdvancedEnchantments. If the person that wants to use my plugin is already using ANOTHER enchantments plugin, then they would have to switch to AdvancedEnchantments in order to use my plugin (Since, they shouldn't be using more than one enchantments plugin)

icy beacon
#

Why would your enchantment plugin depend on another enchantment plugin

ivory sleet
#

which iirc also uses invokedynamic or invokespecial

#

So big W

ornate heart
icy beacon
#

Ah

#

I mean if advancedenchantments has an api just use that and don't have your own custom enchantment system

ornate heart
#

Yea

#

and then I could also support other enchantment plugin in the case that they use another plugin.

quiet ice
# blazing ocean 2 records

In that case I'd use LWJGL's Vector2f class over useless purpose-made records from an API design perspective

blazing ocean
ivory sleet
#

Vector2fc :D

blazing ocean
tardy delta
ivory sleet
blazing ocean
#

ahh

ivory sleet
#

not sure if it stands for anything particular tho

#

like why the c out of all letters

blazing ocean
#

Vector2fro kekw

quiet ice
blazing ocean
#

Vector2fim 🤷

tardy delta
#

invokedynamic means it does code generation at runtime through bootstrap methods

quaint mantle
#

Vector2ManagerFactory

blazing ocean
#

oh god

tardy delta
#

RecordX::hashcode does not exist in the bytecode when compiled, it gets generated through ObjectMethods::objectMethods or smth

quiet ice
#

And I'm not sure how you'd need to lazily computed data with indy (unless it is constant per-class, but not per-instance)

tardy delta
#

ah ::bootstrap its called

#

ye its per class

#

classfile size ig? cant think of anything else

ivory sleet
#

Tbh im not sure either, iirc not much was said about it in the JEP ntl

quiet ice
tardy delta
#

ye it is

ivory sleet
#

well they’re “transparent immutable data carriers”

#

with deconstruction right? Or maybe thats still in preview

tardy delta
#

iirc their getters arent actually written out in the bytecode, but compiled at runtime

slender elbow
tardy delta
#

they just point to a bootstrap method that generates their code

slender elbow
tardy delta
#

well ye sorta

slender elbow
#

no not sorta lol

#

the compiler generates them

tardy delta
#

but they simply do an invokedynamic ObjectMethods::bootstrap or smth

#

which generates the actual callsite

quiet ice
#

I don't see how indy is required here

slender elbow
#

I think we're talking about different things here

tardy delta
#

i dont either 🤷‍♂️

quiet ice
#

invokevirt suffices, no?

slender elbow
#

not if the bsm wants full access to the class data

tardy delta
#

ive heard it can be faster but i dont see how

tardy delta
quiet ice
#

indy is good for functional interfaces I'd say. Can also be good for more advanced niche purposes to do things that would otherwise be completely impossible to do with invokeX (i.e. obfuscation)

tardy delta
#

not sure about the implicit getters anymore

#

indy is good for reflection

#

well methodhandles

slender elbow
#

indy is good for dynamic languages, that's what it was originally introduced for, not java specifically

tardy delta
#

i believe ruby uses them

slender elbow
#

jruby was one of the first iirc

tardy delta
#

or was it jruby or smth

#

forgot ruby isnt a jvm lang

quiet ice
#
 * These methods may be used, for example, by
 * Java compiler implementations to implement the bodies of {@link Object}
 * methods for record classes.

Okay, so it's the compiler-generated implementation of the Record methods that uses them

tardy delta
#

ye

#

same for lambdas

#

but LambdaMetaFactory

#

theres also one for string concatenations IIRC

slender elbow
#

yep

tardy delta
#

StringConcatFactory::concatWithConstants and such

#

youre not the only one who wrote a classfile reader

slender elbow
#

and there's one for switch expressions I believe, but the fancier ones like pattern matching over switch

tardy delta
#

never seen that one, isnt that just a lookupswitch opcode?

#

ah the pattern matching

slender elbow
#

well, not when you're switching over types

quiet ice
#

Lookupswitch is the old-style switch statements

slender elbow
#

then there's the jdk.dynalink module which helps dynamic language compilers and runtimes deal with generation of, uh, stuff, it was a cool thing to make a compiler

tardy delta
#

never used any jdk internals tbh

#

only ever had the urge to pull in the module that provides @ForceInline

silver robin
tardy delta
#

ig this isnt about x1, x2 anymore :(

slender elbow
#

it isn't really internals, it's a jdk module that just isn't part of SE

silver robin
#

and by the way I was too scared to mention minX, minY, width, height instead of x1 x2 y1 y2

tardy delta
#

if it were c i woulve written #define rect(x1, x2) x1, x2 :(

quiet ice
slender elbow
#

it's pretty neat but, like, unless you're making your own language runtime it isn't really all that useful

tardy delta
#

ooh so much new stuff to explore

quiet ice
#

idk, the main appeal of invokedynamic I find is for doing obfuscation; which I am not the person to do in the first place

tardy delta
#

i cannot seem to remember how indy worked for lambdas

slender elbow
#

lol

quiet ice
#

So I kinda ignore invokedynamic (well I still know that javac generates them for me, but there is little reason to actually write ASM transformers that emit them).

tardy delta
#

imagine writing your own compiler

quiet ice
#

I've contributed two or three (depending on how you count it) commits to janino, does that count?

tardy delta
#

whats janino

#

"can execute java code directly in the jvm"

quiet ice
#

in some ways it is equivalent to javac - but doesn't require a JDK to execute!

tardy delta
#

"execute the code directory in the running jvm"? as in a classfile generator?

#

feels like hot swapping

quiet ice
#

it generates *.class files from *.java files

tardy delta
#

i seem to have read over the fact that its a compiler and not a vm

quiet ice
#

that is pretty much all it does; it claims to do things ontop of that - but they are mostly scripting related and sit ontop of that compilation thing. It's the main appeal to some, but for me the compiler thing is the main appeal

slender elbow
#

I mean if you include the jdk.compiler module you can also compile java files at runtime

#

modules 💜

quiet ice
#

Well the absolute main appeal is that it has a super intuitive structure for me. But it is sorely out of date feature-wise sadly.

tardy delta
quiet ice
#

Though I have to warn you: I consider 4k+ LoSC behemoths intuitive (which janino has a few of) - so most will absolutely not like it

slender elbow
#

it depends on the application ofc

tardy delta
#

LoSC?

quiet ice
#

lines of source code

slender elbow
#

as a library developer there isn't really a downside, as an application developer, well, you have full control over your application

tardy delta
#

only 4k

#

ah per file 💀

#

god bless you, you havent had the time to see 30k lines of generated c code in a file

quiet ice
#

Yeah, and the Java.java file in janino is 6.5k lines

tardy delta
#

most editors simply die

quiet ice
#

I've been meaning to try out modules at runtime + compiletime. So far I exclusively use modules at compiletime where they are quite good at hiding implementation details if necessary

tardy delta
#

i havent found a reason to use them

quiet ice
#

Well I've mainly been meaning to use them as it would hide away the fact that a good portion of my projects have a class called "JavaInterop"

tardy delta
#

its always the legacy code

rough drift
#

chat I am setting the InventoryClickEvent's result to DENY but apparently it still lets me pick up items? I added a debug statement before setting it and it's running, it also has the highest priority so idfk anyone know why this may be happening at all?

#
if (result.shouldCancel()) {
    System.out.println("I'm running");
    event.setResult(Event.Result.DENY);
}
```This is printing fine but I can still pick up the item
#

result is my own object, returned from another piece of code

#

... and now it works what?

#

Alright thanks guys

tardy delta
#

wonderful

silver robin
#

do you mean take from a chest for example?

#

also event.setResult(Event.Result.DENY); is very suspicious to me, shouldn't it be something like event.setCancelled(true) ?

rough drift
#

also yes picking up from a chest

#

Apparently it works, don't know if I just went full schizo and forgot to build something or what but it works now

sand spire
#

Does the <id> in maven repository matter? Cause I have some duplicate repository URL's with different id's and I'm not sure if I need to keep both or can remove one

rough drift
#

the ID does matter afaik

sand spire
#

ty 👍

whole gust
rough drift
#

where DEFAULT uses vanilla's mechanic, DENY is like setting cancelled to true and ALLOW is like setting cancelled to false

#

plus if I ever need to have users pick something I can show the name directly

#

and it's clearer what it is doing

whole gust
#

Interesting. Ig I'm just used to using setCanceled. Hopefully it doesn't result in future issues

#

The less methods I have to mentally register, the better lol

rough drift
#

nope, setCancelled just does:

setResult(cancelled ? DENY : ALLOW)

#

so you're fine with using it

rough drift
hushed spindle
#

how do i get the server's version package like 1_20_R4, i used this previously but the naming conventions seem to have changed

#

i would prefer not to have to use Bukkit.getVersion() and mapping each to a package version

chrome beacon
#

Don't rely on the package name

#

Also Paper will stop relocating so be prepared

hushed spindle
#

relocating?

chrome beacon
#

Adding the versioned package

hushed spindle
#

ah

#

ill do something else then

remote swallow
small valve
#

If a message is cancelled on Spigot, how do I check if that message is cancelled on Bungeecord?

chrome beacon
undone axleBOT
small valve
#

I want to check if a spigot message is cancelled in Bungeecord. I'm sending a message via a spigot server, let's say "hi" is in the list of banned words.

"hi" is cancelled on the spigot server, but on my Bungeecord plugin, even if I check if "event.cancelled()" is true, it still runs, so I assume the event is not cancelled.

#

Is tehre any communication I can do without plugin messaging channel to check (on the proxy) if an event fired on the spigot server is cancelled

chrome beacon
#

so why do you need to check that

small valve
#

I have a global proxy chat plugin and I want it to be compatible with plugins that cancel messages with links or curse words

chrome beacon
#

Use the pmc then

#

Plugin messaging channel*

small valve
#

🗿

#

That means I need to make my own "helper" plugin and put it on the spigot server as well right?

buoyant viper
#

theres no real communication between bungee and the server beyond the messaging channel :p

chrome beacon
#

If you really want to avoid it you can check for out going messages

#

That would cause all sorts of issues though

buoyant viper
#

why not find (or make) a bungee plugin to manage ur chat instead of something per-server?

small valve
#

I was told that cancelling (or editing) proxy messages are not really a good thing to do.

My plugin works with some proxy-based chat filters but not server-based. And again, compatibilty seems to change depending on how that person implemented their filter

rare rover
#

how would one set the display name of an ItemEntity

#

(using NMS)

chrome beacon
#

why using nms

rare rover
#

cuz im making the entities client side

chrome beacon
#

also when working with nms it's very important that you specify the version you're on

rare rover
#

i need them to be client sided

#

oh sorry, 1.20.4 so 1.20_R3 iirc

#

currently got this:

private void spawnClientSideEntity(@NotNull Player player, @NotNull Location blockLocation) {
        final ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
        final ServerLevel level = serverPlayer.level().getWorld().getHandle();
        final ServerGamePacketListenerImpl listener = ((CraftPlayer) player).getHandle().connection;

        final ItemStack itemStack = ItemStack.fromBukkitCopy(new org.bukkit.inventory.ItemStack(Material.COAL));
        final ItemEntity entity = new ItemEntity(level, blockLocation.x() + 0.5, blockLocation.y(), blockLocation.z() + 1.5, itemStack);
        listener.send(new ClientboundAddEntityPacket(entity));
        listener.send(new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData().getNonDefaultValues()));

        startTrack(player, listener, entity);
    }```
slender elbow
#

why not use the api? you can show entities to a single player if you wish