#help-development
1 messages · Page 434 of 1
i would hope so
If you mean storage, yes. Because you wont store locally
Most of time you work over Github or remote machines
In my case for coding i work remotly into a local dedicated server i have
what im trying to do is put campfires out when they're placed and then allow players to put campfires out if they hit them
Its a shity pi 4 of 8gb ram, its not the best
Yeah
As dev says, if it works dont move it
💀
Agree with you
Okay, GPT is weird today
Nothing to do to what ive asked
Lmao i wont touch fkg kyori componets, they are a fk mess
i believe minestom uses them by default
nop, first timeusing it
And i wont touch they shity api again
hows minestom shitty?
Looks code by a none api experienced dev
Atleast the api
the methods doesnt have the get keyword for methods atleast
oh if thats the only thing
where
alexitos msg be likes
How do you converts shity kyori componets into plain string?
You need a serializer
LegacyComponentSeralizer
ok this is what i have now https://paste.md-5.net/owiduguqut.cs
the campfire is unlit when placed, but then whenever i try and relight it, it just unlights again
does clicking on a camp fire normally put it out?
Only with a shovel iirc
ye only if you use a shovel
and you are not using a shovel?
cancel the interact event anyway, to eliminate that possibility
and it worked fine until i added the blockplaceevent
to make campfires start as unlit
Probably a consequence of handedness
Right click with right hand, then right click with left hand in the same tick
Tag.CAMPFIRES.isTagged() btw
what is that
More convenient check
if (Tag.CAMPFIRES.isTagged(event.getBlock().getType()))
wut
thank you choco
choco?
What happened with some stuff they used to be more staff. Did smth happen to them?
I don't think so
ok its definitely this bit thats messing it up
//campfire block place and make it unlit
@EventHandler
public void onPlace(BlockPlaceEvent event) {
if (Tag.CAMPFIRES.isTagged(event.getBlockPlaced().getType())) {
Campfire camp = (Campfire) event.getBlockPlaced().getBlockData();
camp.setLit(false);
event.getBlockPlaced().setBlockData(camp); //set the data
}
}```
i removed it and i can light fires and put them out fine
that only fires if a player places the fire
I eated the other staff
How can I specify a optional parameter in @Syntax using ACF
ye but its breaking everything else somehow
actually
maybe itd work if i added something to check if the palyer placed the fire
how does setlit work
no, it only fires if the player does the placing
does it just replace the campfire with a lit one or something
oh
are you doing this in creative?
Hey, I am trying to send a message with chat colors mixed in to make a map, but the whole message appears white when I test it. https://paste.md-5.net/avesogakoy.cs
I have confirmed that there are plus signs that should have the red chat color. Is the chat color removed somewhere in the process?
It is a list of UUIDs. The blocks around the player were looped through searching for a PDC tag that marks ownership. If there is no owner, it adds "null". If there is an owner, it adds the UUID.fromString(). I am trying to send a map to the player by iterating through the list of UUIDs and appending different colored "+" signs depending on ownership. Right now, I just want white "+" for no owner and red "+" for some kind of owner.
I confirmed that there are UUID tags in owners when I do the test, so I am not sure why there aren't any red "+" signs showing up in the message sent to the player.
that's still hard to understand for me, sry
try adding some more println's
you can try printing "OWNER" after your if check is passed
to see if there is like at least one owner(also at least one red plus)
That's okay. Let me try again.
There is some kind of zone around the player
with blocks
and you loop through the blocks
right?
and on each block(somehow) there is a PDC tag
Here is a paste with all the context
I am using the CustomBlockData library (thanks Jeff) to assign PDC tags to blocks using the chunk.
The owners list looks like : [null, null, 1230e-asdfe2-asf2, null]
So I want the output to look like "++❌ +"
you are doing like
owners.get(0);
while uuid should be bgfdgf-fdgfdg-312q312-dgf
can this like return something not null
I am getting the element from index 0
No worries
forgor about index
if you insert println between this two
does it like print anything
and all of your assembledlines are white too?
lemme see
It doesn't. Paper does
sysouts are fine for debug purposes. No harm
Oh, I figured it out, lol
Since it is a map, I divided the list into rows , but in the for loop, I grabbed owners.get(0, 1, 2, 3, 4, etc.) for every row. So the map is actually the same row repeated over and over.
i can only offer amogus gif
How can I add a level 255 enchantment? I think there was a specific method but I forgot and I can't find it please help
Thank youuuu
Hello, I don't know why the listener is not triggered, I have no errors
https://paste.md-5.net/qijohubaxi.java
when I add "public" to the onEvent method of the ItemProperty abstract class I got this error: https://paste.md-5.net/susitenute.sql
Can you please help me finding the cause?
your events are abstract. They don;t have all the required elements
you also seems to be using events in a very bad way
tryign to fire an event for a specific item is terrible
mark your items as custom in the PDC and detect them in a single Listener
it's because I want to add special properties for each items
what is PDC?
?pdc
then store their data in teh PDC and detect when that item is used in a Listner
ONE listener for all items
but when I create properties, I need a special event as parameter
why?
because for exemple I want a property to add potion effect when holding the item, an other to break other blocks from a blockbreakevent, and multiple others in the future
Nothign stopping you firing off whatever effects you want, but no need for listeners for it
a SuperItem has a list of ItemProperty
before it was working because I used an interface for ItemProperty, but I needed to add @EventHandler every time I override the method so I tried to add another method that invoke this method, but with the default interface method I got the same error as this
its still a terrible design pattern
if you want to add potion effects when items are worn, just check yoru armor slots on InventoryCloseEvent
properties do not need to implement/register events
yes but they need an event like BlockBreakEvent in parameter to do all mechanics
no they don't
you are not understanding the MC/Spigot design
it is an event driven system...
but not an event PER item
how can I register automatically all events I need but only one time?
your listener checks to see if it was a custom item used, then pass the event through a Consumer/Function to handle it
There are very few events you need
eg a method java public boolean onBreak(BlockBreakEvent event) {}Does not need to be registered as an event
all it needs to do is process the event you pass to it
so in ItemProperty I remove the implementation of listener
can I keep the handle method with a custom event?
yes, you never need to register it as a Listener
you can pass it whatever events you want, just creat a method to process them
okay
so for each events I need to do everytime @EventHandler in a class implementing Listener and to handle them manually for each property?
💀
like this? https://paste.md-5.net/tebagajexo.java
yes
😭
much cleaner
yeah but it will be the same code for each events
then use better generics so you are not hardcoding the type
wait no need
your ItemProperty is a generic interface?
the code you are running shoudl be specific to that property
not sure what you are stuck on
ok, can I listen all events? because every time I check if each property of the superitem in player's hand is applicable to this event
a property should be for a specific event
yes
so why do you want to listen to all events?
ok let me explain you an exemple
Does someone know how to best track if the inventory changes for example crafting something new, collecting an item, taking item from chest (What listeners are all needed seems like quiet a few or am I missing smth?)
There are many events you need to listen to
PlayerPickUpItemEvent
inventoryClickEvent (this one will be complex)
InventoryDragEvent (also complex)
PlayerItemConsumeEvent
and a few I'm missing
monitoring an Inventory change is quite complex
especially as other plugins can also make changes
Yeah I only need Vanilla stuff possible in survival so PlayerPickupItemEvent and InventoryMoveItemEvent might be enough thx for the help 🙂
Wonder if we can hook the Inventory Change handler vanilla uses
Sadly the InventoryMoveItemEvent is something different than I thought
Also sounds like pain 😂
Using the spigotAPI, is there a way to get all structures in a server including those of a data pack? I got the vanilla structures but how would I get the ones from data packs?
I don't think there is an api for data pack ones
Dang it.
You can have a look at org.bukkit.generator.structure.Structure and org.bukkit.generator.structure.StructureType but I don't think it will help much
I was going to say they have to be registered before they can be used
With NMS? I don‘t know how Vanilla does it because I mean just changing the slot could also be seen as a change
To get all currently registered https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/StructureManager.html#getStructures()
But world even if they’re from a data pack?
if they have been registered/used yes
I’ll take a look at that. I appreciate it
When i restarted my server, some player's money and home set got clear.how can i solve it?
huh
?bt
Run buildtools for 1.8.8
Where can I download it, it doesn’t have a download button @kind hatch
You can't download it. You have to build it. Hence BuildTools.
Everything you need to understand is on the page itself.
Just do a bit of reading
Ok
It's like this because of laws and stuff.
Ok
Beta 1.5*
Java 7
Just go download craftbukkit 1.0 it’s in #help-server somewhere
and uh add the jar directly to the ide with the build path
I'm trying to retrieve the net.minecraft.network.Connection in 1.19.4, but when I do so, it gives me the error:
Connection connection = craftPlayer.connection.connection;
The field ServerGamePacketListenerImpl.connection is not visible
Why do you need the Connection?
Just use the ServerGamePacketListenerImpl directly
For a packetreader which requires the channel in order to interact with NPCs.
ServerGamePacketListenerImpl doesn't have a way to retrieve the Channel nor does its predecessors have any access to io.netty.channel.Channel
I'm trying to pipeline a packetinjector through said channel
ah okay. in that case, you need to set the "connection" field accessible with reflection, then get it
private static final Field CONNECTION_FIELD;
static {
try {
CONNECTION_FIELD = ServerGamePacketListenerImpl.class.getDeclaredField("h"); // 1.19.4 = "h", https://nms.screamingsandals.org/1.19.4/net/minecraft/server/network/ServerGamePacketListenerImpl.html
CONNECTION_FIELD.setAccessible(true);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
}
public static Connection getConnection(Player player) {
CraftPlayer craftPlayer = (CraftPlayer) player;
ServerPlayer serverPlayer = craftPlayer.getHandle();
try {
return (Connection) CONNECTION_FIELD.get(serverPlayer.connection);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
anyone know why java refuses to decode my base64 string?
Stacktrace:
java.lang.IllegalArgumentException: Illegal base64 character a
at java.util.Base64$Decoder.decode0(Base64.java:847) ~[?:?]
at java.util.Base64$Decoder.decode(Base64.java:566) ~[?:?]
at de.jeff_media.angelchest.Stepsister.saveBase64VerificationTemplateToActualHtmlFile(Stepsister.java:310) ~[AngelChest-9.10.0.jar:?]
at de.jeff_media.angelchest.Stepsister.createFile(Stepsister.java:282) ~[AngelChest-9.10.0.jar:?]
at de.jeff_media.angelchest.Stepsister.access$000(Stepsister.java:27) ~[AngelChest-9.10.0.jar:?]
at de.jeff_media.angelchest.Stepsister$1.run(Stepsister.java:138) ~[AngelChest-9.10.0.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.4.jar:git-Paper-466]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.4.jar:git-Paper-466]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1482) ~[paper-1.19.4.jar:git-Paper-466]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.19.4.jar:git-Paper-466]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1396) ~[paper-1.19.4.jar:git-Paper-466]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.4.jar:git-Paper-466]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[paper-1.19.4.jar:git-Paper-466]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Base 64 (decodes fine on CLI and on online decoders): https://paste.md-5.net/iqokuzilej.makefile
Code (line 310):
byte[] decodedBytes = Base64.getDecoder().decode(base64.getBytes(StandardCharsets.UTF_8));
Stepsister? lol
yes, it's the successor of Daddy
anyway, found the problem - java cries when the base64 string contains newlines
so I just had to base64.replace("\n", "") and it worked
it tooks a few months but I now officially regret the way I set my scripting system
the systems fundamentally works but the way I injected inheritance into it is a major nightmare
sounds like time for a re write 
you mean a ConfigurationSerializable?
you mean stuff like this?
mylocation:
==: org.bukkit.Location
x: 20.0
y: 64.0
z: 20.0
...
that's what bukkit uses to identify which class that is. you could write your own serializer / deserializer, e.g. like this: (gimme a second)
public static Map<String,Object> serializeLocation(Location loc) {
Map<String,Object> map = loc.serialize();
map.remove("==");
return map;
}
public static Location deserializeLocation(ConfigurationSection section) {
return Location.deserialize(section.getValues(false));
}
// ...
{
Location myLoc = ...;
myConfig.set("location", serializeLocation(myLoc));
// and to get it again
Location myLoc2 = deserializeLocation(myConfig.getConfigurationSection("location"));
}
sth like that should work
you really just using the normal serializer/deserializer and removing the type xD
yes
might as well just use the default then
but they want to remove the == part
fair enough 😮
I mean, that was literally the question 😄
id prefer my locations to just be "world,x,y,z,yaw,pitch" in configs but that is me
i prefer to not config locations at all by hand even more
I usually use this to read locations from config: https://paste.md-5.net/avayenigec.php
the advantage is that it allows both UUIDs and world names in the config
oh yea that is neat indeed
ok its definitely that, when i relight a campfire the blockplaceevent is being triggered
does anyone know how to make it not trigger for campfires being relit
wdym? ofc it can
just use RecipeChoice.EXACT_CHOICE
oh wait it's not an enum
anyway, with ExactChoice it should work fine
for shapeless recipes, that's true, but it should work fine for shaped recipes
I'm pretty sure that it works fine for shaped recipes
player head can be enchanted?
There are some materials which don't glow and I believe that skulls unfortunately are one of them
getServer().getPluginManager().registerEvents(new IgniteEvent(), this);
getServer().getPluginManager().registerEvents(new PortalUse(), this);
getServer().getPluginManager().registerEvents(new PortalRemove(), this);
getServer().getPluginManager().registerEvents(new PortalCreate(), this);
better ways to do this?
well this is fine tbh but maybe you could be like
List<Listener> listeners = new ArrayList<>();
onEnable {
listeners.add(new IgniteEvent());
...
listeners.forEach(it -> getServer().getPluginManager().registerEvents(it, this));
}
it's just a lambda
there's nothing wrong with what you're already doing
I prefer having an initListeners() method in my init()
It just adds more complexity
would it be possible to loop through all the classes in a package and construct them?
should I continue how I am doing it?
yes
okok
you can combine listeners if they all do the same thing
or are closely related
when my IDE opens I'll show you a class I wrote for a land claim/protection plugin.
?paste
You'll see a LOT of events in there
but its just one listener as it's all related
oki
yeah I dont think I need so many classes for listeners
if you are dealing with portals, one class
yep, they could all be combined into a portal listener
Hi, i'am trying to get the lit state of a candle but it somehow always says it's not lit while it is,
public void candleEvent(BlockIgniteEvent event){
if (event.getBlock().getBlockData() instanceof Candle) {
System.out.println(((Candle) event.getBlock().getBlockData()).isLit());
}
}
the candle return false, even if i start a thread later to check it, anyone knows why ? or if i'am doing something wrong
Elgar how much time since you started with Java?
No it return the block that ignited the block, i use flint and steel so it will return null
ok
in that case you are probably getting the blocks state before it's actually lit
it won;t be lit until the event has ended, and not been cancelled
doesn't #getBlockState return a reference ? if so why my thread starting after the event still return false
um, I think I started Java around 2010 ish
can I ask how old are you?
I'm not talking about a BlockState, but the state of a block
so i shall do getBlock()#getState()#getBlockData() and cast that to Lightable to have access to the #isLit ?
yeah i'am confused rn xd
if you are IN the BlockIgniteEvent, the block has not yet been ignited. It's about to happen, IF your event is not cancelled
how can I get the name of a structure type?
getKey().getKey() probably
So if i start a thread later if the event is not cancelled, it shall return isLit ?
if you run 1 tick later it should be lit
it looks weird ngl
It still returns false
?paste some code as it should not
ok i got it to work
i was storying the #getBlock#getBlockData directly in my runnable, storing the block and then getting the data inside the runnable worked
yep, you stored a data instance
that's why i was asking about "reference" but i think i got a bit confused, but yeah that was the problem
thanks a lot, it works
nice
is it possible to change the frequency of natural regeneration?
e.g. slow it down x2 or speed it up x2
well you could turn it off and apply your own
maybe i could listen to regain health event and cancel it every second time but it's scuffed
so can you tell me what the current frequency is so that i can recreate it exactly
you only need check the players food level to make sure they are fully saturated then heal
frequency
imma do this ig
no clue what the default rate is
exactly
is there a way to create an item that i can access to with /give minecraft command?
You can create any item when using the /give minecraft command...
Help me. I cant understand spigotmc bukkit code
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
What would be any possible reasons why my config.yml get's blank when disabling the plugin?
I just have saveConfig() ondisable
@Override
public void onDisable() {
saveConfig();
logger.log(Level.INFO, "Plugin disabled");
}```
To be fair, most of the concepts are quite unusual. For example the entry point of your
JavaPlugin. Or why methods with annotations get called.
at some point you are wiping it, or you have a bad config to start
https://github.com/PaperMC/Paper
I cant understand this code.
I want to make new bukkit.
How to do it?
lol
there's quite a lot of code there
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
?whereami
Yes I know
You need to fork the server
How many (spigot/paper) plugins have you written so far?
RPG, Anticheat, API
index e090175d2fbe8eba664500feafc29c0567bb0c87..d77f15c58f41f1e00c75e0a022919bb7dacc9926 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,10 +9,9 @@ plugins {
dependencies {
implementation(project(":paper-api"))
implementation("jline:jline:2.12.1")
- implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") {
- exclude(group = "org.apache.logging.log4j", module = "log4j-api")
- }
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
implementation("org.ow2.asm:asm:9.4")
+ implementation("org.ow2.asm:asm-commons:9.4") // Paper - ASM event executor generation
implementation("commons-lang:commons-lang:2.6")
This is a patch
I cant understand
- and -
- are stuff that has been added and - are things that have been removed
- is add and - is deleted
- Go to the paper discord
- Ask on how to contribute to the project / fork the project
Ok
Contribution steps will explain how to create a fork
I am unable to find anything that does that
:p
whats your default config?>
# This is the name of the main world
main_world: deep_dark
structures:
shouldgeneratestructures: true
# Type can be whitelist or blacklist
# whitelist will only generate the structures in the list
# blacklist will generate all structures except the ones in the list
# List of all structure types: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/generator/structure/StructureType.html
type: whitelist
structures:
- ADD HERE THE STRUCTURE NAMES
portals:
# Example
# 0 (portal id):
# world: world name
# blocks: [list of block coords]
last: -1
I've passed it into a yamlvalidator and it say it's fine
load the config on enable and dont wipe it afterwards
are you calling saveDefaultConfig() in your onEnable?
I am not wiping it (or that I am not aware of it)
yeah
@Override
public void onEnable() {
logger = getLogger();
instance = this;
config = getConfig();
getConfig().options().copyDefaults();
saveDefaultConfig();
this.getCommand("generateworld").setExecutor(new Generate());
getServer().getPluginManager().registerEvents(new IgniteEvent(), this);
getServer().getPluginManager().registerEvents(new PortalListener(), this);
// getServer().getPluginManager().registerEvents(new StructureGeneration(), this);
logger.log(Level.INFO, "Plugin enabled");
// Will create the world when tasks are enabled (aka when you're able to create worlds)
Bukkit.getScheduler().runTaskLater(this, () -> {
Generator.createWorld(Config.getMainWorld());
}, 1L);
}```
delete getConfig().options().copyDefaults(); it's pointless
juts saveDefaultConfig(); ¿
this is the line thats wiping it config = getConfig();
hwo should I do it?
move saveDefault before it
@Override
public void onEnable() {
logger = getLogger();
instance = this;
getConfig().options().copyDefaults();
saveDefaultConfig();
config = getConfig();
...
still does it
you didn't delete teh copydefaults
and delete teh config.yml you have on your server (the blank one)
tysm
np
declaration: package: org.bukkit.generator.structure, class: StructureType
why are some structures missing?
like ancient city
are default entity drops stored anywhere
like LivingEntity#getDrops() // this isn't a thing or something
I guess it's inside the game's codebase. For custom drops you'd have to make custom mobs I guess
not looking for custom drops, just wanna have a way to easily fetch mob's drops
drops are evaluated through the loot table
ty i'll look into that
StructureTypes represent multiple structures. Ancient City falls under the jigsaw structuretype. If you want a specific structure use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/generator/structure/Structure.html
declaration: package: org.bukkit.generator.structure, class: Structure
Isn’t woodland mansion also a jigsaw structure
I believe so
A lot is in the jigsaw
Yeah but the mansion has its own StructureType
on entity damage event, if health of player is 0 (then dead), if I do player.getKiller(), will it return the killer of player or is this only not null if set mannually?
Use the EntityDeathEvent to detect kills
ok, but on death, player.getKiller will return a non-null value?
Nope its a nullable value. A player can ofc die without being killed by another player.
yes, i know, but my answer is if i am sure that the player was killed by another player, will it return a non-null value or player.getKiller only returns a non-null value if i set it mannually by doing player.setKiller?
getKiller() will return a Player if the game determined a killer.
oh ok, thanks
how do u get the PersistentDataContainer from a world?
world.getPersistentDataContainer()
(!?)
Old version?
What version?
1.16
Nah just use the PDC of the spawn chunk
how could i store some like string in a world?
ah chunk PDC exists. I thought it was added later
In a File or a chunk that is always loaded (like the spawn chunks)
also, what does World#setmetadata do?
hmm not sure if world and chunk pdcs came at the same time
lemme see
metadata is not persistent
if no PDC then https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getWorldFolder() and create your own data file
it works!
like this?
PersistentDataContainer persistentDataContainer = Bukkit.getWorld(Worlds.REDWORLD).getChunkAt(Bukkit.getWorld(Worlds.REDWORLD).getSpawnLocation()).getPersistentDataContainer()
Ye it’s a list
does anybody know of a good sign gui library? (one that allows fetching input from a sign)
this one seems outdated (1.19.2 + old release) https://github.com/Cleymax/SignGUI
I'm trying to understand structure palettes. How can I create a palette for a structure? The NBT of the structure file just shows a simple list called "palette". Is there another file I need to define more palettes?
whats in the palette list
if all the blocks are there then I would assume it to be enough
I never had to load in a structure with multiple files like that
the palette list is just a list of block states in the order that they appear in the blocks tag: ```
palette: [
{
Properties: {
axis: y
}
Name: "minecraft:birch_wood"
},
{
Name: "minecraft:birch_planks"
},
{
Properties: {
axis: x
}
Name: "minecraft:birch_wood"
},
{
Properties: {
lit: "true"
}
Name: "minecraft:redstone_lamp"
},
...
]
blocks stores position of the blocks, palette stores the states
but structures have multiple palettes somehow, (https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/structure/Structure.html#getPalettes()), and IDK where those are set/stored
are there not multiple files , one for each structure variation?
or are those generated by the game maybe
but I doubt it
there probably are, not entirely sure
How would I do this?
That would require NMS
I'm looking at the default mc datapack to see how structures are stored there and I'm not sure I even see anywhere multiple palettes being used
just because it supports multiple doesn;t mean any currently have them
then how do I create multiple palettes lol. I wanted to try just looking at the decompiled MC code to see where it tries fetching the palettes from but idk how to do that in spigot
No clue, I don;t know of any structure using more than one palette
it may not be used but for future proofing
I've worked a bit with NMS (mostly Packets) but don't really know how to start with this one. Where/how does Minecraft implement their hooks and where are the Bukkit Events called from?
what about past proofing though
can't use, yet
Is there a way to disable the loading of spawn chunks in WorldCreator#createWorld? (It's slowing down the process, and it's fine for me to manually load the chunks that I need)
how can I play a music disc in a jukebox block?
does spigot have the concept of not loading spawn chunks 
I don’t think any api method for making multiple palettes exists
Nor do I think you can do it with a structure block
I want to create custom heads but I cant import things like GameProfile or Property... why?
I've been trying to use this code to play the pigstep music disc if someone right clicks it but I keep getting an error saying class org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock cannot be cast to class org.bukkit.block.Jukebox (org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock and org.bukkit.block.Jukebox are in unnamed module of loader java.net.URLClassLoader @759ebb3d)
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if (event.getClickedBlock().getType().equals(Material.JUKEBOX)) {
if (!(player.hasPermission("wildminer.jukebox"))) {
event.setCancelled(true);
player.sendMessage("§cYou do not have permission to use this!");
} else {
((Jukebox) event.getClickedBlock()).setPlaying(Material.MUSIC_DISC_PIGSTEP);
}
}
}
Does anyone know how I can fix this?
you need to import authlib
and where can i get it?
com.mojang.authlib:authlib ?
What version are you on
me?
Mhm
getBlockData() and cast to JukeBox
1.19.3
Use the api then
authlib api?
The spigot api
ah with build tools?
SkullMeta.setOwningProfile combined with PlayerProfile
I cant use .setPlaying with this:
((Jukebox) event.getClickedBlock().getBlockData())
then get teh BlockState instead
the error is gone now but.. ehm.. it just doesnt play anything at all
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if (event.getClickedBlock().getType().equals(Material.JUKEBOX)) {
if (!(player.hasPermission("wildminer.jukebox"))) {
event.setCancelled(true);
player.sendMessage("§cYou do not have permission to use this!");
} else {
((Jukebox) event.getClickedBlock().getState()).setPlaying(Material.MUSIC_DISC_PIGSTEP);
}
}
}
there is no ChatMessage in 1.19.4, what should i do
What is ChatMessage
more info
so protocol
like this?
Jukebox jb = (Jukebox) event.getClickedBlock().getState();
jb.setPlaying(Material.MUSIC_DISC_PIGSTEP);
jb.update();
yes
yeah, sorry if i didnt provide enough info at first
mk
@young knoll why is setOwner() deprecated? How can I fix it or should i just do @Deprecated?
?jd-s check the javadocs
if you are talking about skulls
which one should i use in Entity#setCustomName
neither, those are chat
like this?
i used ChatMessage to set custom name
in 1.17.1
Which implementation of IChatBaseComponent should i use
why are you using packets to set names?
Remove the toString
packet entities
just tell me which class should i use
I'm trying to play a music disc in a jukebox if the jukebox is not playing anything and then if it is already playing something, stop that song and the next time you right click it will play again or even just restart. I have this code and it just starts another song every time you right click again so you have like 20 songs playing at the same time and it won't stop.
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if (event.getClickedBlock().getType().equals(Material.JUKEBOX)) {
if (!(player.hasPermission("wildminer.jukebox"))) {
event.setCancelled(true);
player.sendMessage("§cYou do not have permission to use this!");
} else {
event.setCancelled(true);
Jukebox jb = (Jukebox) event.getClickedBlock().getState();
if (jb.isPlaying()) {
jb.setPlaying(Material.AIR);
} else {
jb.setPlaying(Material.MUSIC_DISC_PIGSTEP);
}
jb.update();
}
}
}
does anyone know how I can fix this?
TextComponent
is it for NMS?
yeah nms' component
i dont have mappings
💀
Get mappings
its just Component
there aren't separate implementations of that now, there are separate implementations of ComponentContents
then what should i use
which implementation of it
in the setCustomname method
or b
there aren't separate implementations of it, if the method takes Component, then you have to create one of those. should be static methods on that interface
Then, i cant set custom names anymore?
For entities? You can still set their custom names ofc
which docs is that
how
For example like this:
nmsZombie.setCustomName(Component.literal("Some cool text"));
Thanks
where is PacketPlayOutSpawnEntityLiving
hell naw
why everything changed
This is why you use mapped NMS
How can i create a table in sql which contains the uuid of a player? What is the datatype of a uuid in my sql?
Doesn't MySQL have a uuid datatype
yes it has
no it doesnt
Using moj mapped will help you in the long run. If you are using obfuscated or spigot mapped then you will be left behind.
don't do that, just check the entity' class, and set them manually, they'll get deseialized to packets by datawatcher
you can use char(36) for uuid as a string
If it doesn't have, store it as byte array
ew char(36)
Postgres has it for sure
where is PacketPlayOutSpawnEntityLiving now
At least drop the dashes and use char(32)
Which is btw the better sql db anyways
idk
could also use a blob and byte array
no
ClientboundAddEntityPacket
Do the dashes matter in some way?
When I use the UUID datatype i get this error
i dont have mappings
you need to convert the uuid to a string and use char(36) or char(32) if you drop the dashes
Here: Since MySQL 8.0 we have binary UUID support
https://dev.mysql.com/blog-archive/mysql-8-0-uuid-support/
but it doesnt work... im using 8.0 or above
?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.
I normally just convert it to binary
ive sended the error lol
But I've read that isn't ideal for primary key
how can i do this?
Send the actual code. We cant predict your syntax error from thin air.
binary(16) PRIMARY KEY
ok thx
Probably because there may be collision, and it's kind of convention to use incrementing int for primary
I mean we know there won't be collision with player uuids
I always cite this one
"Only after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%."
how can i delete this table in mysql? lol
Drop table lol
Lmao, that is actually really cool, imagine if it was 32bit
wdym?
I gave you sql query for deleting table
oh yes like: DROP TABLE coc_money;
DROP TABLE yourTableName;
Yeah
Unless you have relations. Then you need to cascade
learnt about sql precedures today
Or click on the database and delete it in the tables page
we saw some java code in the databases class today and i was terrified
Lol?
you guess
someone had to explain what it did and the whole class was impressed
i was like cmon man that was the easiest database shit ive ever seen
anyone know what plugin i can use to make an rtp gui to rtp in nether overworld and end?
Well
DeluxeMenus can make GUIs
Combine that with any RTP plugin that supports multiple worlds
welcome to computer science courses when u already taught urself
programming is so boring, we learnt about how to extend a class prev week
cut em some slack
it's hard to memorize a keyword extend
and the fact that it extends
its not really about the difficulty of the content
but making sure everyone is at the same level
And that is why my college course started with how to CTRL C + V
we have only 4 hours
i believe we had 6 prev semester 💀
the most important skill for a programmer tbh
I mean we didn't really progress much farther
how would i change the output dir in gradle?
ik how to do it in maven
but
using maven-jar-plugin
using shadow jar
then shadow jar should look like ```groovy
shadowJar {
destinationDirectory = file("./target/")
}
Vector velocity = event.getEntity().getVelocity();
Bukkit.broadcastMessage("" + event.getEntity().getVelocity().length());
velocity.setX(velocity.getX() * multiplier);
velocity.setZ(velocity.getZ() * multiplier);
velocity.setY(velocity.getY() - multiplier);
Bukkit.broadcastMessage("" + event.getEntity().getVelocity().length());```
why does this not change the speed of the object?
entity.setVelocity
I'm trying to set the players yaw and pitch to their original one before the arrow lands but it just sets to something random:
Location loc = e.getEntity().getLocation();
float yaw = player.getLocation().getYaw();
float pitch = player.getLocation().getPitch();
player.teleport(loc);
player.getLocation().setYaw(yaw);
player.getLocation().setPitch(pitch);
e.getEntity().remove();
Set the pitch/yaw for the tp location
float yaw = player.getEyeLocation().getYaw();
float pitch = player.getEyeLocation().getPitch();
tpLoc.setPitch(pitch);
tpLoc.setYaw(yaw);
hey guys, how can i make maven build my plugin to a custom path? kinda lazy to move it everytime.
^
maven-jar-plugin
Oh wait maven
Am slow
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>../libs</outputDirectory>
</configuration>
</plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<outputDirectory>YourDirectoryHere</outputDirectory>
</configuration>
</plugin>``` @ashen quest
wow
Ty
am slow
Coll1234567 vs Zlaio_ Slow Competition
im slower than both
does it not return a reference to the actual entity velocity?
I mean yours probably has a modern version of the jar plugin XD
It's probably a copy
Hence the set method
?
Does setting keep spawn in memory to false work?
No, because I don't have a world instance yet
createWorld returns a world instance of the newly loaded/created world
(Loaded since I already have all the files)
Only on paper
Oh yeah no it isn't
https://paste.md-5.net/jukuhorane.xml
Well this is my pom.xml, I m using a GUI Library. But it isnt shading that into my plugin I think.
I get this error
On Spigot you do this using the WorldLoadEvent iirc
i thought those two were the same
There's WorldLoadEvent and WorldInitEvent
I don't really know which one to use
Maybe I should add clarification for that
It's called right before chunks are generated and after the world border is initialized
i could really use some rust enums in java 🥹
make them
huh
?jar
"Cant you just send the Spigot jar?"
No, we can't. It's illegal to distribute Mojang code, meaning that you have to use BuildTools to build the Spigot jar.
the change location of maven jar output?
Test server plugin expert
mock bukkit?
just realized i dont need an usb dongle when i use my mouse with a cable
Thanks ebic
I have troubles with the default config.yml, Why after I make some modification via spigot code, all my comments, or other variables are removed?
I use config#set(); plugin#saveConfig();
Do I need to replace saveConfig with saveDefaultConfig?
saveDefaultConfig should be ran onEnable to save the config from resources
saveConfig should be used when you call #set()
if im looking for a plugin do you know where i could find it
How exactly code after modification is removed
BTW if you are using older version of spigot, saveConfig will remove comments, as they are not parsed
my config before:
#Do not change here, just use /setup command.
changes:
x1: 0
x2: 0
y1: 0
y2: 0
z1: 0
z2: 0
#Messages
#{variable}
no-space: '&7There is not enough space: " + {lun} + "x" + {lat} + "x" + {ina}'
create-ground: '&7You need to create the base on ground.'
error: '&cOOPS! Something went wrong, please contact an administrator'
cannot-interact: '&7You cannot interact on this base because it s not your base.'
position:
first: '&aFirst position was set up'
second: '&aSecond position was set up'
saved: '&aYou saved the region'
error: '&cYou did not defined the region, use the netherite axe to do it.'
no-console: 'This command can be used only by a player.'```
after I set the 'changes' values (that s all)
```yml
changes:
x1: -3
x2: 3
y1: 0
y2: 3
z1: 2
z2: -2
Show code
FileConfiguration c = plugin.getConfig();
c.set("changes.x1", x1);
c.set("changes.x2", x2);
c.set("changes.y1", y1);
c.set("changes.y2", y2);
c.set("changes.z1", z1);
c.set("changes.z2", z2);
plugin.saveConfig();```
So basically only thing that persist is your setted stuff
yes, I m using the 1.19 API
Hello, i want to make my %server_time_EEE, MMM d% but in my language
anyone have an idea how i can do that?
im using this for Featherboard
i want to cancel trades with villager so what event i have to use?
Pretty sure it's just the InventoryClickEvent
i think i cancel opening merchant totally
you can do that with the PlayerInteractEntityEvent
Program and register a custom placeholder for PlaceholderAPI
When is this error called? Could not pass event PlayerJoinEvent to ClashOfClans v1.0-SNAPSHOT
org.bukkit.event.EventException: null
?npe
The NullPointerException, (commonly referred to as NPE), is thrown in the following cases, but not sealed to: 1. null is passed into a method or constructor which does not allow it; 2. When trying to access a field on an object pointing to null; 3. Casting null to a primitive. See https://stackoverflow.com/a/3988794/17047120 for information on how to debug NPEs.
Okay i need help
I want to create a function that waits untill a player places a block, but i can't find the way
Can i show my code in pastebin or something?
You can just make kind of set (if should wait for place block), then in place block event, just check if player is inside of that set
Is not that easy, its an async stuff
What
can i show you my code?
Sure
this doesnt feel right bruh
always fun discovering bugs when you thought something worked
minikloon from walmart
all tests pass so thats something
Is
NBTTagCompound same as TagCompound 1.17
Cause I also see there's no tag#setString() method either
comments get removed after saveConfig()
show more code
or stream the screen
we need your onEnable() + all of the methods which have config.set() or saveConfig() inside
In short, dump us everything you got
Probably due to the
==: org.bukkit.Location
Which may confuse server endusers
Myea
Well you at some point ought to separate configuration data from arbitrary formatted data anyway, since config data is usually read once anyway
So question, when using the world creator, spigot is failing pretty hard on 1.19.4
Not really a question
Not done writing, smart guy

It apparently tries to generate using the new cherry biomes, but the feature toggle is not on, and as such it errors when trying to find the biome definition in the registry
Is that a known issue?
Lets see
?stash
See here
Did someone make an oopsie
And for reference, enabling the experimental datapack does fix it
Since it is now added to the registry
You can get experimental items without the pack enabled too using spigot
It seems the support for the new experimental stuff is a bit... experimental atm
Here's the thing, I have no interest in supporting the experimental stuff
It's doing this with the datapack disabled
Indeed
Any idea how can I force mythicmobs mob to go in one direction?
Unfortunately I haven't found any goalai or something in their wiki so I have to force it with my plugin
I only see an issue with it being missing in enums
Oh yeah no mentioning about the registry
Doesnt MM have a goal for moving to a location=
I tested with pure spigot as well, yeah
I am just using paper for some profiling, it's my default setup
To a location maybe, but I want it to move forward constantly for his whole life
Like a plane in pubg
Then try letting it move relative to ~X ~ ~Z
Honestly ask on the MM discord or forum
Oh hang on
I think I see
The experimental biomes are added to the enum
So now I can't iterate over the enum anymore to get all available biomes
That sucks
Hard to solve
IsExperimental boolean?
Could just have Biomes and BiomesExperimental
Make it not an enum but a class with constants :D
Also that
But that pr isn't updated yet :p
md can we have that merged in 1.20
if its updated
can we also get loads more prs that modify lots merged
merge all the prs for 1.20
And no testing pls
Ship it
Release 1.20 right now 
Spigotpunk2077
Let only Verano decide which prs get pulled
👀
that would go great
no you wont
That was such a mistake
He likes it
Anyone know the packet used to make a player appear to be crouching on the client side? I’m using the mojang remappings.
Sorry, I’m fairly new to NMS (I don’t use it much)
recently started minecraft development, how do i save player data to a variable?
? ?learnjava
learnjava?
what the fuck
?ls
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
yes that one
What data are you trying to store?
That will determine the type of variable you should use. If you are trying to store data long term, put the information in a database or file
Also, yeah, no offense but if you don’t know how to make a variable, learn the basics first. There’s a lot of resources out there (:
i do, im just not sure how to store it with a player
well with learning java you'll learn multiple ways to store data: variables, .yml, .txt, .json and even databases
each one being used in one case or another
just please dont use txt
Me when I store data in txt
thanks
lol
also learn sql if you wish to use databse
Alright so
Sneaking is considered a pose, on the Entity Metadata packet
You can create an entity metadata packet, and change the pose (usually at index 6) to SNEAKING and it should work
This is a bit stupid but should work (make sure to define your nms player)
You joke but i realise yesterday a region file, which holds of 32x32x16x16x256 blocks init with unique paletes of 20+ blocks ... is 100mb...
Considering sqls like coreprotect with 400k rows are like 9GB plus...
Maybe we have had a great way to store easy to grab data all along 😅
Okay but most blocks can be stored as a single integer
A log for breaking a block, not as much
^ region data is tiny
it'd be a bit heavier to do recalc if the palette size expands much
but if it's for something that only gets parsed once or twice and not edited, you can actually do some optimizations with a bit buffer
Log data requires a time stamp, likely 8 bytes right there. Then a user, another 16, a block, any miscellaneous data, etc
now absolutely coreprotect doesn’t just restore everything anew
if you check the database it’s broken up into separate palettes as well, so a user can be represented in a much smaller number of bytes with some relational key
though you also need to consider the fact that you’re storing interactions to the point it can be reversed to any state in the past, not just current state
Minecraft’s structure files on the other hand are kinda bulky
Compared to sponge schematics
Is it possible to spawn an Entity with already modified PersistentDataContainer?
You can use the spawn method that has a consumer
So this will allow me to insert data into the PersistentDataContainer before the EntitySpawnEvent is executed?
It should
Okay, thanks
Sadly, this no longer works in 1.19.3 They changed the required argument in the constructor from SyncedEntityData to “List<DataValue<?>>”
You need to get the entitydata and pack it. For most cases you can just pack dirty.
How would I do that? Sorry I’m new to this
List<SynchedEntityData.DataValue<?>> valueList = serverPlayer.getEntityData().packDirty();
New to nms or Spigot development?
Fairly new to both actually, LOL
So once I have the list, I’m guessing I’ll use a method to change the element at index 6 like you said, to the desired value. Would it be something like the following?
ClientboundSetEntityData packet = ClientboundSetEntityData(id, valueList)```
Is this correct?
I wouldnt touch the packed data itself.
Rather try changing the SynchedEntityData.
Btw this crouching will be completely removed as soon as any meta
of the player changes
So in most cases it will be reverted within a second
So I’d get the SynchedEntityData, alter it, then pack it like you showed. How should I alter it? I’ve never done that before.
How do you do this in spigot 1.9.4-R0.1-SNAPSHOT?
net.md_5.bungee.api.ChatColor.of("#FFFF")```
Hex colours were implemented in 1.16+ not before.
Anything after 1.16 will have the hex colours
ty 😛
Completely different question, but what packet would I use to make it appear a player is swinging hand on the client? I’m using the mojang remappings
Hey,
I am trying to check if a player hit a mob's head with a melee attack.
Not really good at math, so a little hint would be nice 😅
just needa confirm this here to make sure im not dumb
you cant change the texture of blocks without the user using a mod / resourcePack correct.
for example i want to make grass semi transparent or smth
Correct
kk just wanted to be sure lol
You cannot change textures without the user needing a mod or texture pack.
You can, however, request the user to automatically install a texture pack.
The user can decline this though
ye
I think I found a way.
Might be the worse way there is, but hey 🤷
I would, but the player isn’t really there. It’s an NPC
I see
Where is my settings.xml file located at for maven?
Anyone have experience editing the spigot source code?
I'm trying to create a fork of spigot but I want to build it with kotlin
However, spigot's compiling process doesn't seem to like kotlin
Yeah calling loadConfiguration doesn’t make the file
You can just use saveDefaultConfig
make config class
it makes it a lot easier
how dies via version translate the new entity stuff?
Armor stands
hi, how do i change a mob's data when they are already spawned in to have no AI
there's a setAI() function you can use
I have set the Api version in my plugin.yml as 18.0 , but it's saying "unsupported api version : 18.0" On my 1.18.2 spigot server
1.18
I assumed it works with 1.18+?
Yes
Hi ! Som1 know why its not teleporting the player to the f home or anythings ?
It supposed to claim the chunk at the coordinate in config, fsethome at the coordinate and teleport the owner
The code :
https://paste.md-5.net/ohotedegag.java
Config
And i dont get error
Because thats a map list not a string list
So what should i edit ?
Hello all I was wondering if there is a way to add world edit without a server
U cant but i thinks there some data pack or mods for use world edit like in solo
get the mod for it
Or u can local host a server
Worldedit can run as a fabric or forge mod
How do you local host
Install the spigot jar and java and just run it
Look on youtube
Listen I just got Java for my tiny human I know legit none of this so I am sorry for not being in the know
Thanks for watching! if you have any questions, then comment and I'll respond as soon as I get notified. Spigot is generally slower than paper, but it's easier to code in in my opinion, and there's a lot more plugins for it, however they are semi-cross compatible.
Yeah fr mods is easiest
Where do I find mods for Java and how do I add them
You can use something like the curseforge launcher to install it
Or multi mc? Idk if that has one click mod installation
Depends which one. You can add a settings.xml in the root project directory which allows per project maven settings. and then there is a global settings file. If you have maven standalone its located with the binary. If instead use maven provided by the ide you have to find where the ide stores maven
multimc is complex ahah
Mm then curseforge
Or just find a tutorial on how to install forge and forge mods, it’s pretty simple thanks to the installer
?bt
Then find some plugins toss them into plugins directory
Configure them etc
Then you run the server on the pc and have the other computers connect to it
If you go with 1.17 or newer mc version. Then make sure to have java 17 installed
What's packs
In what context?
In create world
I only have 1.19.4 and some snapshots avaliable I honestly got Java for free through my Xbox
Xbox ultimate for pc that is
Java is always free
Java edition
