#help-development

1 messages · Page 1135 of 1

glossy laurel
#

Is it true that in a big SMP worlds servers needs restarts or RAM constantly increases even if your plugins have no memory leaks?

eternal oxide
#

Memory leak confirmed

#

although depending on teh GC Java can use upto its assigned memory befor clearing it

eternal oxide
#

garbage collector

#

the function which frees up memory

glossy laurel
#

ah

#

but like

#

if you introduce no memory leak

#

ram usage now and after 48 hours won't change without restart

#

right?

slender elbow
#

it'll go up and down

floral drum
#

fluctuation

glossy laurel
slender elbow
#

keyword "down"

glossy laurel
#

the floor and ceiling

#

wont change

#

basically

floral drum
#

but if you had a memory leak, it would keep going up gradually

glossy laurel
#

well that's what I thought

floral drum
#

or the total heap is just stuck at an amount and never adjusts to the used heap

#

or max heap

#

whatever

#

but at that point it will stay the same

#

until something in the heap reaches that limit and it goes to a higher amount

glossy laurel
#

okay thanks

slender elbow
#

big misconception is that if it gets close to the limit there's a leak

floral drum
#

yea

#

because you see it spike and never go down

#

so you assume it’s a leak

slender elbow
#

the key is that the minimum, after GC cycles, keeps increasing, then you got a leak

floral drum
#

I use a specific param to adjust the max heap close to the total heap, instead of it being too much

glossy laurel
floral drum
#

or flag

slender elbow
#

also don't give the jvm heap the whole ram you got, you gotta leave room for the OS and native buffers

river oracle
#

I just multiplied by 10 duh

#

I stg people are so dumb now adays

#

It's probably those 5g towers and tik tok

glossy laurel
#

can spark show you your ram usage instead of just cpu?

remote swallow
#

does it have a ram button on the graph

floral drum
glossy laurel
#

no

#

but I mean

slender elbow
#

yeah it can

glossy laurel
#

ram breakdown

#

like with profiler

slender elbow
#

heap dump

floral drum
#

profiling, heap dumps, tps, lag spikes

slender elbow
#

i don't remember the command

glossy laurel
#

heap summary?

floral drum
#

./spark heapdump

slender elbow
#

uh yeah something like that

floral drum
#

will freeze the server for maybe a couple of secs but it’s just collecting all references and stuff

glossy laurel
#

oop

floral drum
#

welp

glossy laurel
#

alr

floral drum
#

I read your mind

glossy laurel
#

oh shi

#

guys

floral drum
#

wassup

glossy laurel
#

are slabs not tile entities

#

and cant hold pdc

floral drum
#

uhh I don’t think so

glossy laurel
#

shucks

floral drum
#

pretty sure blocks can hold pdc? I can’t remember if that’s a thing

remote swallow
#

tile entites can

glossy laurel
#

dude no way

remote swallow
#

normal blocks cant

#

?customblockdata

glossy laurel
remote swallow
#

alex does have a lib for pdc on all blocks

#

?custompdc

eternal oxide
#

?morepdc

undone axleBOT
remote swallow
#

idk what that command was

floral drum
#

ah no

eternal oxide
#

I forget the other command too

remote swallow
eternal oxide
#

?blockpdc

undone axleBOT
remote swallow
#

thats the one

glossy laurel
#

pass

mellow edge
#

is InventoryCloseEvent thrown if the player crashes or should I handle that separately?

#

(I assume not but still)

river oracle
rough drift
#

hold f3+c in game with the inventory open

#

10s

peak depot
#

wait there is no way there is a hotkey to crash mc

river oracle
#

Ain't that crazy

#

Hold f3 c

mellow edge
#

it is just a command to copy the command to teleport the player to its current position

#

but holding ctrl+c+f3 is a different thing?

slender elbow
#

if you hold it for 10s it'll do a minecraft crash

#

ctrl f3 c is a vm crash

mellow edge
#

interesting tbh

pseudo hazel
#

alt f4 not relevant anymore?

proper cobalt
#

Hey guys I made an Interaction entity the passenger of a ItemDisplay, but the interaction thing is above the itemdisplay, can like move it down somehow while its still a passenger?

pseudo hazel
#

I think you can set like a translation of some sort

proper cobalt
pseudo hazel
#

hmm

#

actually idk

#

I know Display has transformation

#

but interaction does not

proper cobalt
#

Yeah and no location change either

pseudo hazel
#

idk what happens if you mount an interaction to a display and move the display

#

well interaction would have location, as its from entity

eternal oxide
#

just translation to move it down

proper cobalt
proper cobalt
eternal oxide
#

its a passenger so any translation is relative

pseudo hazel
#

its in Entity

proper cobalt
#

theres no setLocation

proper cobalt
pseudo hazel
#

well you would use teleport

proper cobalt
#

ill just teleport it to the itemdisplay

eternal oxide
#

no no teleport

pseudo hazel
#

so thats why I am wondering if its possible to mount interaction on a display that has a translation

young knoll
#

Translate the item display instead

proper cobalt
young knoll
#

… okay

proper cobalt
#

yheah it didnt work

#

ill translate the item display

pseudo hazel
#

teleporting would either just fail or move the enity regardless of mount

proper cobalt
#

whats the method to translate

pseudo hazel
#

setTransformation iirc

young knoll
#

Display#get/setTransformation

#

The first vector in the transformation is the translation

proper cobalt
#

oh no not this transformation stuff, i was having problems with it earlier idk how to use it

pseudo hazel
#

get transofmration

#

change the first vector

#

and apply it again

eternal oxide
#

just getTransformation() then edit the vec3f and setTransformation

slender elbow
#

spigot should require a CS doctorate degree to begin using it tbh

proper cobalt
#

yeah it worked sound

river oracle
eternal oxide
#

I've been programming and in IT for 40+ years but no longer have any certificates 😦

pseudo hazel
#

noob

echo basalt
#

rip

#

I feel like if ppl were educated half of the spigot API wouldn't exist tho

#

ppl would just be debating the best approach

blazing ocean
#

fabric :troll:

proper cobalt
#

guys how can i turn a component into a legacy string

river oracle
#

just don't

proper cobalt
#

i know this isnt the right discord

proper cobalt
#

so im forced to

quaint mantle
#

LegacyComponentSerializer

#

Class

proper cobalt
quaint mantle
#

Use the working one

proper cobalt
#

huh? ight

pseudo hazel
#

if citizens is worth their salt both should work

proper cobalt
#

just did section and it worked

#

if u do ampersand u probably have to call ChatColor#longassmethod aswell

paper viper
#

Cause some stuff like lores don’t have support for spigot api and the Bukkit platform doesn’t support it

proper cobalt
#

what about setting a new skin to the player

worthy yarrow
#

I would imagine you can find an example in citizens somewhere, I’ve never done that sorta thing

proper cobalt
#

completely different topic

#

just wanna set a new skin on a player

#

i have the textures i just need the method

worthy yarrow
#

Yeah I would think citizens has something related

primal mica
#

how can I get ore veins on chunk generation?

worthy yarrow
#

Otherwise how would their npcs have skins

proper cobalt
#

on myself for example

worthy yarrow
#

It’s the same concept for the most part innit?

proper cobalt
#

doubt it

worthy yarrow
#

Be patient then cuz I don’t know 🤷

#

Someone will prolly tag you with an answer

proper cobalt
#

Aye

#

i think i figured dem ones out

river oracle
#

Real ones use nms

blazing ocean
#

real ones just use fabric

eternal night
#

blue rad

proper cobalt
#

Yo is Entity#remove() the right way to delete/despawn entities

river oracle
#

Imagine being a blue

#

Loserz

proper cobalt
#

after restart

blazing ocean
river oracle
#

I'd check out doing it in some events

proper cobalt
#

if that even exists

river oracle
#

Idk I'd do something related to entity unloading

river oracle
peak depot
#

override /stop command and save before executing Bukkit.shutdown()?

proper cobalt
river oracle
proper cobalt
proper cobalt
river oracle
#

?jd-s

undone axleBOT
proper cobalt
#

actually i got it to work

#

turns out forEach() is just weird in java

#

did a manual foreach

#

the entities despawn but the NPC doesnt

#

L citizens

#

let me find out

#

Actually its so weird, sometimes it removes the entities, sometimes it doesnt

#

Why is that

eternal oxide
#

it will only delete entities in chunks that are already loaded. It won't load chunks in onDisable (I believe0

olive vault
#
    public @Nullable Location getFixedSpawnLocation(@NotNull World world, @NotNull Random random) {
        if (world instanceof ServerLevel serverLevel) {
            return serverLevel.generator.getFixedSpawnLocation(serverLevel.getWorld(), new Random(serverLevel.getSeed()));
        }
        return null;
    }```


I'm using chunk generator, any way to do the getFixedSpawnLocation async? or where is it stored in Spigot/Bukkits source code?
remote swallow
#

why do you want every possible thing async

olive vault
#

becuase im making 3 worlds in a functino

#

and theyl lag the server

#

this is the last method I need async

#

and ill be good

sly topaz
#

you do know that async isn't the solution to every performance issue right

olive vault
#

I need a solution to this one

#

I will take any advice

sly topaz
#

what is the issue at hand to begin with

olive vault
#

Ill make a video

#

and show it off

blazing ocean
olive vault
#

rad that works already

#

lol

#

the code

#

well I think

sly topaz
#

were you the guy doing a speedrun server

olive vault
#

ye

sly topaz
#

you should clarify that you're working on a fork so that people don't misunderstand what's possible and what isn't

olive vault
#

its not a fork

#

its a plugin

#

im just reading the source code

sly topaz
#

you do have a fork though, don't you

blazing ocean
#

assuming that's a bukkit world

olive vault
#

im just reading the serverlevels code

sly topaz
#

I see, I misunderstood then

olive vault
#

when I make it return null

#

the spawn location bugs out

#

so it has to be working

#

the massive lag spike

#

also plugman works

#

dont hate on me

sly topaz
#

do you want the spawn to be fixed or random

olive vault
#

random

#

normal minecraft

#

but not laggy

blazing ocean
#

well that will always be laggy

olive vault
#

how do rtp plugins do it

remote swallow
#

paper

blazing ocean
#

finding a random spawn location is pretty expensive

olive vault
#

oh i forgot im using paper

blazing ocean
#

?whereami

olive vault
#

ebic epic keeps doing that

blazing ocean
#

ebic do be like that

remote swallow
#

i think the better way to handle this is not creating worlds per uuid but having X amount of worlds already loaded and existing then giving that world to a player and resetting it once they leave/finish

#

i forgot you were using paper but they do it without lag by using paper api on paper servers

sly topaz
#

^ that's a reasonable approach, though I don't know the cost of having idle worlds around is

blazing ocean
#

i just went to my intellij workspace and my fucking macos container was open with intellij running in there

#

what was i cooking

sly topaz
#

I already recommended AdvancedSlimePaper for this purpose I believe

olive vault
#

asp doesnt accept seeds

#

like random generation

sly topaz
#

reallly? I knew it was more tailored for minigames but not to this extent

olive vault
#

the reason I cant do that epicebic is cause i have seeds

#

random seeds

#

and set

#

thats the whole purpose

#

like i have it set up if a player chats while its active it will set the seed

blazing ocean
sly topaz
#

there is simply no way to do what you want to do dynamically, you can lessen the impacts on some fronts but in the end that huge lag spike is because of generation on the main thread, which I believe for spawn chunks, can't be avoided? Someone more experienced with the chunk system may correct me on that

#

I would implement a queue system that creates the worlds on scheduled restarts to make it work without interrupting the rest of the server

olive vault
#

what about purpur

#

purpur has loadChunkAsync

blazing ocean
olive vault
#

and teleportAsync

#

what if I edit the purpur source code

#

and do that

sly topaz
#

that is a paper feature, but that doesn't matter if what I said above applies

olive vault
#

when I did a set spawn location

#

it was instant

#

like INSANT

#

insant*

#

omgf

#

instant

sly topaz
#

of course, because it doesn't have to look for a suitable spawn spot, so it doesn't have to preemptively generate the chunk

olive vault
#

wheres the code for looking for a spawn location

#

I cant find it for the life of me

#

( for the overworld)

sly topaz
#

I mean, just find where getFixedSpawnLocation is used on the call stack

olive vault
#

I tried but I only found the other chunk generator class

sly topaz
#

I can check later when I get home if you don't find it

olive vault
#

and minecraftserver class

#

let me get a ss

sly topaz
#

I mean, for vanilla generation, the generator would be null, so you'd have to look at the code that follows that

olive vault
#

NoiseBased something something

#

it extends chunkgenerator not implements, and doesnt have the spawn thingy

remote swallow
#

chances are thats the nms class

#

and is just called something else

olive vault
#

package net.minecraft.world.level.levelgen;

public final class NoiseBasedChunkGenerator extends ChunkGenerator {

remote swallow
#

thats the nms class, thats crazy

olive vault
#

well im looking in purpurs source code

remote swallow
#

nms wont use the bukkit chunk generator class

sly topaz
#

you're really asking in the wrong place given you are looking at purpur lol

#

paper's (and by extension, purpur's) chunk load/gen is rather different from the vanilla one, to say the least

#

well, gen doesn't change that much, but loading definitely does

#

so you'd be better off asking in the paper discord or purpur's if that exists

olive vault
#

it does, I'll ask their tyy

robust jolt
#

Hi, is the InventoryClickEvent fired when i click with the right/left button an item in the hand?

river oracle
#

also you won't get it triggered for right clicking air without an item

robust jolt
#

Ok, thanks you

echo basalt
#

Quick question to the more experienced nerds out there

#

Are movement packets sent before or after the nms entity updates its values

#

(can I get away with nmsEntity.location on ClientboundMoveEntityPacket or do I need to append the deltas)

sly flint
#

hello evreone

#

i want to use world guard region

#

in my plugin

#

how

chrome beacon
#

Use their API

sly flint
#

how

chrome beacon
sly flint
chrome beacon
#

That conains the examples

#

Go read it

south ibex
quaint mantle
#

read channel title

chrome beacon
#

(For a code review, no one will actually download and run your plugin)

grim ice
#

Can you give items damage multipliers using the attributes api?

#

Or do I have to implement that myself

young knoll
#

Attack damage?

#

You can give a percentage boost with an attribute

young knoll
#

Set the operation to

#

Uhh hang on the names are weird

remote swallow
#

multiple scarlar 1

#

or add scarlar

young knoll
#

No I think it’s add scalar

remote swallow
#

or add number

#

you type too slowly

grim ice
young knoll
#

Yes

grim ice
#

lovely, thanks

autumn ingot
#

what does spigot's World#getLoadedChunks actually do? when i use the method it says around 1300 chunks on the server are loaded, i find that hard to believe considering the server render distance is 10 chunks-- a 10 chunk square radius around the player would mean 20x20 chunks are loaded, that would at max be 400 chunks, so i'm a little confused on how so many more are loaded (im the only person on the server btw, its a local dev environment)

worldly ingot
#

Spawn chunks, chunk tickets (portals, etc)

young knoll
#

Isn’t it actually 21x21

#

Or is the player not centred

autumn ingot
autumn ingot
#

sorry if that seems like a dumb question im pretty unfamiliar with chunk tickets and how chunk loading works in general

young knoll
#

Spawn chunks used to be quite large before 1.21

#

I believe they were 23x23

autumn ingot
#

also thats crazy i had no idea they were that big

young knoll
#

Should only be like 3x3 in 1.21

#

Though idk at what level they are considered loaded

#

May still actually be like 7x7

cedar saffron
young knoll
#

Mmm the 23x23 was probably including the lower load levels then

cedar saffron
#

Hmmm

night abyss
#

Hi, anyone can pass me the API of Maven for the version 1.20.1? pls, it's for my pom.xml of my plugin

#

😔

viscid carbon
#

Hey yall, is there a way to get the value name from a yml?

#

nvm

night abyss
#

hey, you know what is the API for 1.20.1 for input into the pom.xml?

viscid carbon
#

paper or spigot?

#

are you trying to downgrade or whats going on?

sterile axle
#

what do yall do when you need to test your shit with another user? im so out of practice. i used to just start the client again and log in with my brother's account but now they got the m$ account bs and idk his details and don't want to bother him. so was gonna do offline mode but idk how to do that shit anymore lmao

ivory sleet
#

You could use MockBukkit

#

It has its own caveats ofc

#

But there u can emulate a server and mock a player

#

There’s also some nms stuff for fake players, could be handy but unsure how compatible that’d be with the api itself

#

And if you don’t need an entire server emulation, a simple unit test might be enough

sterile axle
#

hmm alright

#

thanks

night abyss
sterile axle
#

but cool project

restive mango
#

Hello. I would like to lock a database intentionally so I can simulate plugin behaviors in the case a rogue process locks my database. How can I do that?

sterile axle
quaint mantle
#

Hi everyone

#

Can someone tell me

#

How can i rotate

#

this

#
        for (double angle = 0; angle <= Math.PI * 10; angle += 0.35) {
            double x1 = radius * Math.cos(angle);
            double z1 = radius * Math.sin(angle);

            double x2 = radius * Math.cos(angle + 0.05);
            double z2 = radius * Math.sin(angle + 0.05);

            double y = (angle / (2 * Math.PI)) * ySeparation;

            Location tempLoc1 = loc.clone().add(x1, y, z1);
            Location tempLoc2 = loc.clone().add(x2, y, z2);

            final Location particleLocation1 = tempLoc1.clone();
            final Location particleLocation2 = tempLoc2.clone();

            new BukkitRunnable() {
                public void run() {
                    player.getWorld().spawnParticle(Particle.FLAME, particleLocation1, 0);
                    player.getWorld().spawnParticle(Particle.FLAME, particleLocation2, 0);
                }
            }.runTaskLater(Main.getInstancia(), delay);

            delay += 1;
        }
``` I asked but i really suck at maths :c
eternal oxide
#

90 runnables to rotate a couple of particles?

quaint mantle
#

wdym

#

oh

#

yeah

eternal oxide
#

you are creating a new task every angle

quaint mantle
#

i do it on purpose

#

i dont care on optimization rn

eternal oxide
#

90 runTasks for that one for loop

quaint mantle
#

i want to rotate dat where player look

quaint mantle
eternal oxide
#

use one task running async

#

you can spawn particles async

quaint mantle
#

oh , one question, is it true that asynchronously is more efficient?

eternal oxide
#

no

sterile axle
#

while you are right, his question was how to rotate not how to schedule efficiently

quaint mantle
#

well yeah but i mean he is helping anyways

eternal oxide
#

while true, I'm not advising on his current code

quaint mantle
#

i know why my server consumes 10 gb of ram with only me playing

#

(jk)

eternal oxide
#

lol

quaint mantle
#

hahahah

eternal oxide
#

how exactly do you want to rotate the particles?

#

I see you spawnign two, but how they rotate (or want to rotate) is unclear

quaint mantle
#

Oh yeah u right sorry

#

gonna send throught imgur

#

It's an animation that's why it's 3 pics

eternal oxide
#

ok a rising spiral

#

not difficult

quaint mantle
#

yeah yeah i kinda copied thishttps://bukkit.org/threads/creating-a-helix-3d-spiral-out-of-particles.314312/

#

but it was kinda wrong cause it spawned particles till Y 27k in the world, lol,

eternal oxide
#

That post looks fine, other than using packets. just use API as all it does is send a packet

#

you literally have all teh code you need in that tutorial

#

scrap the packet part and use API

quaint mantle
#

i don't know

#

how

#

to

eternal oxide
#

do the whole thing in an async task

quaint mantle
#

rotate

#

it

sterile axle
#

spamming each word is really going to encourage someone to help you

quaint mantle
#

no

eternal oxide
#

it is already rotating in the example

quaint mantle
#

bro

#

but

#

I want to do something like this

#

player faces up, helix faces up, player faces left, helix does too

#

my code js spawns it vertically

#

it's like the hypixel Burning Souls ability

eternal oxide
#

thats just getting the players location + his direction for each cycle

quaint mantle
#

could you give an example not doing it

#

im new into developing in bukkit sorry

eternal oxide
#

the code exactly the same as in the example, but where it gets the players location you use player.getLocation().add(...getDirection().multiply(2))

quaint mantle
#

oh okay thanks

#

im gonna play with that

eternal oxide
#

that offsets teh spawn location by the players direction x however much you want offset

quaint mantle
#

i still cant get it 😭

fading drift
#

is there any way I can register a world to the server when I already have the files

#

for example I copy a world and I dont need to waste time generating it because the files are the same, however I want to be able to access it with Bukkit.getWorld

fair rock
#

createWorld is the only way and didnt generate unnecessary files if there available.

glossy laurel
#

What happens when you run a task timer with 0 delay?

#

Pls no ?tas

cunning solstice
#

guys is there any gui api? im trying to make gui for my plugin and im struggling to stop inventory moving, i have packetevents api but it won't help anything i can use or without api how to make it?
code is pasted, and to be honest im trying to make so i could move items in my inventory

eternal night
cunning solstice
#

i have this " public void onInventoryDrag(InventoryDragEvent event) {
Player player = (Player) event.getWhoClicked();
if (openReforgeInventories.containsKey(player)) {
for (int slot : event.getRawSlots()) {
if (slot < 9 && slot != 3 && slot != 5) {
event.setCancelled(true);
break;
}
}
}
}"
but like im just trying to fix moving item in gui but it affects on inventory too

glossy laurel
cunning solstice
#

i mean i made so i couldn't move items in gui but it affects player inventory when gui is open

#

so like i can't move items in my inventory too

#

i tried to use " } else if (event.getClickedInventory() == player.getInventory()) {
event.setCancelled(false);
}"

#

but it doesn't work

hidden fable
#

Hello!

eternal night
cunning solstice
eternal night
#

delay is a one time thing before the timer is initially ran

#

but 0 and 1 are basically the same outside of a delay of 0 running in the same tick if scheduled from a scheduled task

toxic galleon
#

I am trying to remove both recipes for netheriteingots via their namedspacekey. With Bukkit.removeRecipe(NamespacedKey.minecraft("netherite_ingot")) I can remove the recipe of netheriteingots out of netheritescraps and goldingots. What is the namedspacekey for the other recipe (out of a netheriteblock) or is there another way to get this recipe without iterating over all recipes?

eternal night
#

no, either you iterate or you specify the keys

#

There is no "any recipe that leads to x item" lookup

toxic galleon
#

Hasn't minecraft specified these keys with their own recipes?

eternal night
#

(well there is, but that one just does iteration)

#

The other key is netherite_ingot_from_netherite_block btw

toxic galleon
#

thanks, gonna try that

fair rock
cunning solstice
fair rock
#

InventoryClickEvent

Check if event.getView().getTopInventory() == your inventory
event.setCancelled(true)

glossy laurel
cunning solstice
#

kinda works but now i can move anvil :/

eternal night
#

Yea, period 0 and 1 behave the same

fair rock
cunning solstice
#

i'll try to fix it myself

#

ty

fair rock
young knoll
#

That thread explicitly does not use inventory holder

chrome beacon
#

^^

hybrid spoke
sullen rock
#

    @EventHandler
    public void onBlockBreak(BlockBreakEvent e){

        Player p = e.getPlayer();

        if (p.getGameMode() == GameMode.SURVIVAL){

            e.setCancelled(true);

        }

    }

}```
why doesn't this work?
undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

hybrid spoke
#
  • have you registered your listener?
slender elbow
#

looks like

cunning solstice
hybrid spoke
hybrid spoke
hybrid spoke
cunning solstice
hybrid spoke
#

in exactly 6 hours im getting rewarded with dark mode until 6 am

#

thats my bounty system

sullen rock
river oracle
#

This can cause some serious lag at scale

fair rock
eternal oxide
#

there was a huge discussion about it

eternal night
river oracle
#

I just gotta figure out how to not make things explode 💪

eternal night
#

I mean, inventory view is the better approach tbh

river oracle
eternal night
#

Well their fault

#

InventoryView is just straight up the better way to do this

river oracle
#

Oh hashmap that's far to complex

eternal night
#

inconceivable

river oracle
#

That's how impatient I was for spigot

eternal night
#

owen menu type

river oracle
#

Lpl

#

Own***

#

I also have my own equivalent of InventoryView

#

And I registry back it all tardigrade

river oracle
#

I'll give you large sums of money

fair rock
#

I dont need money tbh but im reading the article xd

river oracle
#

@eternal night my PR is starved for attention

#

It keeps screaming for me

eternal night
#

Yes yes, I'll get to it xD

#

but I'd have to setup spigot dev env

river oracle
river oracle
full sluice
#

Hey guys,
I have a problem with sending packet in foreach or for

SynchedEntityData dataWatcher = this.entity.getEntityData();
        this.name = ChatColor.translateAlternateColorCodes('&', newname);

        dataWatcher.set(new EntityDataAccessor<>(2, EntityDataSerializers.OPTIONAL_COMPONENT), Optional.ofNullable(CraftChatMessage.fromStringOrNull(name)));
        dataWatcher.set(new EntityDataAccessor<>(3, EntityDataSerializers.BOOLEAN), visibleName);

        ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(this.entity.getId(), dataWatcher.getNonDefaultValues());

        Bukkit.getOnlinePlayers().forEach(players -> ((CraftPlayer) players).getHandle().connection.send(packet));

My real problem is the first player on this list he doesn't receive the packet but de rest is.
If player is single in the server the packet is sending, I don't understand
I use spigot remapped of 1.20.1

river oracle
eternal night
#

for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {

full sluice
fair rock
#

Dont send example, just send your real code

#

How do you want to help if we didnt get the code and look whats wrong xd

chrome beacon
#

also just use Citizens for NPCs

#

There's no need to reinvent the wheel

blazing ocean
full sluice
river oracle
chrome beacon
#

It's probably the most commonly asked question here

river oracle
#

Legit out of everything it makes the most sense to have a lib for

chrome beacon
#

There is an outdated guide for it

#

Which people are copy pasting and wondering why it doesn't work

river oracle
#

Beautiful

#

That's the most spigot thing ever

full sluice
#

is not NPC is simple entity of armorstand spawn with packet btw

slender elbow
#

text displays + Entity.setVisibleByDefault + Player.showEntity 🙏

blazing ocean
slender elbow
#

huh

#

all bytebuf ctors are private

#

and the other one(s) are either public or have a static factory method

sonic goblet
#

I must not lie, I built out my own way to spawn custom npcs instead of citizens 😦

blazing ocean
#

oh wait, it had an nms team ctor

#

welp CraftTeam ain't public either

#

i think i added another ctor but just forgor to update my code

slender elbow
#

private ClientboundSetPlayerTeamPacket(RegistryFriendlyByteBuf buffer) {

blazing ocean
#

probably made it public then

slender elbow
#

i mean there is no need to make them public when you can just use the codec that is already public xD

pseudo hazel
#

if I wanna use npcs im just gonna use citizens, I cba with nms garbage

weary rapids
#

hi

pseudo hazel
#

best I can do is packetevents

slender elbow
#

hello william mods

weary rapids
#

anyone know how i can get started with coding plugins or have a video?

slender elbow
#

i dip

river oracle
blazing ocean
river oracle
#

the great test of fate can I actually code an entire GUI without it exploding in my face on first open

#

I can't :(

undone axleBOT
#

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! 🎉

sullen rock
#

e.getPlayer().getInventory().addItem(new ItemStack(Material.OAK_LOG)); if (e.getBlock().getType() == Material.OAK_LOG);
why does this trigger whenever any block is broken?

young knoll
#

Why does what trigger

chrome beacon
#

That's not valid Java code

young knoll
#

Also your if doesn’t have opening/closing brackets

shadow night
#

wtf is that

#

abomination

slender elbow
chrome beacon
#

Can't have a floating if statement like that

slender elbow
#

yeah

shadow night
chrome beacon
#

or do I remember it wrong?

slender elbow
#

; is just an expression

#

or, well, a statement

sullen rock
young knoll
#

Well you have it above the if statement

slender elbow
#

it's like doing if (...) { ; } in the same way you can do if (...) println("foo");

young knoll
#

So of course it always triggers

slender elbow
#

or have random semicolong anywhere

shadow night
sullen rock
shadow night
fair rock
chrome beacon
fair rock
#

;;;;;

slender elbow
#

the only place where you can't have semicolons is before the package statement if there is a package statement

peak depot
#

what in the acutal sigma is foobar anyways?

sullen rock
shadow night
blazing ocean
#

helpful

shadow night
#

(after the if statement, not before)

sullen rock
#

oh alright thanks

young knoll
#

Why do people insist on making it one line

shadow night
#

actually, I wonder if

do {
    // code
} if(statement == true);
``` is valid
young knoll
#

Having an extra line for {} won’t kill you

slender elbow
#

no because do isn't valid in that context

blazing ocean
peak depot
sullen rock
shadow night
shadow night
fair rock
#

Can you stop writing dark magic?

#

Its forbidden 💀

shadow night
blazing ocean
shadow night
blazing ocean
shadow night
#

isn't there a programming language called english or something

peak depot
young knoll
#

That’s just skript

fair rock
slender elbow
#

that's just sql

fair rock
#

Did you mean that?

#

Im fascinated what exists

scarlet gate
#

I'm currently trying to update a premium plugin of mine but it just goes over the limit, I am aware that the mysql connector is in Spigot so was wondering if it's safe to use that or alternatively if I can upload the file elsewhere and use an external link?

slender elbow
#

safe in what way?

#

the driver is in the server, yeah, that's about it lol

paper viper
#

I think you’re stuck with that driver version too for MySQL

#

I wonder if someone could make a gradle plugin to rename the JNI methods so they’d work for relocation

scarlet gate
#

I was more worried that there could be issues with the driver on different versions and wasn't sure if it would be bad practice to use the spigot copy either

paper viper
#

You can’t use different versions because the drivers have native methods with the names that direct to Java call

slender elbow
#

well, if it was unsafe it wouldn't be there to begin with :p

scarlet gate
#

That's valid haha

paper viper
#

You can only use the spigot version but it’s prolly somewhat outdated lol

slender elbow
#

i don't think the mysql driver uses native methods

paper viper
#

Oh it doesn’t ?

slender elbow
#

afaik sqlite is the odd one out

paper viper
#

Oh ic

glossy laurel
#

When some dies to X whilst trying to escape Y, how do I get the Y in an on death event

river oracle
#

DamageSource

#

?jd-s

undone axleBOT
river oracle
#

@glossy laurel ^

undone axleBOT
glossy laurel
#

Also guys, can you create tables inside tabless in sql

blazing ocean
#

why would you do that

#

or, try to, at least

river oracle
glossy laurel
#

I want to create like a

#

Map

blazing ocean
#

what

glossy laurel
#

And store it inside a table

glossy laurel
#

Is there like a tutorial on how to approach sql

#

Like not just syntax

river oracle
#

just add multiple entries and don't use unique keys??? SQL is literally a map though

#

e.g. if you want to store player homes ensure you aren't using unique keys

#

each home can be a different entry

glossy laurel
river oracle
#

correct

glossy laurel
#

So do I just name it smth like uuid:homes

#

Or what

slender elbow
#

relational database

glossy laurel
slender elbow
#

joe

#

the "relational" part of "relational database" turns out to be quite important :3

young knoll
#

The players Id + the home name should be the unique key

#

You can have a unique constraint on multiple columns

glossy laurel
river oracle
#

hehe I just use BSON :P

glossy laurel
#

So basically

#

Instead of using a new table for each player's data

#

I use one huge table

#

And then store homes on player id + "home" + home id

#

?

young knoll
#

idk why you need the “home”

#

But yes

glossy laurel
#

Theres other stuff id need to save

#

Like

#

Playersettings let say

young knoll
#

ID | HomeName | World | X | Y | Z

glossy laurel
#

Nvm im

#

Stupid

young knoll
#

Fairly simple homes table schema

glossy laurel
#

What if I also want to save other player data

#

That is homes

#

New table?

young knoll
#

Yes

glossy laurel
#

And if I wanna get a list of all player homes

#

I do smth like

slender elbow
#

tables should be treated as a single collection of data rather than a "cram everything I can in here" kinda deal

young knoll
#

SELECT * FROM homes WHERE id EQUALS <id>

glossy laurel
#

SELECT * IN homes WHERE "id" = 'input uuid'

glossy laurel
#

Not bad considering I first read syntax today

glossy laurel
young knoll
#

= works apparently

glossy laurel
young knoll
#

Ik there’s somewhere you have to use EQUALS

glossy laurel
#

Kinda cursed tho

#

= and not ==

#

Still better than === tho

glossy laurel
#

Anyways tell me

#

How hard is it to use a db in java

young knoll
#

Not hard

#

completable futures for the win

glossy laurel
#

Or a bunch of http requests

#

Or something jaba has built in

young knoll
#

Nothing

#

Spigot already has the MySQL connector included

glossy laurel
#

💀

#

Sheesh

#

Now tell me it also has itemstack serializer included

#

Or whatever its called

young knoll
#

No

#

But it’s easy to convert an itemstack to a byte[]

echo basalt
#

paper has it builtin

young knoll
#

So will we

#

Eventually

sly topaz
#

Spigot will soon too™️

young knoll
#

Illusion is banned

sly topaz
#

effective immediately

sly topaz
glossy laurel
#

And how convert back afterwards

young knoll
#

BukkitObjectInputStream and BukkitObjectOutputStream

sly topaz
#

oh no

#

doesn't the BOIS have some issues with serialization of ItemMeta

echo basalt
glossy laurel
#

Fair

glossy laurel
#

Ill just ask in paper

sly topaz
#

I'm always amazed at how many people that run paper come to ask questions here lol

young knoll
#

Should serialize it fine

glossy laurel
#

I dont wanna use it

#

Bro just wants me to send everything in some damm components

#

And deprecates all string methods

#

Like who tf asked for that

#

I wouldve stayed with spigot but I needed to cancel death event

sly topaz
#

well, it isn't like we wanted it, but Minecraft changed and people have to adapt

young knoll
#

You can just cancel fatal damage

sly topaz
#

blame Minecraft for making messages overly complicated

glossy laurel
#

I cant

#

It didnt detect late totems

young knoll
#

You can manually check for a totem

glossy laurel
#

As I said

sly topaz
#
public byte[] serializeItemStack(ItemStack itemStack) {
  Preconditions.checkArgument(itemStack != null, "The given ItemStack must not be null");
  net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
  NBTTagCompound itemCompound = (NBTTagCompound) nmsItemStack.save(((CraftServer) Bukkit.getServer()).getHandle().getServer().registryAccess());
  return writeNBTCompoundToBytes(itemCompound);
}

public ItemStack deserializeItemStack(byte[] bytes) {
  Preconditions.checkArgument(bytes != null, "The given bytes must not be null");
  NBTTagCompound itemCompound = readNBTCompoundFromBytes(bytes, DataConverterTypes.ITEM_STACK);
  return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parseOptional(((CraftServer) Bukkit.getServer()).getHandle().getServer().registryAccess(), itemCompound));

these are the methods in the PR

glossy laurel
#

Didnt register totems equipped right before death

sly topaz
#

just yoink them in your code till the PR is merged

young knoll
sly topaz
#

you can't see them if you haven't agreed to the CLA though

glossy laurel
young knoll
#

I guess the totem procs before the event? Idk

glossy laurel
#

Oh well

glossy laurel
#

I think death occurs later than damage

glossy laurel
#

Or maybe death force updates inventory or sum

sly topaz
#

once the PR is merged, you can just use the new API

glossy laurel
#

Paper already has it

#

Im too cool

sly topaz
#

I am aware

#

but if you aren't using Paper then that's your choice

glossy laurel
#

And im in spigot

#

Cuz I hate paper

sly topaz
#

I'm holding myself from ?whereiam

glossy laurel
#

Fr

#

Spigot community more fun

#

Yk

glossy laurel
#

If someone suicides by ender pearl when being in combat with someone how do I check who he was in combat with

#

Last attacker?

glossy laurel
sly topaz
#

LivingEntity#getLastDamageCause or whatever it was called

#

I'll always find it funny that it just stores the event itself

young knoll
#

You can use getKiller

#

It’ll be null if no player is awarded the kill

glossy laurel
young knoll
#

No

glossy laurel
#

Sick

glossy laurel
halcyon hemlock
#

get killer for {x}

glossy laurel
# young knoll No

So if player tried to swim in lava whilst trying to escape X X would be the killer right?

glossy laurel
#

Nah thats defo not real

#

Not how skript syntax works

halcyon hemlock
#

people still use skript in 1985?

glossy laurel
glossy laurel
halcyon hemlock
#

lava

#

idk

river oracle
halcyon hemlock
#

I agree

glossy laurel
glossy laurel
#

Guys, how to detect memory leaks

#

Like how do I find any leaks

#

If there are any

#

Like what causes them

remote swallow
#

heap dump

eternal night
glossy laurel
eternal night
#

how do I checkout PRs with build tools

#

wasn't there a command

umbral ridge
#

Yes its

remote swallow
#

maybe you should use the gui

umbral ridge
#

-petMyCat

eternal night
#

I'll die before I use a gui

remote swallow
#

--pr BUKKIT:id

#

iirc

eternal night
#

merci

remote swallow
#

or cb

#

or spigot

eternal night
#

presumably I can also define --PR CRAFTBUKKIT:id

#

ye

remote swallow
#

yup

remote swallow
#

brat autumn rad

eternal night
#

ew why does stash not show draft PRs by default

remote swallow
#

od

#

idk

#

ask them

blazing ocean
#

bitbukkit moment

remote swallow
#

bucket

#

normal

blazing ocean
#

bitbuckit

eternal night
#

shitbukkit at best

peak depot
#

bitusbucketo?

blazing ocean
#
GitHub

GitHub is where over 100 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and fea...

blazing ocean
#

just a redirect to gh

remote swallow
#

didnt even know you did that

eternal night
#

@river oracle ```
[ERROR] /home/lynx/workspace/spigot/CraftBukkit/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftMenus.java:[101,72] cannot infer type arguments for org.bukkit.craftbukkit.inventory.view.builder.CraftViewBuilder<>
reason: inference variable B has incompatible bounds
upper bounds: org.bukkit.craftbukkit.inventory.util.CraftMenuBuilder
lower bounds: org.bukkit.craftbukkit.inventory.view.builder.CraftMerchantViewBuilder

#

BONK I request changes, make it compile pls

blazing ocean
blazing ocean
#

common java L

#

shouldve just used rust

#

and NOT go

#

you hear that lynx

eternal night
#

4 blocked messages

blazing ocean
#

💀

young knoll
#

Golang?

peak depot
#

mad

young knoll
#

Or godot?

eternal night
#

xml

blazing ocean
young knoll
#

Someone told me how godot is pronounced

#

And like

#

No

peak depot
#

go dot like the char

blazing ocean
#

code of dreams pronounced kubectl as:

||cubb cuddle||

young knoll
#

Kub rectal

young knoll
chrome beacon
blazing ocean
#

dreams of autonomy uwu

chrome beacon
#

yeah I just watched his most recent video

young knoll
#

Dreams of what

blazing ocean
#

yup thats what i was talking about

#

"cubb cuddle"

#

i was like wtf

pseudo hazel
#

godough

#

everything better than pronouncing GUI as gooey

blazing ocean
#

i do that

pseudo hazel
#

case and point

river oracle
pseudo hazel
#

homework W

#

school be eating with this one

river oracle
blazing ocean
#

not devoting your entire life to spigotmc? smh

pseudo hazel
#

I finished my homework 3 years ago

#

and still going strong

quiet ice
shadow night
pseudo hazel
#

geez, you? why!

#

thats the only one ill be accepting

paper viper
#

Just don’t say GUI

#

Cause it’s weird

pseudo hazel
#

Graphical User Interface 🤓

paper viper
#

Just say user interface or something lmao

blazing ocean
paper viper
#

There is no reason to say graphical

blazing ocean
#

text user interface

pseudo hazel
#

but its in the name, G

paper viper
#

Goddamn user interface

river oracle
blazing ocean
#

great user interface

fair rock
#

Godlike User Interface

pseudo hazel
#

Godforsaken Unusable Inventories

river oracle
#

before I sell my soul to the devil and work at some heartless corporation

paper viper
#

Fuck Minecraft GUIs man so annoying

fair rock
#

God used IntelliJ

pseudo hazel
#

so no wonder some of us look like exceptions

#

how do I get a Statistic from a namespacedkey

#

(without iterating over all of them just to compare the keys...)

chrome beacon
#

PR a getByKey method like some of the other classes have uwu

young knoll
#

Registry.STATISTIC has entered the building

chrome beacon
#

right those exist in the api now

opaque cove
#

hi how can i code my listener to prevent doing /give or /summon commands?

opaque cove
#

public class GiveListener implements Listener {
@EventHandler
public void onPlayerChat(PlayerChatEvent event) {
Player player = event.getPlayer();
}
}
I want to cancel /give or /summon commands

inner mulch
opaque cove
#

Idk im pretty new to coding so im testing a lot

eternal oxide
#

you need the preprocesscommand event

pseudo hazel
opaque cove
#

what? 😄
I tried this and this didnt work
public class GiveListener implements Listener {
@EventHandler
public void onPlayerChat(PlayerChatEvent event) {
if(event.getMessage().equalsIgnoreCase("/summon"))
event.setCancelled(true);
}
}

eternal oxide
#

its not chat its a command

opaque cove
#

like this? PlayerCommandPreprocessEvent

#

and what should i code to prevent commands then?

pseudo hazel
#

event.setCancelled(true);

blazing ocean
#

you'd also have to check if it starts with summon

#

instead of checking if the command is summon

opaque cove
#

how do i do this?

young knoll
#

Can’t you just remove the perms for it

pseudo hazel
#

you can get the message the payer wants to send with getMessage

#

and the rest is string magic

opaque cove
#

public void onPlayerChat(PlayerCommandPreprocessEvent event) {
if(event.getMessage().startsWith("summon"))
event.setCancelled(true);
}

this still dont work

pseudo hazel
#

debug it

#

print the command

#

see if its what you expect it to be

sly topaz
#

the command might contain a slash

opaque cove
#

what? i cant run it in intellij

pseudo hazel
#

to debug just means to find out why it isnt working

#

i.e. print

#

and also you can but its a pain to set up

sly topaz
#

I mean, you can run it in a debugger, you'd just have to setup a run configuration with the necessary flags and then run a server on the side also with the necessary flags

opaque cove
#

it worked now 😄 the / was missing

sly topaz
#

or use something like run-task, but that's beside the point

pseudo hazel
#

yeah the point is to find out why something doesnt work

sly topaz
#

I strongly recommend setting up a proper debugging environment in your projects nonetheless

pseudo hazel
#

instead of asking us why it doesnt work for every singel character you forgot to type..

#

its a mindset

sly topaz
#

I got a janky template which setups run-task, resource-factory gradle plugins and hotswapping in spigot/paper plugins for example

#

goes a loong way when working on a plugin and having to test things on the go