#help-development

1 messages ยท Page 1212 of 1

echo basalt
#

mojank's item component system is a lil too nice for this and I'd need to make my own abstraction

pseudo hazel
#

almost sounds like you wanna make your own extra component system

echo basalt
#

almost sounds like that's exactly what I'm thinking about

#

but it's gonna be such a pain in the ass

pseudo hazel
#

yeah

#

sounds like serializing pdc on the items into your own components

echo basalt
#

been staring at the ceiling for 15 minutes thinking about this

#

even without components (which I can somewhat do) I'll still need to make a bootleg version of mojank's codec system

#

So I can do something like

public class RevivalItemData implements CustomItemData {

  public static ItemCodec<RevivalItemData> CODEC = ItemCodecs.create(...); // lost at this point lmfao

  private final PersistentField<UUID> ownerId = PersistentFields.uuid("owner_id");
  private final PersistentField<ItemStack[]> items = PersistentFields.itemStack("items").array();

}
#

hm

#

I need to find the balance where it stops being too abstract to the point where doing straight pdc is faster

smoky oak
#

if i access a PDC is it loaded into RAM fully? serialization of em seems like a massive headache so i got the idea to just shove the data im handling into the overworld's PDC

echo basalt
#

it's fully loaded yea

#

main problem I'm facing is just codecs and stuff

#

ideally I'd make separate codec classes but at that point I might as well just load things directly

smoky anchor
#

Would it be possible/smart to use DFUs Codecs to do serialization, and just create your own 'Dynamic Ops' implementation ?

smoky oak
smoky anchor
#

Understandable, have a nice day XD

echo basalt
#

I don't need it to be that crazy

#

I just need to be able to load a couple values here and there

#

anything more complex can have manual encoding

#

but there are gonna be a million tiny lil items that just hold like 2 fields and manually doing pdc for each one of them is a huge pain in the ass

#

and item validations etc etc

#

Ideally I'd just store the pdc codec in the fields themselves but they'd need to be registered

#

I could do some fucky shit with static

#
public class RevivalItemData implements CustomItemData {

  public static ItemCodec<RevivalItemData> CODEC = ItemCodecs.create(...); // lost at this point lmfao

  private final PersistentField<UUID> ownerId = CODEC.defineField("owner_id", FieldTypes.UUID);
  private final PersistentField<ItemStack[]> items = CODEC.defineField("items", FieldTypes.ITEM_STACK.array());

}
#

but this'd create issues where fields are only defined after I initialize the item

#

which can cause issues with reading before writing

smoky oak
#

how could you read a field before the object its associated with exists?

young knoll
#

Time travel

echo basalt
#

ez

smoky oak
#

I need to store a BLOB in a database. said object may be required to be stored in any size between BLOB and LONGBLOB.
Would it be better to have identifier -> enum (TINY, BLOB, MEDIUM, LONG) and corresponding tables, or to have one table a la identifier -> LONGBLOB ?

worldly ingot
#

You can just use LONGBLOB. The blob types store bytes to denote size, but after that, the bytes are variable length

#

LONGBLOB holds 4 bytes for size information (it's an int :p), and a regular BLOB just holds I think an extra 2 bytes for an integer?

#

I can't remember if it's 2 bytes or 1 byte

#

Looked at the docs. TINYBLOB = 1 byte, BLOB = 2 bytes, MEDIUMBLOB = 3 bytes, LONGBLOB = 4 bytes for the size

smoky oak
#

ah i see ty

#

i think i can spare 4 bytes lol

worldly ingot
#

If you're indexing or sorting those types, there are further optimizations you can do. You can specify the index prefix length (basically the first x bytes in the blob to unique index by), and max_sort_length which sorts only based on the first x bytes

#

Otherwise it's fine

#

Although tbh, if you're indexing or sorting blobs, I think you need to revisit how you're storing your data lol, maybe SQL isn't the right database

smoky oak
#

nah. i am doing per-block / item data but without bloating world size. i don't want to have my plugin data pollute that more than necessary, so at most an item gets an identifier PDC and thats it

#

so i either have a coordinate identifying the data im trying to get or an item UUID

#

so sorting isnt necessary

blazing ocean
#

How can I schedule a task to be run once the server fully starts? If I schedule a task in my plugin enabling logic with a 1t delay, will it run once the server finishes starting up?

#

or ServerLoadEvent ig

shadow night
blazing ocean
worldly ingot
#

If I schedule a task in my plugin enabling logic with a 1t delay, will it run once the server finishes starting up?
The scheduler only starts once the server's ticking, so yes

smoky oak
#

then im all for it :V

worldly ingot
#

Nah, you should be indexing your key

#

You said you were using PDC to link to it, so ideally it has an index

smoky oak
#

well my idea to prevent key dupes was to use system.nanos as UUID seed

#

and store that uuid in the item PDC

worldly ingot
#

I mean the likelihood of UUID collision is practically slim to none, but yeah, that's fine too. You should probably create an index on your UUID column, especially if you're going to be accessing it quickly

blazing ocean
#

Hmmm so apparently I can paste a FAWE schematic in the ServerLoadEvent but not when scheduling a tick later

#

it just hangs

worldly ingot
#

ALTER TABLE my_table ADD INDEX 'id_index' ('id'); (or whatever your table & column names are)

#

You can also do it on table creation

smoky oak
#

wasnt it CREATE UNIQUE INDEX ON table (identifier)

worldly ingot
#

Depends on which flavour of SQL you're using I'd imagine

smoky oak
#

uh

#

im on MySQL

#

coz i cba to launch a separate server

worldly ingot
#

No MariaDB? SQLite?

smoky oak
#

ah ye lite

worldly ingot
#

Yeah SQLite has a different flavour

#

I believe the one you sent is correct? It feels very SQLite-ish lol

smoky oak
#

well this only says sql so eh

#

ill just mark this and test it later

worldly ingot
#

SQLite is flatfile, so you should actually see like a file.sql or file.database or something on your system

#

If it's remote, it's either MySQL or MariaDB

#

Or PostgreSQL I guess

smoky oak
#

my code is literally 'create(file); connection = getConnection("jdbc:sqlite"+file.abspath);' kek

worldly ingot
#

KEKW That'll do it

smoky oak
#

btw this changes access from O(n) to O(log_2 n) i assume?

worldly ingot
#

I can't remember the speed benefits from indexing tbh but I just know that indexing on columns you're WHERE/JOINing frequently is just a good idea because it's handled more efficiently

smoky oak
#

ye this table will be 99% inactive and 1% 'where' like 200 times

#

the index happens automatically when something is added i take it?

worldly ingot
#

Yeah the index just exists on the table so you don't have to do anything extra beyond creating it

shell dew
#

yo guys, I installed combatlogX but I wanted to get rid of the glow effect. I deleted the extension file as the plugin told me to do, but there was still a glow effect when people were tagged, how can i fix this?

fair rock
smoky oak
#

question about organization: if i have code for serialization and deserialization should it be put into one or two files, and what should be the name(s) of those files be?

river oracle
#

There are plenty of ways to design something the question is what design works best for you and your use case

eternal oxide
#

often de/serialization is a static method in the object itself

smoky oak
#

problem bein i cant patch spigot

eternal oxide
#

not enough info

smoky oak
#

the object im serializing doesnt implement a serialization interface, so i use bukkitinput / output stream

river oracle
#

Well there is your mistake

#

Bukkit streams suck ass

smoky oak
#

you got a better idea?

eternal oxide
#

what object can;t you serialize?

smoky oak
#

? i can serialize it just not by myself bc not all the data i would need is exposed

river oracle
#

Atleast for items and entities

#

For other sources you have the power to make such things yourself

smoky oak
#

well what exactly are you saying is the problem with bukkit streams anyway?

#

far as i know they even throw it through the version upgrader so it doesnt brick if you change versions

river oracle
river oracle
#

The bukkit streams serialize the yaml map to bytes

#

And the yaml maps are version dependent

smoky oak
#

@echo basalt said BukkitObjectInputStream uses DFU

river oracle
#

He lied

echo basalt
#

:(

#

thought it did

river oracle
blazing ocean
#

dfu my beloved

eternal oxide
#

Sorry Imillusion your internet life is over, you got one answer wrong

smoky anchor
river oracle
#

Yeah I'd quit after being wrong once

river oracle
echo basalt
blazing ocean
#

why not?

#

JsonOps kinda just wraps gson

river oracle
#

You'd have to go transform the arbitrary yaml into NBT than back into yaml

ancient bane
#

Hello Code Brothers can someone Help me with my Problem please.

I writed my First own luckyBlock Plugin spigot 1.21.4 its working Not Problem perfekt but

I Set custommodel Data of Block sponge 9999 Block with Special metadata but i want to Set now a Special Texture for this Block i know i need to create a Texture Pack with this Meta stuff but idk how has to Look Like.

Or understand i Something wrong sry If im stupide ITS my First Plugin i do it in self alone with gpt o1 and Docs Research.

Thx If someone has Time to help

river oracle
#

The spigot yaml format is utterly disconnected from how mojang structures things. It'd be a heavy process that is just worse than just exposing a decent byte api

ivory sleet
smoky anchor
#

I see, makes sense I guess

fair rock
#

Since when blocks have custom model data?

smoky oak
#

the real problem im running into is that even if i wanted to serialize things manually i couldnt

river oracle
blazing ocean
#

blocks don't have model data nor custom models

smoky oak
#

or well not without heavy use of reflection

river oracle
#

But thats all I can do with how vague you've been

smoky oak
#

eh fair enough, i wanted a generic solution, but one of the things i was looking at specifically was PDC

#

which for some bloody reason refuses to spit out the PDT for the keys it has

river oracle
smoky oak
#

great

#

whats the remapped requirements again?

smoky anchor
smoky oak
#

depend + remap plugin?

river oracle
river oracle
smoky anchor
smoky oak
#

the reason im here specifically is because 99% of plugins that run on spigot run on other servers too

river oracle
smoky oak
#

apparantly not

river oracle
#

Or just playing off of chance

smoky oak
#

?

river oracle
#

Cuz if you stay away from new api you'll probably be fine for a while

smoky oak
#

is hardfork 'experimental' spigot or smth

river oracle
river oracle
smoky oak
#

i have no idea what youre talking about
and as for paper, no

fair rock
#

Experimental spigot is the best unintended joke ive read this month

ancient bane
river oracle
ancient bane
#

Go i the wrong way i cant find Tutorial or Something else

river oracle
#

It's best we can offer as api here

smoky anchor
smoky oak
ancient bane
#

Cause Player need for soup

smoky oak
#

uh the way mushroom blocks work is by saying 'true / false' for every direction

#

some of those combinations cannot exist in vanilla minecraft

#

so you can use those

river oracle
#

I think their translator makes no distinction of block and item

#

Ngl

young knoll
#

People normally use noteblocks these days

blazing ocean
#

^ noteblocks are nice

ancient bane
smoky anchor
#

Your text is very hard to read with your randomly capitalizing some words. If you're already using "AI" for code or whatever, use it to translate your message.
I think it will yield better results.

smoky oak
#

wheres the website with the mappings again @river oracle

undone axleBOT
smoky oak
#

ok so either im a dumbass or PDC isnt in there

smoky anchor
#

PDC is a spigot thing ?

smoky oak
#

i seeeeeee

#

reflection it is

ancient bane
# smoky anchor Your text is very hard to read with your randomly capitalizing some words. If yo...

I will research this way with my AI skills and docs, thanks bro ๐Ÿ™๐Ÿ™
Maybe last question: give me something where I can see how I can create the texture for this (my luckyBlock), like docs or latest Spigot videos.
I found a Vanilla 1.21.4 template for the default texture pack but nothing on how to add, change, or do other stuff in this theme.

I did find a template for the 1.21.4 default Minecraft texture pack but nowhere how to adapt or modify it regarding new blocks that I want to add to the game.

My goal is to add a new luckyBlock with texture and keep all other blocks exactly as they are without affecting anything, meaning adding a new block with texture using my plugin

#

I Hope thats better

river oracle
smoky anchor
ancient bane
smoky anchor
#

Best I can do is redirect you to Minecraft Commands discord server, those ppl will know what to do with the RP.
Can't help more.

ancient bane
ancient bane
smoky anchor
ancient bane
smoky anchor
#

If there is a chance of conflict, that is indeed quite problematic.
You could also just do what datapack makers do when they need to create a custom block.
I believe the current strategy is to use a custom model with the Display Entity.

ancient bane
#

Oh god please Tell me more

smoky anchor
#

Sorry, but I'll have to hand you off to someone else. Got stuff to do.

ancient bane
smoky oak
#

jesus i forgot that spigot isnt a functional project but instead a massive list of patches

#

where do you even find a list of those

ancient bane
blazing ocean
#

or just run BT

smoky oak
#

? i dont mean where do i get spigot

#

i mean how do i navigate it

#

im trying to figure out how the PDC in itemMeta is implemented

blazing ocean
#

BT gives you a usable spigot server with patches applied

#

look at CB then

smoky oak
#

?

blazing ocean
#

what "?"

smoky oak
#

like what use does buildtools craftbukkit have

#

i thought that was just bukkit

#

aka spigot precurosr

blazing ocean
#

CB is the impl of the api

slender elbow
#

buildtools is what applies those patches into readable source code

blazing ocean
#

and then, compiles that

smoky oak
#

uuuuuh

#

which of those does itemstack use

#

probably the first but howd i know

#

hm

#

is CraftMetaItem the craftbukkit version of ItemStack

young knoll
#

No

#

It's the CraftBukkit version of ItemMeta

glad prawn
#

why is its name reversed

smoky oak
#

?remapped

blazing ocean
#

?nms

smoky oak
#

hm no thats not workign

#

and i did maven reload

#

?craftbukkit

#

god damn it

#

aaaand its not on the mappings site either

smoky oak
#

i mean its the class that implements PersistentDataHolder and is used in the CraftMeta thing

#

PDC is an interface, and i need the class implementing it

#

since an interface doesnt really have fields

blazing ocean
#

and CB implements the API

smoky oak
#

fuck me man

how do i do 'if its this version go here if its this version go there' again

chrome beacon
#

It should handle that automatically if you're modules are setup correctly?

#

or if you want one single implementation you need reflection

#

I'm not sure if you're talking about the IDE or the plugin you're writing

smoky oak
#

plugin. there might be a requirement to split serialization and deserialization into different minecraft versions for some of the data im handling

#

i recall some sort of switch in code i looked at years ago but i cant remember how it worked

echo basalt
primal mica
#

hello how can I code with 1.8 what should I put in gradle I need NMS pleas help Bukkit again

rough ibex
#

why are you using 1.8

primal mica
#

a work to do for someone that have a server in 1.8

rough ibex
#

what do you have so far

primal mica
#

I put this
dependencies {
// compileOnly("com.hpfxd.pandaspigot:pandaspigot-api:1.8.8-R0.1-SNAPSHOT")
}

but doesn't have nms code

warm mica
primal mica
#

I will try it

blazing ocean
#

the API doesn't have nms, correct

brittle basin
#

guys how would i fix "Expected whitespace to end one argument, but found trailing data", i wanna use a url as one of the arguments in a command but that error appears when i try

sullen marlin
#

Please provide context

#

What command

brittle basin
#

its a download command, like you put in a url and it will download the file to a folder on the server

#

forked from another repo, im tryna fix this whitespace error so it actually works lol

sullen marlin
#

Please provide code and full error

brittle basin
#

not sure if im able to upload screenshots

#

and the code goes above discords character limit

#

removed the catch

#

but its there

slender elbow
#

รฝou can use imgur

#

and a paste site

#

?paste

undone axleBOT
sullen marlin
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

dawn flower
#

uh quick question is internally the only way in java to read a file content using FileInputStream (internally)

#

for example Scanner uses FileInputStream internally so it doesnt count

desert aspen
#

there is a event for when a player go to sleep?

dawn flower
desert aspen
#

thanks

brittle basin
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

brittle basin
#

!verify grafitely

undone axleBOT
#

A private message has been sent to your SpigotMC.org account for verification!

brittle basin
grim hound
#

I've got a lot of dependencies

eternal night
grim hound
#

is there some quick way to find out where this comes from?

eternal night
dawn flower
eternal night
#

FileChannels do too

wet breach
#

mc uses some natives like for sound for example

#

also some dependencies occasionally uses natives too

grim hound
#

yeah so am tryna see if I'm implementing any dependencies I shouldn't

wet breach
#

that shouldn't be too hard ?

grim hound
#

their contents do not provide much

grim hound
#

a lot

#

like

#

a lot

#

of them

wet breach
grim hound
#

...and I need to restate the same dependencies for each module depending on the abstraction phase

grim hound
wet breach
#

that is what that is probably for

grim hound
#

ah, bytebuddy?

#

or asm?

#

okay

eternal night
#

bytebuddy I presume

wet breach
#

well you have to use Java's api for the hotswapping forget what its called anyways using natives is easier then making something in pure java for it

dawn flower
#

ok another dumb question, is it possible to listen for any file read by the current java process thing (and block it)

eternal night
dry hazel
dawn flower
grim hound
#

I don't think so

#

maybe some unknown event?

dawn flower
wet breach
#

whether the OS allows it or not

dawn flower
#

ok how

eternal night
#

The idea of "I have two parts that are privileged to the same degree, one is gonna prevent the other from doing things" is pretty ass

wet breach
#

lol

dawn flower
eternal night
#

if that is your "security" is it ass

#

so I would just not bother

wet breach
#

anyways, in java you can't directly listen for file reads. From in java you can detect modifications, creations and directory changes uses the Watch Service API. However, you could step out of Java with native and use the OS API instead. As I said it depends because its really up to the OS in allowing it so there isn't like a guarantee for example being able to block it

eternal night
#

(the sane thing being that you just don't run untrusted code on your host (e.g. virtualise))

wet breach
#

I just make use of a service script that essentially jails my Java processes

#

in case something like that happens on accident

eternal night
#

yea, in the end you'll just sandbox it one way or another, limit the jvm to the bare minimum of access and off ya go

dawn flower
#

i basically forked forge and am trying to stop mods loaded by it from certain actions unless the user allows it (i tried asking in forge but they didn't help and icba to ask in stackoverflow)

wet breach
#

due to how mods work you won't be able to do that

#

if this were plugins it would work

dawn flower
#

oof

eternal night
#

flatpack your launcher and be happy

#

idk if windows has something on that level

wet breach
#

mods replace entire classes and methods in classes. In otherwords entire swaths of code gets changed. Plugins don't do this and instead load on top. So a mod could load and then just remove your stuff ๐Ÿ˜›

dawn flower
#

i mean it doesnt have to be extreamly proofed, most malicious mods wont have in mind that there would be restrictions

wet breach
#

that isn't what I meant

#

I just mean it could unintentionally remove your stuff or change something that you relied on

dawn flower
#

ah

#

k thanks

wet breach
#

the only other way I see it working with mods

#

if you had an external process that handled all the loading

dawn flower
#

even better

wet breach
#

but then you will end up creating something like Optics MC Antimalware

dawn flower
#

wtf is that

wet breach
#

where you are not having to scan stuff in like 50 different ways because you can do the same thing in numerous ways XD

grim hound
#

what do you have to do to let your program use the classes normally?

wet breach
#

its an antimalware for spigot ๐Ÿ™‚

#

works pretty decently. Doesn't catch everything but it does catch quite a bit lmao

#

a project that he has been working on for a few years now and quite a bit of us here helping and providing input ๐Ÿ˜›

dawn flower
#

intresting

#

wait

grim hound
#

the classes build

#

but they ain't found

dawn flower
wet breach
#

you would have to if you are intending to block some action

grim hound
#

how do I make sure to let my plugin know that these have been relocated?

dawn flower
#

k

wet breach
#

how else you are supposed to know what a mod does?

#

you either stop it before it happens, or stop it after it happens or as it is happening

dawn flower
#

i thought forge loaded mods in a way where i could see what it does

wet breach
#

ideally you would stop it before it loaded anything lol

#

but I think optic's project there will provide some insight into stopping malicious things

#

albeit this works for plugins and not necessarily mods

dawn flower
#

yeah it's probably going to be way different for mods

#

but i'll still take a look

wet breach
#

there is plans to make this a JVM level dependency but that hasn't quite worked out yet lmao

rough drift
rough drift
wet breach
rough drift
#

because yes you can't do it with java tbf

wet breach
#

right I was just saying the alternative is with natives, just wasn't specific about it was all

rough drift
#

ah my bad ๐Ÿ˜ญ

wet breach
#

All good but you are correct you could do it that way

#

probably would need a driver level thing since permissions would most likely be an issue

rough drift
#

Yeah, you'd make a driver similar to a USB file driver for it

#

file driver? weird name lol, but yeah you get what I mean

robust helm
#

js a virtual filesystem no?

#

fuse

rough drift
wet breach
#

but you could simulate one in memory

#

but js isn't the only one capable of that though

#

but JS would be a poor choice for this in either case

rough drift
#

frost frost

#

"js", slang for "just"

#

"just a virtual filesystem no?"

smoky oak
#

so i need to do craftbukkit stuff but am running into a bit of an issue

public static String serialize(PersistentDataContainer container){
        String version = ???;
        switch(version) {
            case "v1_21_4": break;
            case "v1_20_0": break;
        }
    }
#

how do i get the current server version?

chrome beacon
#

If you're trying to add the version to the package of the class that will break on Paper

#

If not why are you trying to switch on version

smoky oak
#

because craftbukkit imports are per-version

#

so i need to switch based on that

chrome beacon
#

That would break on Paper

#

They do not relocate craftbukkit

smoky oak
#

augh

#

where is craftbukkit then that i can access it on both

chrome beacon
#

What are you trying to access?

smoky oak
#

import org.bukkit.craftbukkit.v1_21_R3.persistence.CraftPersistentDataContainer;

#

i need the implementing class of PDC in item meta

chrome beacon
#

For what purpose

smoky oak
#

reflection

#

because for SOME BLOODY REASON you cant query the PDT behind a given namespace key

#

i want a (de)serializer that doesnt break the data on version change

chrome beacon
#

Just use reflection then

remote swallow
#

Afaik it would go through dfu and shouldnt break

chrome beacon
#

They're moving data out of the pdc to their own system

#

So no DFU on that

smoky oak
#

the problem being that BukkitObjectStreams dont go through DFU and i need to store PDC outside of a minecraft object

smoky oak
# chrome beacon Just use reflection then

yes, but for that i need the implementing class to access the fields
and youve just told me that i can't just use the craftbukkit import i posted bc that doesnt exist on paper :/

chrome beacon
smoky oak
#

oh

#

that might do it

smoky oak
#

i am now realizing how nice the api makes things look

#

or im incapable of reading registry code

remote swallow
#

Hm?

smoky oak
#

CraftPersistentDataTypeRegistry is a beast and a half

remote swallow
#

most of that is just the backing of how pdc works

#

rather than registry stuff

smoky oak
#

doesnt mean i currently have the braincells to understand it kek

smoky oak
#

bleh. is there some way to do unit tests on plugin code

#

having to compile and use a server and the debugger feels iffy

young knoll
#

Mockbukkit

remote swallow
#

do note, mock bukkit cannot test nms

#

as some stuff is only present on a server

smoky oak
#

i mean if i have a object it has to exist

quaint mantle
#

I want to add custom item for custom recipe ingredient

#

how to do it?

#

I tried recipe.setIngredient('J', new RecipeChoice.ExactChoice(JujuShortbow.BOW)); but it was wrong

#

and recipe.setIngredient('J', JujuShortbow.BOW); too, but ItemStack can't be added as Ingredient

quaint mantle
#

???

#

It makes bug

#

??

#

sry

#

I didn't check everything

young knoll
#

?notworking

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.

quaint mantle
drowsy helm
#

and waht exactly is "makes bug". What bug?

#

is it an error in console, does the recipe just not show up?

quaint mantle
#

ye....

drowsy helm
#

we can't play a guessing game

quaint mantle
amber fjord
#

I've been making a ton of ItemStacks for my plugin and all of a sudden I run the server again with a new item that has effectively the same code as the rest, I get this brand new error and the console gives 0 context to any errors in my plugin.
Internal Exception: io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:update_recipes'

#

does anybody have any ideas?

smoky oak
#

run your server from your IDE in debug mode might allow you to get some more insight

#

@amber fjord

#

specifically, it might pause when it crashes like that

amber fjord
#

it gives the same amount of detail in the error logs and the server doesnt crash or pause, just people are unable to join the server

smoky oak
#

ye no clue then

#

maybe you just made too many items too fast for your network connection to handle

amber fjord
#

damn ive looked throught the code like 10 times it feels like but i cant come up with anything

smoky oak
#

but that wouldnt be internal i guess

#

?paste

undone axleBOT
smoky oak
#

maybe someone can spot something if you show the code making your items

amber fjord
#

k will do

#

@smoky oak

smoky oak
#

cant spot anything instantly sadly

amber fjord
#

thats what i was thinking myself but idk sometimes

#

the only other insight I can get is this but its not very helpful
Caused by: io.netty.handler.codec.EncoderException: Empty ItemStack not allowed

amber fjord
#

idk what is wrong but yeah

#

im actually stupid i used Material.POWDER_SNOW instead of Material.POWDER_SNOW_BUCKET

sullen marlin
#

Should be caught - open a bug report please

#

?jira

undone axleBOT
quaint mantle
#

anyone know why my maven just doesnt pick up anything

#

craftbukkit and nms related*

#
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.animal.Sheep;
import net.minecraft.world.level.Level;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_21_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.CreatureSpawnEvent;
#

net.minecraft and org.bukkit.craftbukkit are red

eternal oxide
#

?nms

quaint mantle
eternal oxide
#

?paste your pom

undone axleBOT
quaint mantle
quaint mantle
#

i got this error on compile tho

#

Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating remapped jar: Unsupported class file major version 65

eternal oxide
#

select java 21 to be your JDK/JRE

quaint mantle
#

the language level?

#

and sdk

#

both are 21

#

ill post the pom

eternal oxide
#

you are probably not compiling with java 21

#

?paste your maven build log

undone axleBOT
quaint mantle
eternal oxide
quaint mantle
#

o..

#

i put that to 21 it still did it

#

package -X -U is what im compiling with if that helps

eternal oxide
#

current special source plugin version is 2.0.3

quaint mantle
#
                <groupId>net.md-5</groupId>
                <artifactId>specialsource-maven-plugin</artifactId>
                <version>2.0.3</version>
                <executions>
#

this one right

eternal oxide
#

yes

quaint mantle
#

kk lemme try

#

yippee

amber fjord
cedar turtle
fair rock
#

Isnt the player get damage from explosion ?

#

"ENTITY_EXPLOSION
Damage caused by being in the area when an entity, such as a Creeper, explodes."

#

Check for that and cancel it?

cedar turtle
#

maybe, I could give that a try

#

this seems to work, but it doesn't really work with the specialCreepers HashSet. do you have an idea for this? i don't want everyone to be affected, just some of them

orchid trout
#

if i invoke a method inside a lambda is it any faster than just invoking the method if im making an eventmanager?

#

like if im making a consumer to invoke the method

river oracle
#

Because the JVM would have to first invoke the lambda and then invoke the method

#

You might get lucky and the jvm could maybe JIT it tho

orchid trout
#

how does spigot do it

eternal night
#

(do note that like, "slower" is so increadibly tiny here, it is w/e)

river oracle
#

Generally I wouldn't worry about speed tbh unless you see it's a bottle neck

orchid trout
#

i mean i will have a lot of events and many usages in 1 tick

eternal night
#

lambda is fine

orchid trout
#

so i want it to be as fast as writing code where the event is called

#

and i want it to work like spigot

eternal night
#

then lambda is not fine

orchid trout
#

but lambda is the fastest way no?

eternal night
#

If you can pass a direct lambda as the thing to run, you won't get much faster yea

#

spigot can't do that tho, spigot has to do reflection fun

orchid trout
#

didnt know

#

i thought spigot at least used methodtype

eternal night
#

no, just Method#invoke

#

tho those are also optimized in newer jdk versions so

#

like, they are backed by a method handle access iirc

upper jackal
fluid river
#

why are you sending this to dev chat

orchid trout
upper jackal
#

because it is the premium plugin from IntellectualSites

eternal night
#

the Method object objectained by reflective access has been reworked in recent jdk versions to be backed by a MethodHandle

upper jackal
#

plotsquared v7

eternal night
#

so it is a tad faster than before

upper jackal
#

what and?

fluid river
#

we are not spigot moderators

eternal night
#

Did ya report it? on the page?

orchid trout
#

oh

upper jackal
eternal night
#

just wait then I guess

fluid river
#

you can probably send it to #general and tag mods

#

but not here

eternal night
#

maybe optic is nice enough ๐Ÿ˜…

fluid river
#

jree

#

fava

deep herald
#

anyone know how to make water show up at a block but not have any of the effects from it (like slowing you down while you move)

pseudo hazel
#

display entity maybe

#

but its gonna be tough to pull off with water

deep herald
#

i wanna do it for lava

#

so people in my koth area dont slow down

pseudo hazel
#

oh

#

well there isnt like a switch to just turn off liquid physics

deep herald
#

mmm

slender elbow
#

they are not constants, so they will never be inlined

deep herald
#

can i use this? (from paper)

blazing ocean
#

?whereami

eternal night
dense geyser
#

i havent used spigot in a hot minute, does the PDC on itemstacks save between server restarts? I reem to remember using a system back in 1.8 that was similar that would, and I can't remember if that was PDC or something different entirely

chrome beacon
#

Yes they save

#

hence their name Persistent Data Container

blazing ocean
#

persistent data container

#

ah fuck

dense geyser
#

thanks :p

worthy yarrow
blazing ocean
#

hi kat

worthy yarrow
#

Hi rad

warm mica
zealous osprey
#

I assume koth is King Of The Hill

worthy yarrow
zealous osprey
#

Maybe, I also thaught about: "Lady Of The Hill"

wind sorrel
#

Hi! Has someone ever used PluginLib to download and relocate libraries? I'm having some trouble setting it up. I can't use Spigot's own library loader bc it seems that it doesen't like library relocations

pliant topaz
#

I know this isn't really spigot related, but I recently created a custom effect library, wrote api for it and gone through the whole process of setting the repo up on my github pages (with custom domain lunaa.dev). The dependency doesn't error when adding the repo and adding the dependency for the current version with implementation.
But upon building it it yields this error: https://pastes.dev/s44lTOxFXh saying it couldn't find the jar. But when clicking the link it said it had searched, the api jar is downloaded automatically indicating the build.gradle.kts is setup correctly in this case as well as my github pages structure.

Does anyone know what might be the problem? (Gradle 8.5 Kotlin DSL)

kind hatch
#

gradle moment

pliant topaz
#

sadly yes inflatable

blazing ocean
#

at org.gradle.api.internal.artifacts.ivyservice

#

are you declaring the repo as ivy?

#

what's your buildscript

pliant topaz
#

for the api itself or where i try using it?

blazing ocean
#

both ig

pliant topaz
#

okay, wait

blazing ocean
#

well no only the one you're using it in

pliant topaz
#

ah, okay

blazing ocean
#

how are you hosting your repo

#

because https://lunaa.dev/ is just your homepage or something

pliant topaz
#

it's just on github pages, i can send you the repo link if thatwoudl be helping?

blazing ocean
#

isn't that just the repo?

#

as in, the maven repo

pliant topaz
#

Not only

pliant topaz
#

It's my portfolio i'm planning on working on as well as the repos hosted

blazing ocean
#

you might wanna have the repo be on some subdomain or path

pliant topaz
blazing ocean
#

you are using groovy

pliant topaz
#

ah waiiit

#

sorry, the api's build is kotlin, the one i sent where i use it groovy, that was before i was told i shouldt use groovy

pliant topaz
blazing ocean
#

works on my machineโ„ข

pliant topaz
#

hmmmm

#

thats weird. maybe i'll try it in a new project

blazing ocean
#

seems to work

pliant topaz
#

Nope, doesn't seem to work on my machine ๐Ÿ˜ญ

#

could it maybe be because my pasckage is also de.lunaa?

blazing ocean
#

nope

pliant topaz
#

that it's somehow not liking that?

blazing ocean
pliant topaz
#

I'll ask a freind if he can try it too, but thanks a lot for the help, im glad it works for other at least

pliant topaz
# blazing ocean

hm, seems like it's really a problem on my machine somehow, thats really weird

smoky oak
#

why does fire immediately extinguish when placed with world.setBlock() if it is not touching a burnable block

#

im placing fire then netherrack in the same tick and the fire goes out

wet breach
#

try changing it around?

smoky oak
#

i mean yea but i really dont want to have to filter for fire, then paste everything, then paste the fire after

worthy yarrow
#

Doesnโ€™t the fire have like a long that dictates the time? Or is that just for player fire ticks

smoky oak
#

not on soul fire

#

for...... some reason

worthy yarrow
#

Well like frost said, you probably wanna swap those around

#

You could also add like a tick delay to the fire placement so the netherrack or wtv is there before the fire

silent cove
#

I have a question about handling API changes while maintaining backwards compatibility. I have a plugin that needs mob data, which means I need to compile it against the latest version of the API in order to get all of the entities. Is there any possible way to maintain backwards compatibility when doing that? Alongside that, 1.21 changed ItemFlag.HIDE_POTION_EFFECTS to ItemFlag.HIDE_ADDITIONAL_TOOLTIP. Can this be written in a way that it would work for 1.20 and 1.21, given my previous constraint of needing to compile against 1.21?

worthy yarrow
#

I think common practice is writing a module per version

#

Depending on version changes ofc

echo basalt
#

or praying commodore does it

sullen marlin
silent cove
#

me updating my plugin would be for the reason to add support for the new mobs, meaning i'd need the new api

#

e.g. 1.20 to 1.21 added 3 new mobs.

#

i think it just may be the way it has to be given that i explicitly need these entity types in order to add support for them, right?

sullen marlin
#

Depends what you mean by support

silent cove
#

items with custom meta data depending on what the entity is

#

and custom model data for the item, etc. a similar concept would be spawn eggs

#

you'd need to have the breeze in order to have a breeze egg

fickle spindle
#

how can i remove the players from the tab but not from the pyschs game?

rough nest
#

my server is lagging like crazy can someone take a look at the spark profiler?

eternal oxide
torn quiver
#

I downloaded version 1.21 of spigot, and that window pops up and it doesn't download.

young knoll
#

Downloaded from where

eternal oxide
#

auto censored ๐Ÿ™‚

torn quiver
eternal oxide
#

Its not a legal download. YOu need to build Spigot jar

young knoll
#

?bt

undone axleBOT
eternal oxide
#

?bt

undone axleBOT
young knoll
#

Gross, they offer server hosting too?

torn quiver
young knoll
#

Use what, their server hosting?

#

Idk ask them

remote swallow
#

Can someone find wolverness and get him to dmca them

smoky oak
#

qq, under which circumstances can itemMeta be null?

worldly ice
#

if the item stack is AIR iirc

chrome beacon
#

^^

smoky oak
#

uh

#

artifact io.github.moterius:VoidLib:jar:remapped-obf:1.0-SNAPSHOT already attached, replace previous instance
why do i get that warning when running 'clean' as part of my build?

sullen marlin
#

Not harmful but you likely have two output jars named that

smoky oak
#

i just copy pasted jeffs plugin lol

#

unrelated but is there a way to save a variable while debugging?

worldly ingot
#

Save a variable where?

smoky oak
#

like, in the debugger so that if you run some code it doesnt disappears into the ether

#

im trying to figure out why my reflection stuff isnt working but the fact i can only look at one thing at once is proving annoying

#

ok wtf

#

its saying 'illegal argument exception' but the signature is get(Object key)

#

oh

#

is this dependency 'provided' at runtime

        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>minecraft-server</artifactId>
            <version>1.21.4-R0.1-SNAPSHOT</version>
        </dependency>
worldly ingot
#

Yes

#

Well, "yes" lol

remote swallow
#

id be a bit concerned if it wasnt

worldly ingot
#

That's the vanilla server dependency used by CraftBukkit iirc

remote swallow
#

yeah

smoky oak
#

i see

#

is there a way to make it such that i can compile for more than one specific sub-version at a time?

remote swallow
#

modules

smoky oak
#

is there any good explanation on those?

remote swallow
#

Hi there! Today Iโ€™m going to explain how to setup a multi-module project using maven to support different NMS versions. Important notes about this tutorial: Every step will have detailled screenshots using IntelliJ. I explicitly chose not to include everything as copy/pastable source code, but normal screenshots (you can click on them to show th...

worldly ingot
#

You would have to make a project for each server version you want

smoky oak
#

great

remote swallow
#

do note, choco means module not project

#

you do not need an entire project for 1 version

smoky oak
#

ok much less a headache

worldly ingot
#

A module is a project

#

But yes

remote swallow
#

yeah but saying project gets confusing to people that dont understand it

smoky oak
#

im so irritated i have to do modules to get a plugin that works on more than one version because someone decided it was a good idea to not have a way to serialize PDC urgh

young knoll
#

I mean

#

You can serialize it to yaml

#

And to bytes

smoky oak
#

in a way that does not break when the version changes?

#

bc the Bukkit streams dont run it through the version updater

young knoll
#

Nop

#

But Mojang doesnโ€™t tend to break stuff often

#

Aside from the whole item component thing, kek

smoky oak
#

yeeeea thats kinda the whole reason im doing this. i do not want it to break when something updates

young knoll
#

Well

#

At least itโ€™s not much code to use NMS for this

smoky oak
#

we dont have the net.minecraft code available by chance do we?

young knoll
#

I mean

#

Buildtools decompiles it all for you

#

And patches it

smoky oak
#

is it in one of those folders?

young knoll
#

work

smoky oak
#

ah well that looks fun

#

cant they have idk version numbers lol

young knoll
#

Alternatively just use your IDE to decompile whatever class you want

smoky oak
#

i need the implementing class of an interface

#

no dice

young knoll
#

If you attach sources you should be able to search for those

#

Or just check the mappings site

remote swallow
#

its in the a053 decompile dir

#

that contains cb patched stuff, if you want more raw nms you could use someting like mache

smoky oak
#

where would i get that?

remote swallow
smoky oak
#

also, if you say its cb patched, does that mean that if i use the raw nms it might not work on cb?

remote swallow
#

i mean the raw nms will work, just craftbukkit patches do modify some stuff

smoky oak
#

define 'some' ?

remote swallow
#

mostโ„ข๏ธ just make cb work

smoky oak
#

is this some remapping nonsense then?

--- a/net/minecraft/nbt/NBTTagIntArray.java
+++ b/net/minecraft/nbt/NBTTagIntArray.java
remote swallow
#

thats the diff

#

bc its in the same location both a and b are exactly the same

smoky oak
#

why is that a/b there anyway lol

remote swallow
#

to signify what part of the diff it is, a is the original, b is the new so you can tell whats what

smoky oak
#

oh. oh no

#

the names of the fields in the nms are different from the names when i do getDeclaredFields

remote swallow
#

?mappings

undone axleBOT
worldly ingot
#

To make your life more painful, Paper has runtime mojmaps

#

Spigot does not

remote swallow
#

paper handle that

#

they remap plugins on first load of them

smoky oak
remote swallow
#

it uses mojmaps for the path

#

use the search, it will appear for all mapings and directs you to the correct page

smoky oak
#

ah i see

#

so i have to use the obfuscated names here

#

(also whats going on with those extra three remaps there? yarn, searge, intermediate?)

remote swallow
#

if you use reflection, spigot if it exists otherwise obf

#

yarn is fabrics, searge is forges and intermediate is a cross version thing fabric made

smoky oak
#

given all my other imports are bukkit or java, would using a spigot import mean my plugin wouldnt work on paper

remote swallow
#

paper remap upon startup and convert all spigot mappings to mojang

smoky oak
#

ah thats what you meant

#

ok so using spigot works on paper which those two is liek almost all servers

#

good enough for me

young knoll
#

spigot imports mean your plugin wonโ€™t work on craftbukkit

smoky oak
#

god damn it

young knoll
#

But if anyone is running regular craftbukkit they deserve it

smoky oak
#

whats the dependency for mojang obfuscated?

remote swallow
#

minecraft server

#

to get what the spigot server runs use spigot without the -api

smoky oak
#

different group id i take it?

remote swallow
#

org.spigotmc

#

you shouldnt ever need to use minecraft-server dep tho

smoky oak
#

? i already have that but the import doesnt work

remote swallow
#

use the spigot server dep

smoky oak
remote swallow
#

use artifact of spigot

#

that will provide the mappings and class names spigot uses at runtime, if you want a better experience use mojmaps plus special source to remap. more on

#

?nms

smoky oak
#

see heres the thing, i do have that and removing my minecraft server dep means this doenst exist anymore

remote swallow
#

whats your dep now?

smoky oak
#

spigot + spigot-api + minecraft-server

#

i just wanted to gut what i dont need once im done

remote swallow
#

remove the minecraft server and spigot-api one

smoky oak
#

huh this for some bloody reason changes how the debugger displays the tag object

#

after switching from NBTBase to Tag for spigot maps

#

wait wot

remote swallow
#

did you add a watcher to the NBTBase one

smoky oak
#

uh kinda, its in a variable im looking at in the debugger, but theres something else im confused by now

sullen marlin
#

Tbh debugging gonna be pain

smoky oak
#

so this says its what org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer imports but it looks like <artefactId>spigot for some reason gives me the mojmaps?

#

my dependencys are empty except that

remote swallow
#

does it have a classifier of remapped-mojang by chance

smoky oak
#

thats what it said on jeffs blog

remote swallow
#

that is now providing you with mojang mappings

smoky oak
#

ah

remote swallow
#

make sure you have the special source plugin to remap to what the spigot server expects at runtime

smoky oak
#

wait. is the specialsource for when you use the mojmaps or when you use the spigot maps?

remote swallow
#

mojmaps

#

spigot mappings are what spigot uses while the server is running

smoky oak
#

why would i need it when im using spigot mappings then

remote swallow
#

because you arent using spigot mappings

#

by seeing Tag in your ide and having remapped-mojang classifier you are using moj maps, and need to remap to what spigot mappings

smoky oak
#

oh, i removed the classifier bc you implied that was the issue ๐Ÿคฆ

remote swallow
#

its not an issue

smoky oak
#

is there a reason to use one over the other?

#

mojmaps seem to have the field names i guess?

remote swallow
#

mojang maps are more complete, contain class, field and method mappings and are exactly what mojang use to code the server

#

basically all spigot mappings are now are class names that were decided 10 years ago

smoky oak
#

i can... see how that could cause issues

#

whys it saying namespace:spigot on em all tho

remote swallow
#

where?

smoky oak
#

the search field on the mapping site

remote swallow
#

the class name you typed is the spigot name of that class

#

if you search tag itll say namespace mojang

#

but yeah, i recommend using mojmaps in your code, it makes it much nicer to deal with and using special source to remap at compile time

smoky oak
#

though im still pissed i need to have like three different folders open to do anything :V

remote swallow
#

nms is really fun to deal with

smoky oak
#

yeeeeeeah

#

i do not look forward to dealing with generics

#

im pretty sure you can declare your own types to store in PDC

remote swallow
#

yeah you can

worthy yarrow
#

Generics are fantastic

smoky oak
#

actually wasnt there some 'needs to implement a translation into primitive' attached to that

remote swallow
#

you can see all the other types it has too

smoky oak
#

oh thats smart

#

is it always byte[] for the primitive then?

#

its not great ๐Ÿคก

remote swallow
#

most of the time a byte array is just the easiest option to serialize stuff as

sullen marlin
#

Everything is a byte array if you look hard enough

smoky oak
#

ha true enough

#

so its always primitive[] or string?

remote swallow
#

primitive can be anything

#

as long as it can store it

smoky oak
#

what the

#

Any plugin owned implementation of this interface is required to define one of the existing primitive types found in this interface.

#

says this on the api page

remote swallow
#

those are the types it can store

smoky oak
#

ah so at most i will have to deal with those as primitives

remote swallow
#

most of the time yeah

smoky oak
#

'most'
dont you need a fork of spigot to have more than the here declared primitives as options

remote swallow
#

it might workwith others, no clue untill this random plugin developer does it and it works then someone complains to you that it broke across an mc update

smoky oak
#

for now ill just figure out how to store the class name and cast the object back

#

bleh what a headache

sullen marlin
#

Not sure what a fork is gonna help you achieve lol

smoky oak
#

fork?

#

ah

#

no i meant that it states on the api page that sentence, so i was like 'isnt the only way to have more than the here listed types to fork spigot and patch this file'

worldly ingot
#

Oh, no. You can define your own persistent types

smoky oak
#

oooooh

worldly ingot
#

They just have to serialize down to one of the primitive ones. Spigot provides all the supported primitives

smoky oak
#

yea that

#

so i was planning on grabbing the primitives and storing thosea

worldly ingot
#
public record MyObject(int value, String string) { }

public final class PersistentDataTypeMyObject implements PersistentDataType<PersistentDataContainer, MyObject> {

    public static final PersistentDataType<PersistentDataContainer, MyObject> INSTANCE = new PersistentDataTypeMyObject();

    private static final NamespacedKey KEY_VALUE = NamespacedKey.fromString("my_plugin:value");
    private static final NamespacedKey KEY_STRING = NamespacedKey.fromString("my_plugin:string");

    private PersistentDataTypeMyObject() { }

    @Override
    public Class<PersistentDataContainer> getPrimitiveType() {
        return PersistentDataContainer.class;
    }

    @Override
    public Class<MyObject> getComplexType() {
        return MyObject.class;
    }

    @Override
    public PersistentDataContainer toPrimitive(MyObject object, PersistentDataAdapterContext context) {
        PersistentDataContainer container = context.newPersistentDataContainer();
        container.set(KEY_VALUE, PersistentDataType.INTEGER, object.value());
        container.set(KEY_STRING, PersistentDataType.STRING, object.string());
        return container;
    }

    @Override
    public MyObject fromPrimitive(PersistentDataContainer container, PersistentDataAdapterContext context) {
        return new MyObject(
            container.get(KEY_VALUE, PersistentDataType.INTEGER),
            container.get(KEY_STRING, PersistentDataType.STRING)
        );
    }
}

// Example
MyObject object = new MyObject(420, "blaze it");
PersistentDataContainer container = meta.getPersistentDataContainer();
container.set(new NamespacedKey(plugin, "my_value"), PersistentDataTypeMyObject.INSTANCE, object);```
#

There's a working example for a custom type

#

You could move the INSTANCE into just a utility class that's like MyPersistentDataTypes or whatever, but I kept it there for the sake of the example lol

smoky oak
#

i mean i understand custom PDC types
the problem i have is to create a serialization / deserialization that works for unknown custom types

worldly ingot
#

That's correct, yes. Though there's nothing stopping you from making a relatively general form of this. This just happens to be a static type. But you could go way more complex with that

#

At the end of the day though, your serialization/deserialization has to know how to serialize/deserialize, and that has to be written somewhere

smoky oak
#

ah i was thinking along the lines of instantiating an object whose class i got via reflection and storing the class name at serialization

worldly ingot
#

The MyObject above is just simple fields, but you could have some more abstract and flexible parsing

#

I would maybe avoid serializing a class name onto something. If you want to refactor that code later, you're going to end up in a world of hurt lol'

smoky oak
#

? how so

#

ah

#

ok fair enough, but i really dont know how to do it other than that or passing a reference to the classes that are about to be used

#

and i really would like to keep it to 'serializePDC(PDC) / deseriallizePDC(String)'

worldly ingot
#

You would have to map them to some id, like what Minecraft does. They're not referencing ItemFood everywhere, they reference "minecraft:apple", or "minecraft:bread"

smoky oak
#

wouldnt that necessitate to know the possible types?

worldly ingot
#

You have to know the possible types to deserialize anything, unless you're doing some insane generalization

#

Even Bukkit's YAML serialization has a ==: <full class name> at the top

#

It needs to know what class to use to deserialize

smoky oak
#

yea i wanted to pass that along bc i cannot know for certain that other plugins havent touched any given PDC with custom types

#

thats like the main problem right now tbh

potent atlas
#

Hey guys I made a custom enchant with PDC but I can't find how you get it in game. Enchants used to have a register() method but that's gone. Any help? I want to be able to get it from villagers but I'm starting with just a custom command just so I can test it, but it does not trigger the listener

smoky oak
#

custom events need to be triggered manually

potent atlas
#

it's not a custom event

#

I use EntityDamageByEntityEvent and check the player's main hand for the enchant

smoky oak
#

hm thats odd. did you register the event listener

potent atlas
#

yes I did

smoky oak
#

odd

#

yea no idea why it wouldnt trip the listener. how do you verify if it did trigger?

potent atlas
#

logger

#

as in instance of my plugin getLogger().info("Enchantment trigger");

#

I also want villagers to have the enchant on a book

floral drum
#

Uhm can somebody tell me how can I get 1.8.8 src

smoky oak
#

if you run bt for 1.8.8 it should give you the code after spigot applied its patches

#

not sure if you need to toggle a flag for it tho

blazing ocean
#

why would that be a flag

smoky oak
#

the generate-source toggle?

blazing ocean
#

bt applies patches, does the whole remapping bs and then compiles

quaint mantle
#

Is There Anyone Indian I'd Yes Then Dm Me Because I Want To Make My Public Smp So DM me fasttt

potent atlas
#

Really? :/

quaint mantle
#

Dm

eternal oxide
#

?services

undone axleBOT
ivory gale
#

Hello! Simple question, because I can't find the answer. Does the ChunkUnloadEvent delete all the entities in the chunk in question, so that they are no longer present in RAM and used by the server at all? I have a Set where I store active entities, and to avoid memory leaks I would like to delete them only if this is the case. Thank you very much!

fair rock
#

ChunkUnloadEvent gives you the chunk

#

And there is a getEntities method

smoky anchor
#

(that's bukkit wait wat)

ivory gale
#

I'm already using the getEntities method. I'd just like to understand what happens to the entities that were present in the chunk that's unloaded, so that I can delete them if they are, or not. I didn't know about the EntitiesUnloadEvent, I'm going to use it too, thank you. Basically, I store mobs that come from spawners, and if they die, I delete them. But if they disappear in any other way, they stay in the Set... So inevitably, after a while, the Set becomes so big that it creates performance problems. So I try to look at all possible scenarios

#

Or to avoid forgetting cases, maybe I can iterate over my entities regularly with a task, and I check whether they still exist with isValid and isDead...

smoky anchor
#

One ugly hack might be to just randomly check few entities in some interval and remove them from the set if they are not present in a world.
But the correct solution is obviously to catch all instances when an entity can be removed from the world.
I can imagine doing something that is not caught by your plugin in spawn chunks just making the server run out of memory

#

Also, if you're doing this, you might want to store an UUID instead of Entity in the set (or WeakReference ?)

ivory gale
#

You're right, I'll do that, thank you. Maybe I can also use a Set derived from a WeakHashMap

#

Is it worth, instead of storing spawners' mobs in a Set, to simply add a Metadata to them? And in that case, I'd just check for its presence when the mob dies and that would simplify the task enormously, as well as eliminating any risk of leaks...

eternal oxide
#

much better

#

fo rmodern use pdc

#

?pdc

ivory gale
#

Yes, I'm going to do that, it'll be so much easier. Thank you so much!

limber mantle
#

i'm trying to spawn entity_effect / spell_mob particles on 1.21.4 with specific colors and they're coming out completely random colors.

clone.getWorld().spawnParticle(Particle.ENTITY_EFFECT, clone, 1, Color.fromRGB(r, g, b));

r: 218 g: 234 b: 255

pseudo hazel
#

what color are you trying to use

#

also thats kinda funny

pseudo hazel
#

nvm you said

#

idk how the color works with particles in the api

#

what if you try using a constant like Color.AQUA

limber mantle
#

oh yea i'll try that next

#

thanks

worn fern
#

Make sure you read about what offsetX, offsetY, offsetZ are here

upper hazel
#

all plugins has only 1 class loader?

#

i mean 1 common class loader

young knoll
#

Each one has its own class loader iirc

hard socket
#
        Location beamLocation = new Location(player.getWorld(), playerLocation.getX() + 5, playerLocation.getY(), playerLocation.getZ() + 5);

        ArmorStand armorStand = (ArmorStand) player.getWorld().spawnEntity(beamLocation, EntityType.ARMOR_STAND);
        armorStand.setVisible(true);
        armorStand.setInvulnerable(true);

        Warden warden = (Warden) player.getWorld().spawnEntity(playerLocation, EntityType.WARDEN);
        warden.setCustomName("Warden Beam");
        warden.setCustomNameVisible(true);
        warden.setPersistent(false); // Ensure the Warden is temporary

        warden.teleport(playerLocation.setDirection(beamLocation.toVector().subtract(playerLocation.toVector())));

        warden.setTarget(armorStand);
        warden.playEffect(EntityEffect.WARDEN_SONIC_ATTACK);```

I want to make the warden attack the armorstand with the sonic attack but the effects of the attack doesn't even appear
smoky oak
#

if i want to get a class via it's name in reflection, which of those names is the correct to use?

glad prawn
#

Why?

smoky oak
#

coz im storing data, and such won't have access to class at the time of reverting

glad prawn
#

tag.getClass() will return its implementation class, I don't know what you are trying to do

smoky oak
#

to send a STRING representing the class

#

i know i can use getClass to get the class but Class<?> aint exactly a SQL type

glad prawn
#

You always ask questions that have no head, only tail.

wet breach
# smoky oak if i want to get a class via it's name in reflection, which of those names is th...


        the name is the name that you'd use to dynamically load the class with, for example, a call to Class.forName with the default ClassLoader. Within the scope of a certain ClassLoader, all classes have unique names.
        the canonical name is the name that would be used in an import statement. It might be useful during toString or logging operations. When the javac compiler has complete view of a classpath, it enforces uniqueness of canonical names within it by clashing fully qualified class and package names at compile time. However JVMs must accept such name clashes, and thus canonical names do not uniquely identify classes within a ClassLoader. (In hindsight, a better name for this getter would have been getJavaName; but this method dates from a time when the JVM was used solely to run Java programs.)
        the simple name loosely identifies the class, again might be useful during toString or logging operations but is not guaranteed to be unique.
        the type name returns "an informative string for the name of this type", "It's like toString: it's purely informative and has no contract value". (as written by sir4ur0n)

smoky oak
#

that text aint on that page

wet breach
#

because its a summary of the things you asked about

smoky oak
#

ah

wet breach
#

the link I provided is the specification on it

eternal oxide
#

canonical should include the package so...

wet breach
#

here is an example

#
int.class (primitive):
    getName():          int
    getCanonicalName(): int
    getSimpleName():    int
    getTypeName():      int

String.class (ordinary class):
    getName():          java.lang.String
    getCanonicalName(): java.lang.String
    getSimpleName():    String
    getTypeName():      java.lang.String

java.util.HashMap.SimpleEntry.class (nested class):
    getName():          java.util.AbstractMap$SimpleEntry
    getCanonicalName(): java.util.AbstractMap.SimpleEntry
    getSimpleName():    SimpleEntry
    getTypeName():      java.util.AbstractMap$SimpleEntry

new java.io.Serializable(){}.getClass() (anonymous inner class):
    getName():          ClassNameTest$1
    getCanonicalName(): null
    getSimpleName():    
    getTypeName():      ClassNameTest$1
smoky oak
#

ah. and since im messing with mojmap classes at runtime the canonical name should work

wet breach
#

ideally. I can't think of a scenario off hand where it wouldn't for what you are needing it for lol

smoky oak
#

well shit

#

its printing NPE

#

wait hold up

#

ah yes namespaced key is just a string wrapper because why not lol

#

when doing reflection on mojmaps like this, do i use the mojmap name or the obfuscated name?

#

dammit

#

its obfuscated

#

is there a way to query the obfuscated name? i really dont want to have to make modules for every minor version lol

chrome beacon
#

Try locating the field you want by type instead

#

That way it's not name dependent

wet breach
wet breach
#

?mappings

undone axleBOT
smoky oak
#

how do i check the version I'm on tho

wet breach
#

getServer().getVersion() or something like that

#

could also query metadata for implementation as well

#

since spigot/bukkit puts that in at compile time

smoky oak
#

what the

#

why does it throw part obfuscated and part spigot maps at me

#

it says this is a NBTTagString

#

but the data field has to be grabbed via ("A")

wet breach
#

uh, thought it was NBTBase or whatever

smoky oak
#

thats the spigot map of the interface

wet breach
#

ah right

river oracle
#

?jds

#

?jd-s

undone axleBOT
smoky oak
#

is this the same for spigot and paper assuming same minor version?

#

hm probably

wet breach
#

I am not sure if paper has a reason to change how they do versioning

#

however, since they are divergent now, I suppose they could end up changing it at some point

smoky oak
#

well it just prints major.minor-rev-snapshot

#

eh

#

switch is a thing

#

this one at least would be a very quick change

#

hm. yes very informative

wet breach
#

lol

smoky oak
#

can you not chain switch statements?

#

ah remove the parenthesis

#

god this looks cursed

umbral pumice
#

what was the durability enchantment changed to? (for unbreaking)

slender elbow
#

unbreaking

umbral pumice
#

should have guessed lol

loud pivot
#

Hi, i need some help to listener a custom event. I cant listener the event from other plugin, that load after, in the main plugin the listener for his event works, are something special to check before?

tepid flicker
#

is there a way to make a recipe with an item that stays in the grid after craft? is so then how? can't find any tutorials no it anywhere

pseudo hazel
#

you mean like a bucket?

#

I think the cake recipe does that

robust helm
#
PreparedStatement statement = dbConnection.prepareStatement(
                    "INSERT INTO sync_data (id, location, velocity)" +
                    "VALUES (?, ROW(?, ?, ?, ?, ?), ROW(?, ?, ?))" +
                    "ON CONFLICT (id) DO UPDATE SET" +
                    "location = ROW(?, ?, ?, ?, ?)," +
                    "velocity = ROW(?, ?, ?)"
            );
            int ind = 1;
            statement.setObject(ind++, uuid);
            for (int i = 0; i < 2; i++) {
                statement.setDouble(ind++, location.getX());
                statement.setDouble(ind++, location.getY());
                statement.setDouble(ind++, location.getZ());
                statement.setDouble(ind++, location.getYaw());
                statement.setDouble(ind++, location.getPitch());

                statement.setDouble(ind++, velocity.getX());
                statement.setDouble(ind++, velocity.getY());
                statement.setDouble(ind++, velocity.getZ());
            }
            statement.execute();

doing some sql stuff for persistently saving player location even after lobby restart.
I do have some doubts whether this is what good code looks like, should I just serialize and save as string or is it good this way?

worthy yarrow
#

Is there any reason you need to do this? The world already stores this information for every entity iirc

robust helm