#help-development
1 messages ยท Page 1212 of 1
almost sounds like you wanna make your own extra component system
almost sounds like that's exactly what I'm thinking about
but it's gonna be such a pain in the ass
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
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
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
Would it be possible/smart to use DFUs Codecs to do serialization, and just create your own 'Dynamic Ops' implementation ?
well i thought that i could maybe use base64 and some modification of https://gist.github.com/graywolf336/8153678, but im pretty sure that it breaks on version change
eh
Understandable, have a nice day XD
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
how could you read a field before the object its associated with exists?
Time travel
I can write the item, restart, read
ez
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 ?
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

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
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
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
I believe yes, I did do that back in the day
if I block in there, it'll stop players from joining right
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
unless this somehow improves access speed i guess
then im all for it :V
Nah, you should be indexing your key
You said you were using PDC to link to it, so ideally it has an index
well my idea to prevent key dupes was to use system.nanos as UUID seed
and store that uuid in the item PDC
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
Hmmm so apparently I can paste a FAWE schematic in the ServerLoadEvent but not when scheduling a tick later
it just hangs
ALTER TABLE my_table ADD INDEX 'id_index' ('id'); (or whatever your table & column names are)
You can also do it on table creation
wasnt it CREATE UNIQUE INDEX ON table (identifier)
Depends on which flavour of SQL you're using I'd imagine
No MariaDB? SQLite?
ah ye lite
Yeah SQLite has a different flavour
I believe the one you sent is correct? It feels very SQLite-ish lol
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
my code is literally 'create(file); connection = getConnection("jdbc:sqlite"+file.abspath);' kek
That'll do it
btw this changes access from O(n) to O(log_2 n) i assume?
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
ye this table will be 99% inactive and 1% 'where' like 200 times
the index happens automatically when something is added i take it?
Yeah the index just exists on the table so you don't have to do anything extra beyond creating it
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?
Sounds like #help-server
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?
Depends what you wanna do champ
There are plenty of ways to design something the question is what design works best for you and your use case
often de/serialization is a static method in the object itself
problem bein i cant patch spigot
not enough info
the object im serializing doesnt implement a serialization interface, so i use bukkitinput / output stream
you got a better idea?
what object can;t you serialize?
? i can serialize it just not by myself bc not all the data i would need is exposed
NMS or beg md5 to actually visit my idea of exposing a real byte serialization api
Atleast for items and entities
For other sources you have the power to make such things yourself
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
It's inefficient data storage wise breaks over version upgrades for anything you serialize
Wrong it does not
The bukkit streams serialize the yaml map to bytes
And the yaml maps are version dependent
@echo basalt said BukkitObjectInputStream uses DFU
He lied
You can't dfu yaml sadly fortunately
dfu my beloved
Sorry Imillusion your internet life is over, you got one answer wrong
Surely you could write Dynamic Ops for that
Yeah I'd quit after being wrong once
Not really

You'd have to go transform the arbitrary yaml into NBT than back into yaml
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
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
its possible, but as y2k said u likely need to impose an additional structure more than just the yaml specs themselves
I see, makes sense I guess
Since when blocks have custom model data?
the real problem im running into is that even if i wanted to serialize things manually i couldnt
Since never
blocks don't have model data nor custom models
or well not without heavy use of reflection
You're being too vague I offered you a solution of using nms and the dfu for items and entities
But thats all I can do with how vague you've been
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
You can serialize pdc as well because that's nbt but as you said you'd need reflection
I would recommend not using custom model data for this type of thing anymore
Set an item_model component and point it to a custom model in your RP
Minecraft Commands server can help best with the RP, but first give wiki a try. And don't forget to take inspiration from the vanilla RP
depend + remap plugin?
?nms
Just letting you know another fork has API for this
Wait, you are talking about an item, right.
I just realized what Silvers message meant
the reason im here specifically is because 99% of plugins that run on spigot run on other servers too
Did you not hear about hardfork?
apparantly not
Or just playing off of chance
?
Cuz if you stay away from new api you'll probably be fine for a while
is hardfork 'experimental' spigot or smth
I'd suggest looking into that and taking a look from there
It's Paper who hardfork
i have no idea what youre talking about
and as for paper, no
Experimental spigot is the best unintended joke ive read this month
Maybe i understand Something wrong.
Atm i use Minecraft:sponge as luckyBlock but for this Special Block i want own Texture that
So Sponge will be stay normal
But i can use Sponge Block to to Insert my luckyBlock into Minecraft
If you not care if your stuff runs on paper servers just use spigot and nms then
Go i the wrong way i cant find Tutorial or Something else
It's best we can offer as api here
You can not give a special texture to a block as you can with an item.
mushroom blocks has impossible to generate variants; that plus resource pack might do it
But will this Not remove the mushroom
Cause Player need for soup
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
People normally use noteblocks these days
^ noteblocks are nice
I will Research this way with my AI skills and Docs thx Bro ๐๐
Maybe Last Question give it Something where i can See how i can create the Texture for this (my luckyBlock then )then Like Docs or Video latest spigot
I found Vanilla 1.21.4 template 4 Default Texture Pack but nothing how to Add Change or do some other stuff in this Theme
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.
wheres the website with the mappings again @river oracle
1 sec
?mappings
Compare different mappings with this website: https://mappings.dev/
ok so either im a dumbass or PDC isnt in there
PDC is a spigot thing ?
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
Yes lynx pr it up here
That is much better, thank you.
In terms of new blocks: you can't. As said before, you can however override some "impossible" states. For example: a double slab that is waterlogged.
And as for overriding those, just take inspiration from the vanilla RP.
Can you give Me maybe a Link or hint where i can find more Info, that i dont Spam Here ๐
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.
Never Heard from this where i can find them
Asked if i got a solution i will Post Here to for everyone
Again, you can not create a new block.
You can only override existing blocks.
They can only help with a resourcepack, nothing else.
Sry i should better translate your messages x.x now i understand.
But how i choose the Item which i Override. Because every Server which Runs on spigot use other Blocks
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.
You Genius man! Thats what im looking for
Oh god please Tell me more
Sorry, but I'll have to hand you off to someone else. Got stuff to do.
Thanks you lead the way how i can solve my Problem if it works i will Post readme
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
Sry im really new to spigot code
or just run BT
? 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
?
what "?"
like what use does buildtools craftbukkit have
i thought that was just bukkit
aka spigot precurosr
CB is the impl of the api
buildtools is what applies those patches into readable source code
and then, compiles that
uuuuuh
which of those does itemstack use
probably the first but howd i know
hm
is CraftMetaItem the craftbukkit version of ItemStack
why is its name reversed
?remapped
?nms
hm no thats not workign
and i did maven reload
?craftbukkit
god damn it
aaaand its not on the mappings site either
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
and CB implements the API
oh no
fuck me man
how do i do 'if its this version go here if its this version go there' again
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
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
just make your own wrapper on top ezpz
hello how can I code with 1.8 what should I put in gradle I need NMS pleas help Bukkit again
why are you using 1.8
a work to do for someone that have a server in 1.8
what do you have so far
I put this
dependencies {
// compileOnly("com.hpfxd.pandaspigot:pandaspigot-api:1.8.8-R0.1-SNAPSHOT")
}
but doesn't have nms code
Add the server jar file as a dependency
I will try it
the API doesn't have nms, correct
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
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
Please provide code and full error
not sure if im able to upload screenshots
and the code goes above discords character limit
removed the catch
but its there
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
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
there is a event for when a player go to sleep?
declaration: package: org.bukkit.event.player, class: PlayerBedEnterEvent
thanks
!verify
Usage: !verify <forums username>
!verify grafitely
A private message has been sent to your SpigotMC.org account for verification!
I've got a lot of dependencies
no
is there some quick way to find out where this comes from?
check the files in there I guess 
what else reads
FileChannels do too
usually native libs
mc uses some natives like for sound for example
also some dependencies occasionally uses natives too
yeah so am tryna see if I'm implementing any dependencies I shouldn't
that shouldn't be too hard ?
their contents do not provide much
do you do hotswapping?
...and I need to restate the same dependencies for each module depending on the abstraction phase
yes
that is what that is probably for
bytebuddy I presume
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
ok another dumb question, is it possible to listen for any file read by the current java process thing (and block it)

that's bytebuddy agent
what
not really
I don't think so
maybe some unknown event?
yes and no, it just depends
depends on what
whether the OS allows it or not
ok how
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
lol
i just got a stupid idea that might work on some level
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
(the sane thing being that you just don't run untrusted code on your host (e.g. virtualise))
I just make use of a service script that essentially jails my Java processes
in case something like that happens on accident
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
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)
oof
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 ๐
i mean it doesnt have to be extreamly proofed, most malicious mods wont have in mind that there would be restrictions
that isn't what I meant
I just mean it could unintentionally remove your stuff or change something that you relied on
the only other way I see it working with mods
if you had an external process that handled all the loading
even better
but then you will end up creating something like Optics MC Antimalware
wtf is that
where you are not having to scan stuff in like 50 different ways because you can do the same thing in numerous ways XD
what do you have to do to let your program use the classes normally?
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 ๐
cuz uh
the classes build
but they ain't found
does this mean i have to scan stuff alot of times in multiple ways or i dont have to
you would have to if you are intending to block some action
how do I make sure to let my plugin know that these have been relocated?
k
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
i thought forge loaded mods in a way where i could see what it does
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
there is plans to make this a JVM level dependency but that hasn't quite worked out yet lmao
or if you're on say unix you can technically just make your own sub-fs and link every file to a (modfile? I forgot the name of I/O files handled by drivers lmao), you can probably figure out what file is being requested and allow/block the read from the actual file there. Just a thought though :P
the halting problem but for mods
would still require stepping out of Java for that
I was assuming we're talking about stepping out of java
because yes you can't do it with java tbf
right I was just saying the alternative is with natives, just wasn't specific about it was all
ah my bad ๐ญ
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
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
I did it way too complicated lol
on its own no
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
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?
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
What are you trying to access?
import org.bukkit.craftbukkit.v1_21_R3.persistence.CraftPersistentDataContainer;
i need the implementing class of PDC in item meta
For what purpose
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
Just use reflection then
Afaik it would go through dfu and shouldnt break
the problem being that BukkitObjectStreams dont go through DFU and i need to store PDC outside of a minecraft object
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 :/
container.getClass will get you the class
i am now realizing how nice the api makes things look
or im incapable of reading registry code
Hm?
CraftPersistentDataTypeRegistry is a beast and a half
doesnt mean i currently have the braincells to understand it kek
bleh. is there some way to do unit tests on plugin code
having to compile and use a server and the debugger feels iffy
Mockbukkit
i mean if i have a object it has to exist
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
This is correct
?notworking
"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.
There were 2 more same recipe.setIngredient('word', (RecipeChoice) ItemStack);, sry.
ItemStack can't be cast to RecipeChoice
and waht exactly is "makes bug". What bug?
is it an error in console, does the recipe just not show up?
ye....
you're right
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?
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
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
ye no clue then
maybe you just made too many items too fast for your network connection to handle
damn ive looked throught the code like 10 times it feels like but i cant come up with anything
maybe someone can spot something if you show the code making your items
cant spot anything instantly sadly
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
@smoky oak https://paste.md-5.net/imuhijalok.cs ive narrowed it down to this file if you wanna look through it
idk what is wrong but yeah
im actually stupid i used Material.POWDER_SNOW instead of Material.POWDER_SNOW_BUCKET
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
?nms
yeah i compiled with mappings and craftbukkit
?paste your pom
sec
ok didnt work 6 months ago but worked now
i got this error on compile tho
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating remapped jar: Unsupported class file major version 65
select java 21 to be your JDK/JRE
o..
i put that to 21 it still did it
package -X -U is what im compiling with if that helps
current special source plugin version is 2.0.3
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
this one right
yes
sent one in
What is the best way to prevent creeper from harming players? I've tried this so far without success. https://pastebin.com/zNTFg7K2
Isnt the player get damage from explosion ?
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent, enum: DamageCause
"ENTITY_EXPLOSION
Damage caused by being in the area when an entity, such as a Creeper, explodes."
Check for that and cancel it?
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
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
Invoking a method in a lambda would be slower
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
how does spigot do it
(do note that like, "slower" is so increadibly tiny here, it is w/e)
Generally I wouldn't worry about speed tbh unless you see it's a bottle neck
i mean i will have a lot of events and many usages in 1 tick
lambda is fine
so i want it to be as fast as writing code where the event is called
and i want it to work like spigot
then lambda is not fine
but lambda is the fastest way no?
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
no, just Method#invoke
tho those are also optimized in newer jdk versions so
like, they are backed by a method handle access iirc
https://www.spigotmc.org/resources/plotsquared-1-21-free.122097/
PLEASE DELETE THIS
why are you sending this to dev chat
what does that mean
because it is the premium plugin from IntellectualSites
the Method object objectained by reflective access has been reworked in recent jdk versions to be backed by a MethodHandle
plotsquared v7
so it is a tad faster than before
and?
what and?
we are not spigot moderators
Did ya report it? on the page?
oh
ja
just wait then I guess
maybe optic is nice enough ๐
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)
im doing water as an example
i wanna do it for lava
so people in my koth area dont slow down
mmm
but not in the way spigot uses it tho
they are not constants, so they will never be inlined
can i use this? (from paper)
?whereami
fair enough 
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
thanks :p
You werenโt technically doing anything different, pdc is just modern nbt wrapper
hi kat
Hi rad
The non-persistent alternative is the metadata api which you should generally avoid
what does loth stand for?
I assume koth is King Of The Hill
Maybe last on the hill or something
Maybe, I also thaught about: "Lady Of The Hill"
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
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)
gradle moment
sadly yes 
at org.gradle.api.internal.artifacts.ivyservice
are you declaring the repo as ivy?
what's your buildscript
for the api itself or where i try using it?
both ig
okay, wait
well no only the one you're using it in
ah, okay
There you go: https://pastes.dev/ZLmuTwItnF
how are you hosting your repo
because https://lunaa.dev/ is just your homepage or something
it's just on github pages, i can send you the repo link if thatwoudl be helping?
Not only
-# also not kotlin btw
It's my portfolio i'm planning on working on as well as the repos hosted
you might wanna have the repo be on some subdomain or path
ah, okay, i just said kotlin dsl because everyone always says kotlin dsl when not using groovy for the build.gradle
you are using groovy
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
i will try, yea. So instead of just it being on lunaa.dev i guess i'll put it to lunaa.dev/repository or something?
works on my machineโข
seems to work
Nope, doesn't seem to work on my machine ๐ญ
could it maybe be because my pasckage is also de.lunaa?
nope
that it's somehow not liking that?
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
hm, seems like it's really a problem on my machine somehow, thats really weird
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
try changing it around?
i mean yea but i really dont want to have to filter for fire, then paste everything, then paste the fire after
Doesnโt the fire have like a long that dictates the time? Or is that just for player fire ticks
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
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?
I think common practice is writing a module per version
Depending on version changes ofc
or praying commodore does it
If you're using the API just compile against the oldest version you want to support and it will probably work
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?
Depends what you mean by support
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
how can i remove the players from the tab but not from the pyschs game?
my server is lagging like crazy can someone take a look at the spark profiler?
Thats a #help-server question
I downloaded version 1.21 of spigot, and that window pops up and it doesn't download.
Downloaded from where
auto censored ๐
Its not a legal download. YOu need to build Spigot jar
?bt
?bt
Gross, they offer server hosting too?
How do use that?
Can someone find wolverness and get him to dmca them
qq, under which circumstances can itemMeta be null?
if the item stack is AIR iirc
^^
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?
Not harmful but you likely have two output jars named that
i just copy pasted jeffs plugin lol
unrelated but is there a way to save a variable while debugging?
Save a variable where?
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>
id be a bit concerned if it wasnt
That's the vanilla server dependency used by CraftBukkit iirc
yeah
i see
is there a way to make it such that i can compile for more than one specific sub-version at a time?
modules
is there any good explanation on those?
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...
You would have to make a project for each server version you want
great
do note, choco means module not project
you do not need an entire project for 1 version
ok much less a headache
yeah but saying project gets confusing to people that dont understand it
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
in a way that does not break when the version changes?
bc the Bukkit streams dont run it through the version updater
Nop
But Mojang doesnโt tend to break stuff often
Aside from the whole item component thing, kek
yeeeea thats kinda the whole reason im doing this. i do not want it to break when something updates
we dont have the net.minecraft code available by chance do we?
is it in one of those folders?
work
Alternatively just use your IDE to decompile whatever class you want
If you attach sources you should be able to search for those
Or just check the mappings site
its in the a053 decompile dir
that contains cb patched stuff, if you want more raw nms you could use someting like mache
where would i get that?
ignore the owner org https://github.com/PaperMC/mache
also, if you say its cb patched, does that mean that if i use the raw nms it might not work on cb?
i mean the raw nms will work, just craftbukkit patches do modify some stuff
define 'some' ?
every class that has a patch in this directory https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/nms-patches/net/minecraft
mostโข๏ธ just make cb work
is this some remapping nonsense then?
--- a/net/minecraft/nbt/NBTTagIntArray.java
+++ b/net/minecraft/nbt/NBTTagIntArray.java
why is that a/b there anyway lol
to signify what part of the diff it is, a is the original, b is the new so you can tell whats what
oh. oh no
the names of the fields in the nms are different from the names when i do getDeclaredFields
?mappings
Compare different mappings with this website: https://mappings.dev/
it uses mojmaps for the path
use the search, it will appear for all mapings and directs you to the correct page
version: 1.21.4, hash: a7c78493b5
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?)
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
given all my other imports are bukkit or java, would using a spigot import mean my plugin wouldnt work on paper
paper remap upon startup and convert all spigot mappings to mojang
ah thats what you meant
ok so using spigot works on paper which those two is liek almost all servers
good enough for me
spigot imports mean your plugin wonโt work on craftbukkit
god damn it
But if anyone is running regular craftbukkit they deserve it
whats the dependency for mojang obfuscated?
different group id i take it?
? i already have that but the import doesnt work
use the spigot server dep
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
see heres the thing, i do have that and removing my minecraft server dep means this doenst exist anymore
whats your dep now?
spigot + spigot-api + minecraft-server
i just wanted to gut what i dont need once im done
remove the minecraft server and spigot-api one
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
did you add a watcher to the NBTBase one
uh kinda, its in a variable im looking at in the debugger, but theres something else im confused by now
Tbh debugging gonna be pain
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
does it have a classifier of remapped-mojang by chance
thats what it said on jeffs blog
that is now providing you with mojang mappings
ah
make sure you have the special source plugin to remap to what the spigot server expects at runtime
wait. is the specialsource for when you use the mojmaps or when you use the spigot maps?
why would i need it when im using spigot mappings then
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
oh, i removed the classifier bc you implied that was the issue ๐คฆ
its not an issue
is there a reason to use one over the other?
mojmaps seem to have the field names i guess?
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
i can... see how that could cause issues
whys it saying namespace:spigot on em all tho
where?
the search field on the mapping site
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
yea this bit of info was when it clikced for me tbh
though im still pissed i need to have like three different folders open to do anything :V
nms is really fun to deal with
yeeeeeeah
i do not look forward to dealing with generics
im pretty sure you can declare your own types to store in PDC
yeah you can
Generics are fantastic
actually wasnt there some 'needs to implement a translation into primitive' attached to that
this is an example from alexs morepdc lib https://github.com/mfnalex/MorePersistentDataTypes/blob/master/src/main/java/com/jeff_media/morepersistentdatatypes/datatypes/DoubleArrayDataType.java
you can see all the other types it has too
most of the time a byte array is just the easiest option to serialize stuff as
Everything is a byte array if you look hard enough
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
those are the types it can store
ah so at most i will have to deal with those as primitives
most of the time yeah
'most'
dont you need a fork of spigot to have more than the here declared primitives as options
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
for now ill just figure out how to store the class name and cast the object back
bleh what a headache
Not sure what a fork is gonna help you achieve lol
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'
Oh, no. You can define your own persistent types
oooooh
They just have to serialize down to one of the primitive ones. Spigot provides all the supported primitives
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
i mean i understand custom PDC types
the problem i have is to create a serialization / deserialization that works for unknown custom types
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
ah i was thinking along the lines of instantiating an object whose class i got via reflection and storing the class name at serialization
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'
? 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)'
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"
wouldnt that necessitate to know the possible types?
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
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
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
it's not a custom event
I use EntityDamageByEntityEvent and check the player's main hand for the enchant
hm thats odd. did you register the event listener
yes I did
odd
yea no idea why it wouldnt trip the listener. how do you verify if it did trigger?
logger
as in instance of my plugin getLogger().info("Enchantment trigger");
I also want villagers to have the enchant on a book
Uhm can somebody tell me how can I get 1.8.8 src
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
why would that be a flag
the generate-source toggle?
bt applies patches, does the whole remapping bs and then compiles
Is There Anyone Indian I'd Yes Then Dm Me Because I Want To Make My Public Smp So DM me fasttt
Really? :/
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
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!
ChunkUnloadEvent gives you the chunk
declaration: package: org.bukkit, interface: Chunk
And there is a getEntities method
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/world/EntitiesUnloadEvent.html
I believe entities and chunks are separate
(that's bukkit wait wat)
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...
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 ?)
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...
Yes, I'm going to do that, it'll be so much easier. Thank you so much!
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
i.e. what are r, g, b here
nvm you said
idk how the color works with particles in the api
what if you try using a constant like Color.AQUA
I'm pretty sure that's an incorrect usage. Maybe you're looking for this
declaration: package: org.bukkit, interface: World
Make sure you read about what offsetX, offsetY, offsetZ are here
you can try something like that:
Each one has its own class loader iirc
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
if i want to get a class via it's name in reflection, which of those names is the correct to use?
Why?
coz im storing data, and such won't have access to class at the time of reverting
tag.getClass() will return its implementation class, I don't know what you are trying to do
to send a STRING representing the class
i know i can use getClass to get the class but Class<?> aint exactly a SQL type
You always ask questions that have no head, only tail.
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)
that text aint on that page
because its a summary of the things you asked about
ah
the link I provided is the specification on it
canonical should include the package so...
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
ah. and since im messing with mojmap classes at runtime the canonical name should work
ideally. I can't think of a scenario off hand where it wouldn't for what you are needing it for lol
what i need it for is to serialize https://mappings.dev/1.21.4/net/minecraft/nbt/Tag.html
version: 1.21.4, hash: 7b92f27a50
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
Class.forName(packageName + "." + className);
what you could do is make an enums for the version and just use one of the services that already has the obfuscated mapped to whatever name
?mappings
Compare different mappings with this website: https://mappings.dev/
how do i check the version I'm on tho
getServer().getVersion() or something like that
could also query metadata for implementation as well
since spigot/bukkit puts that in at compile time
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")
uh, thought it was NBTBase or whatever
thats the spigot map of the interface
ah right
Bukkit#getBukkitVersion
?jds
?jd-s
declaration: package: org.bukkit, class: Bukkit
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
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
lol
can you not chain switch statements?
ah remove the parenthesis
god this looks cursed
what was the durability enchantment changed to? (for unbreaking)
unbreaking
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?
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
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?
Is there any reason you need to do this? The world already stores this information for every entity iirc
yes but i discard changes to the world