#help-development

1 messages · Page 1204 of 1

zinc iris
#

right before this line in the manager

                consoleLogger.addHandler(consoleHandler);
#

add

#

consoleHandler.setLevel(Level.ALL)

heavy fulcrum
#

alright

zinc iris
#

that should fix it

eternal oxide
#

Pretty sure .setLevel no longer works. It broke long ago when Bukkit changed the backing logger

eternal oxide
#

yeah its a bitch

heavy fulcrum
#

I can set something like.. if the int value of the level is greater than or equal to that of info, send the message to discord

#

Here's some kind of warning
[17:14:06 WARN]: Nag author(s): '[]' of 'DTMBridge v1.0' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).

zinc iris
#

oh ye thats just cause we were using sout to debug

heavy fulcrum
#

ah right

zinc iris
#

ill look at it some more but its 6am and im tired af so ima sleep and hopefully while i sleep someone else can help or knows the answer

heavy fulcrum
#

always works when i reload the server instead of restart

zinc iris
#

like /reload

heavy fulcrum
#

yep

zinc iris
#

weird

heavy fulcrum
#

maybe i could set some sort of delay after the bot is initialized..

smoky anchor
#

Sorry, can you tell me what ConsoleDiscordHandler is supposed to do ?

heavy fulcrum
#

Its a Handler for the Logger which is supposed to log to a Discord channel

smoky anchor
#

So, anything that would be shown in the server logs, should be sent to discord

heavy fulcrum
#

yes

#

caught this while using /reload:
[net.dv8tion.jda.api.requests.RestRateLimiter] Waiting for 1 requests to finish.

smoky anchor
#

Can you, as a test, create a Filter and add it to the Logger ?
Just sout the LogRecord or something.

heavy fulcrum
#

Well, I'm kinda tired now. I'll see if I get some time later. Thanks for all your help

zinc iris
#

When I wake up ima clone your hit and mess around myself

heavy fulcrum
#

Thanks dude

#

In the mean time, I'll see how the dev of DiscordSRV did it.

zinc iris
#

Like 10 mins ago

#

He uses log4J basically

smoky anchor
#

Seems it uses Filter as well, but from log4j

heavy fulcrum
#

Could you name or link the classes which he used?

#

I'm kinda having a hard time.

smoky anchor
#

(actually I might be completely wrong)

heavy fulcrum
#

I'm gonna have to deeply study logging if I want this to work correctly. Thanks though.

heavy fulcrum
#

The main class is really, really big. Wow.

zinc iris
#

ye

#

and then he uses another thing he made

#

now i fr go to sleep

native bison
#

I need help to replace a deprecated method in order to provide support for 1.21.4

#

Why has Biome.values() been deprecated and made unavailable?

young knoll
#

Because it’s not an enum anymore

#

Use Registry.BIOME

native bison
#

bruh

young knoll
#

You can then use the stream method and whatnot

native bison
#

Thanks... not a fan of Regitries

chrome beacon
#

Why not

#

It allows for custom biomes uwu

slender elbow
#

welcome to the future

#

enums don't allow for shit

merry cove
#

so have a few dumb questions, made a second module in my project for api so third party plugins can hook. My question is, how do I compile the api in the core module? atm the api is <package>pom</package> do I need to shade it into the core or what's the process?

remote swallow
#

shade it in the core or shade them both in the parent

merry cove
#

Nice, ill try shading it in the core 🙂 ty

native bison
#

Is there a way to transform a JAR file into a IntelliJ Project?

#

I'm restoring an old private project which original code has been lost, except its .jar

remote swallow
#

you can decompile it but you wont get the exact code

#

it will be decompiled code which can be very broken sometimes

oblique igloo
#

Question is there an event for when a player loads a chunk into render?
I am using nms and packets to spawn npc's and I need it so that when a new player loads a chunk with an npc in them they get sent the packet so the npc shows up for them

chrome beacon
#

There isn't

#

You'd need to use nms for that part as well

#

or you know not reinvent the wheel and just use Citizens

oblique igloo
#

I'm not reinventing the wheel, I'm doing very specific things with npc's that citizens and their api doesn't allow for and I really don't want to use 50+ api's in a plugin.

native bison
pliant topaz
oblique igloo
#

Awesome I seen ChunkloadEvent but not PlayerChunkLoadEvent on the javadocs. Thanks

chrome beacon
#

That event is not part of the Spigot API

#

It's Paper only

remote swallow
pliant topaz
#

oh f

#

been in the wrong docs again sorry

#

wait

#

but in Chunk

oblique igloo
#

Damn I really don't wanna use paper's api for just that.
My other option was to listen to the player move event, and check when they enter a new chunk if it contains my object. But that feels kinda bad for performance

pliant topaz
#

theres a method to get all the olayers seeing the chunk

chrome beacon
#

^^

#

You'd need to check that every couple of ticks

#

for every chunk

#

Which uhh is not great for performance

oblique igloo
#

Yea that still kinda feels bad imo

pliant topaz
#

yep

#

but seems to be kind of the only api-only way

#

except the move event ofc

hushed spindle
#

?paste

undone axleBOT
oblique igloo
#

Yea I'll go ask on the paper discord about that specific PlayerLoadChunkEvent and see what they say

smoky anchor
#

shh

fierce salmon
#

Oh I'll look into that thanks

gilded granite
#

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.4.1:jar (default-jar) on project liam: Error assembling JAR: Problem creating output file for zip C:\Users\Admin\Desktop\LIFESTEAL\plugins, C:\Users\Admin\Desktop\LIFESTEAL\plugins\liam-1.0-SNAPSHOT.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

#

how do I fix this?

mortal hare
#

entity-tracking-range
Default: (display: 128, players: 48, animals: 48, monsters: 48, misc: 32, other: 64)
Type: Integer
Description: Controls the range in blocks that entities will become "visible" or otherwise known as "tracked" to the client. Entities outside of this range will be invisible as they are not being rendered to preserve CPU usage and bandwidth. This is particularly useful for PVP servers, as turning down the player range will 'nerf' wallhacks and radar to some extent. Miscellaneous controls the range for item frames, paintings, dropped items, and experience orbs. Other is a general maximum limit for all entities on your server.
Does not impact server performance much to change these values. These will mainly help client-side lag when lowering these.

#

you should read this config value and calculate the distance between you and the npc

#

it shouldnt be handled on chunk basis

prime berry
#

Blasix1x sent 1251 packets in a tick. Terminated the connection!

#

this is on the proxy

#

anyone know how to fix?

inner mulch
river oracle
#

Sending 1251 packets Ina. Ticket obviously

inner mulch
#

😔

eternal oxide
#

I'm sure he HAS to send 1251 packets a tick or his movements will be jerky 🙂

flint coyote
#

Any ideas how to deepcopy a ConfigurationSerializable and change a value that is final during that?
I tried it by serializing and then deserializing but that is just a shallow copy.

My next attempt was to use gson but it turned some of my nested ints into doubles, breaking the config

My last attempt (see below) was to create a temporary yaml configuration, write the object, save and read the object again, this however won't let me change values before reading it again as the commented line causes the whole Object except the freshly written field to be removed.

    public Integer duplicateActivity(int id) {
        ConfiguredActivity activityToCopy = getById(id);
        YamlConfiguration tempConfig = new YamlConfiguration();
        tempConfig.set("copy", activityToCopy);
        //tempConfig.set("copy." + ActivityBaseField.ID.configKey, currentHighestId++);
        tempConfig.saveToString();
        ConfiguredActivity newActivity = (ConfiguredActivity) tempConfig.get("copy");
        addActivityInternal(newActivity);
        return newActivity.getId();
    }
final sapphire
#

Just wondering if anyone could help me with this small plugin I am making, I've hit a bit of a dead end and not sure what to do

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

north nova
final sapphire
# final sapphire Just wondering if anyone could help me with this small plugin I am making, I've ...

Rough Idea:

So I want to make it so that when you join the server, the plugin will check if you have one of the following permissions 'ascension.team' or 'abyss.team'

If you have neither, a command will run to give you a luckperms group (either ascention or abyss) and the way it does it is by balancing the players in each group. If 10 people join, there will be 5 people on Ascention team and 5 people on Abyss team.

The plugin should check Luckperms to ensure the teams don't change size when players log off the server or should adjust the size of teams if players switch teams using another plugin.

Issue:

When a player logs on or off, the team size of what ever team they are on keeps on increasing.

I have never coded in my life before so and am using ChatGPT to code so I have most likely done something wrong. It would be greatly appreciated if someone could help me out!

north nova
#

no one can help you without the actual code

final sapphire
north nova
#

yea just send it here someone will probably answer

final sapphire
north nova
#

😭

final sapphire
#

Because there are 5 different files and some are over discord limit

remote swallow
#

?paste

undone axleBOT
final sapphire
#

Ping or DM me if you can help. Thank you (will be gone for about 1-2 hours)

flint coyote
#

But of course it needs a new ID so it's more than just a copy

#

I guess I'll just do a copy constructor that also allows the new ID

north nova
flint coyote
#

I mean I have that but since the Class contains maps it's not as simple as to just reach the map from the other object in because that would just hand in a pointer

north nova
#

new HashMap<>(oldMap)

flint coyote
#

So I have to specifically deepcopy those, but I can do it in a seperate constructor

#

yeah

north nova
#

so whats the problem

#
Constructor(Map<Object, Object> map) {
    this.map = new HashMap<>(map);
}```
flint coyote
#

Nothing, I was just hoping for something less bloaty since there's quite a few fields and I have to nullcheck a bunch of fields

#

And I thought "Oh I can already serialize it, so maybe I can just serialize and deserialize somehow"

flint coyote
north nova
#

why would it not go well with null wdym

flint coyote
#

if you call that with null it will give you a nullpointer

#
        Map<Integer, Integer> failureActions = null;
        if (failureActionIdsWithDelay != null) {
            failureActions = new HashMap<>(failureActionIdsWithDelay);
        }

So I basically have to do this all the time before calling the constructor

north nova
#

this.failureActions = failureActionIdsWithDelay == null ? null : new HashMap<>(failureActionIdsWithDelay) is a cleaner one liner i guess

flint coyote
#

yeah true, saves some lines. I'll take that

#

thanks

north nova
#

no worries

inner mulch
flint coyote
#

While this is true for just one field, it would require me to do that for all possible combinations and have a bunch of constructors that have call constructors. I decided to go with a non constructor based approach which is just

objectToCopy.copyWithNewId(newId);
#

And then calls the constructor internally with the one line null checks

grim dock
#

Hey there, I am trying to create the effect of a player dying and dropping his inventory without actually killing the player.
I want to do this because I prevent the player from dying and instead instantly make him a spectator.

Does anyone have an idea how I can do this with the lowest possible performance impact?

I already considered to loop through the players inventory and spawning the items piece by piece as entites but that seems like too much brute force from my point of view.

inner mulch
#

at the same location

eternal oxide
#

you can call dropItem on the player

flint coyote
#

isn't that just for the item in the players hand?

grim dock
eternal oxide
#

thers lots of them

#

if you really want to simulate teh player dying then world#dropItemNaturally

flint coyote
#

I would personally go with respawning the player and setting the respawn location to their position as this causes the least amount of noise for other plugins

#

But if compatibility is not an issue then it's just looping the items. It's not even 50 iterations, that shouldn't cause any performance issues

grim dock
eternal oxide
#

just getcontents/armor and drop each item

flint coyote
#

Don't you wanna drop all items?

grim dock
flint coyote
#

Oh. No you can't. You'll have to loop and do World#dropItemNaturally. Either that or you'll have to loop and set the item in the players hand to then drop it.
The latter would cause the PlayerDropItemEvent to fire for each item, which is probably not wanted.

#

And don't forget to clear the players inventory afterwards

grim dock
north nova
#

cancelling the event & dropping the items afaik will not have the death animation

fierce salmon
#

Just curious, what would someone use runtasklaterasynchronously for?

inner mulch
#

examples are chat, tablist, scoreboards

#

or anything else

fierce salmon
#

Oh okay

#

And whats the difference between something being on and off the main thread?

inner mulch
#

it can run in parallel and you make use of the cores of ur pc, altough im not sure what runtaskasync does internally

fierce salmon
#

Ok

young knoll
#

It offloads it to a thread pool

#

As for how those threads are managed, that’s up to the OS and the JVM

mortal hare
#

when you're building a texture atlas, does it usually needs to be inside a grid (just like minecraft did prior to resource packs, they sill iirc build texture atlases dynamically) or can you make it gridless and hardcode the positions of the texture itself onto the object?

#

what's the best way

grim dock
drowsy helm
ebon topaz
#

ok so i can use tool component to set the mining speed right?

ebon topaz
#

also yk how if you try and put sharpness on a pickaxe and it doesnt work or if you use command and it says unsupported enchant for that item, how do i add enchants to that list? so for example make it so my itemstack cant be enchanted with fortune

rough ibex
#

You cant afaik

#

its based on the id

smoky anchor
ebon topaz
smoky anchor
#

iirc you can simply change the attribute

ebon topaz
#

is that with setAttributeModifiers?

smoky anchor
ebon topaz
#

yeah ive been looking at the docs but i think i seem to make a new tool component instead of editing the oringnal one because after i change it i cant mine blocks

smoky anchor
smoky anchor
#

Why do ToolComponent.ToolRule methods return Float and Boolean ?!
edit: should have read the full description

ebon topaz
#
public ItemBuilder setMiningSpeed(double speed){
    ToolComponent tool = meta.getTool();
    tool.setDefaultMiningSpeed((float) speed);
    return this;
}
smoky anchor
#

read docs of getTool
Gets the tool set on this item, or creates an empty tool instance. The returned component is a snapshot of its current state and does not reflect a live view of what is on an item. After changing any value on this component, it must be set with setTool(ToolComponent) to apply the changes.

#

so at the very least you'd have to do meta.setTool(tool);

ebon topaz
smoky anchor
#

No you're not

#

If you can, please paste the whole ItemBuilder class
But I doubt you are if the setMiningSpeed is complete

undone axleBOT
robust helm
#

when using markers for spawnlocations of specific minigame events like player spawn points or item generators, should i use customname or metadata?

smoky anchor
#

Neither, use PDC for the Marker entity

chrome beacon
#

?pdc

ebon topaz
#

so i think what ive found out is that there is no tool components on itemstacks unless you specifically set one which means there is no default to go off

smoky anchor
ebon topaz
#

yeah attempting to set the mining speed of a default pickaxe

smoky anchor
#

If you were to do it somewhere else, you would have no access to that modified ToolComponent, each getTool returns a new copy. As stated in docs.

ebon topaz
#
public class ItemBuilder {
    private final ItemStack item;
    private final ItemMeta meta;
    private final ToolComponent tool;


    public ItemBuilder(Material m, int amount){
        item = new ItemStack(m, amount);
        meta = item.getItemMeta();
        tool = meta.getTool();
        getLogger().severe(String.valueOf(tool.getDefaultMiningSpeed()));
    }

    public ItemBuilder setItemName(String name){
        meta.setItemName(name);
        return this;
    }

    public ItemBuilder setMaxDurability(int durability){
        Damageable damageable = (Damageable) meta;
        damageable.setMaxDamage(durability);
        return this;
    }

    public ItemBuilder setMiningSpeed(double speed){
        tool.setDefaultMiningSpeed((float) speed);
        return this;
    }

    public ItemStack build(){
        getLogger().severe(String.valueOf(tool.getDefaultMiningSpeed()));
        meta.setTool(tool);
        item.setItemMeta(meta);
        return item;
    }
}
smoky anchor
ebon topaz
#

when i get the pickaxes tool component there is nothing set such as the blocks it can break

smoky anchor
#

ok, your ItemBuilder looks correct.
You can still try using the attribute, I do believe there is a way of getting default attributes, so overriding them should not be much problem.

ebon topaz
#

yeah its looking like the attribute way is the easier way

glossy laurel
#

Guys, I want to have an object (of a class that doesnt implement AutoCloseable) saved in an array, but when I access that object via a method I want it to return a class that has the same methods as the first class but it also implements AutoCloseable. Is that possible?

chrome beacon
#

xy? Why do you want to do it that way?

glossy laurel
#

cuz the only way I can imagine that is breaking inheritence logic lol

eternal oxide
#

So long as you use a getter you can cast it

glossy laurel
#

like, that's not possible right?

eternal oxide
#

You specified no limitations in parent/child design

glossy laurel
#

well thats how I imagine it should be done

ebon topaz
#
for  (AttributeModifier am : meta.getAttributeModifiers(Attribute.MINING_EFFICIENCY))
  getLogger().severe(am.getName());

Cannot invoke "java.util.Collection.iterator()" because the return value of "org.bukkit.inventory.meta.ItemMeta.getAttributeModifiers(org.bukkit.attribute.Attribute)" is null

eternal oxide
#

Why do you want one auto... and the other not?

glossy laurel
ebon topaz
#

im checking a pickaxe though

smoky anchor
smoky anchor
#

Well, you're sorta correct, I jumped the gun
You need to get the default attributes of the item

glossy laurel
eternal oxide
#

I see no reason for it

glossy laurel
#

fr

eternal oxide
#

Why not just have it auto... it makes no difference if it implements and is not used

glossy laurel
#

warning

#

ong

#

yeah I can just supress it

#

ig

#

hm

eternal oxide
#

you are doing all this to avoid an IDE warnign of unused methods?

glossy laurel
#

how safe is .clone()

#

can I use it out of the box

eternal oxide
#

depends on your Object

glossy laurel
#

which parts of it specifically?

eternal oxide
#

what field types it has

#

mostly its quite safe

glossy laurel
#

what field types are bad

eternal oxide
#

Can't remember. Its been many years since I used cloneable

glossy laurel
#

alr thx

hazy parrot
#

just use copy constructor

#

whole cloneable api is shit

ebon topaz
glossy laurel
eternal oxide
#

clone is fine, at least it does a shallow copy so will not clone other object references

#

I've done both in the past and it really depends on your object and requirements

hazy parrot
#

effective java have a good chapter about it

smoky anchor
hazy parrot
#

Given all the problems associated with Cloneable, new interfaces should not
extend it, and new extendable classes should not implement it. While it’s less
harmful for final classes to implement Cloneable, this should be viewed as a performance optimization, reserved for the rare cases where it is justified (Item 67).
As a rule, copy functionality is best provided by constructors or factories. A notable exception to this rule is arrays, which are best copied with the clone method.

upper hazel
#

Is there any attitude among the plugin development community towards <nullException vs null check> ? which is better?

eternal oxide
#

check over Exception. Exceptions shoudl not be used to control teh flow of code

#

at least that was teh idea a few years ago, unless its changed

upper hazel
#

“Nullexception” is less productive than ‘if’ but if I make an api it gives the convenience of understanding the error for api users

#

idk what to do

#

especially for intermediate objects

smoky anchor
#

I think it's better to yeet an error when user does something wrong than to just silently fail and leave the user to wonder what went wrong. In the API case.

upper hazel
#

so many factors

slender elbow
#

if you are making an api that its method mustn't take null arguments then do note in the javadoc that it throws NPE if the params are null and just slap a Objects.requireNonNull(foo, "foo is null"); at the beginning

#

if null is a valid argument value then annotate the parameter with some @Nullable annotation and handle that as a value

upper hazel
#

When a programming language like Kotlin, syntactically adapted to Java, becomes available...

#

translator be like:

smoky anchor
#

what specifically do you want ?
The nullability thing is part of valhalla and will come some day

upper hazel
#

The more I live, the more I want to make a java analog, but not like Kotlin.

#

but i gess this very hard

smoky anchor
#

Yup

cedar turtle
#

is there something in the spigot api to query the current world of offline players without touching every single player file?

eternal oxide
#

no

cedar turtle
#

and what is the best way to search through each individual file?

warm mica
#

you'd probably have to create your own personal database for that for tracking that

cedar turtle
#

Exactly, I would like to know the world from all offline players who have ever been on the server

upper hazel
chrome beacon
#

The resource key of the world to get

upper hazel
#

why it's not tied to the player himself.

cedar turtle
chrome beacon
#

You're getting it from the server

warm mica
cedar turtle
warm mica
cedar turtle
#

but that only returns the player name

chrome beacon
#

What data do you want?

cedar turtle
#

the world on which all offline players are located

chrome beacon
#

Use getLocation

kind hatch
#

You can get that info from the OfflinePlayer object.

#

Oh hey, I added that method. lol

cedar turtle
#

So I don't have to read out every single player file with NBT? As I said, it's about old data

kind hatch
#

Unless you need more data that the world they are in, no.

#

You can just iterate over #getOfflinePlayers() and use #getLocation().getWorld().getName();

cedar turtle
#

okay thanks, I'll give that a try

fossil cypress
#

Does anyone know how to create large explosion particles now? I only see explosion in modern versions and explosion emitter which was huge, but what happened with large?

chrome beacon
#

poof -> explosion -> explosion emitter

#

at least judging by the Minecraft wiki

fossil cypress
#

I tried explosion and that’s too small and not how large explosion used to be. It would suck if I only have those two, but I’ll compare them later

cedar turtle
glad prawn
#

Because they are not online?

chrome beacon
#

getPlayer only works for online players

#

Call getLocation directly on the offline player

sonic goblet
#

They should be the same size between versions I don’t think they modified that

kind hatch
cedar turtle
worldly ingot
#

I don't think hasPlayedBefore() will ever be false because getOfflinePlayers() is going to get a list of players that have played on your server

#

Otherwise looks fine

young knoll
#

What if I delete the player data files without deleting the player cache!!!!

fossil cypress
cedar turtle
eternal oxide
#

IF you have a LOT of players, yes

#

depends what you are going to use it for

worldly ingot
#

tbh I'd do it async anyways. It does lots of file IO

slender elbow
#

you can also not consent for it to do file io

#

very good strategy

worldly ingot
#

Just say no and it legally can't do IO

cedar turtle
# slender elbow you can also not consent for it to do file io

I didn't understand that correctly. So I mainly need it to know who is on it if I want to renew a world. Or recently when I changed a multiinv plugin that I could inform players to go into a world to not lose the inventory. I hope that makes some kind of sense 🙈

desert aspen
#

How can i check if a player is damaged by intentional game design?

#

intentional game design is not on .DamageCause

sullen marlin
#

What is intentional game design???

blazing ocean
#

bed explosion

chrome beacon
#

Bed in nether or respawn anchor in overworld

chrome beacon
desert aspen
#

thanks

cedar turtle
kind hatch
blazing ocean
#

i keep forgetting it isn't 2024 anymore

cedar turtle
#

then thank you for that 👍

lusty wolf
#

looking for a free "skript" developer if anyone can help me out dm me

blazing ocean
#

?services

undone axleBOT
cedar turtle
kind hatch
#

It's a read only operation, so no, you cannot change the location of the offline player.
Not sure what you mean by that second question.

#

Setting the player location could be added in another PR, but I feel like there are more challenges/things to consider with an addition like that.

cedar turtle
#

there is also no other method to change the location of an offline player? with the second question I meant dependencies such as a multi inv plugin. That this is also taken into account when changing the location.

pseudo hazel
#

best way is to just move the player when they log in imo

slender elbow
#

^ in the PlayerSpawnLocationEvent

cedar turtle
#

mh okay thanks

kind hatch
zenith bobcat
#

Hi everyone,

I’m currently trying to understand how the underlying Minecraft and Bukkit code works by going through a stack trace to see what’s being called in the background. While doing this, I noticed something strange: the line numbers in the stack trace don’t match the lines in the decompiled code.

blazing ocean
#

yeah the decompiler has some artifacts, especially the header comment

#

(that's for VF at least)

zenith bobcat
blazing ocean
#

pretty sure they're in the bytecode somewhere

zenith bobcat
blazing ocean
#

just click on the class in IJ

#

it should navigate to the right line number

#

and why not just clone the spigot repo and apply patches?

zenith bobcat
chrome beacon
#

The bytecode contains line numbers

#

but decompilers won't try to match the code exactly

#

well match the line numbers*

zenith bobcat
#

but why is the decompiled code at the wrong linenumbers

chrome beacon
#

Because it's decompiled

#

It tries to generate java code that matches the behavior of the bytecode

#

It does not have access to the source code so can't it know what types of syntax sugar you used when compiling

#

or if you decided to combine multiple lines of code

zenith bobcat
#

so it don´t accually contain the line numbers

chrome beacon
#

The bytecode does contain line numbers

graceful meadow
#

Just run the BuildTools and load spigot project in IJ

zenith bobcat
chrome beacon
#

It contains the line numbers of the source

#

yes

#

That's how java knows what to put in the StackTraces

desert aspen
#

https://paste.md-5.net/tasuzezufo.cs Trying to make that explosions of end crystals, tnt carts, beds and respawn anchors doesn't work, i tried with cancel the explosion but doesn't work, nothing show up in console, and it still explode

chrome beacon
#

Did you register the listener

proper cobalt
#

why is my IDE not saying where???

#

how do i check all errors in my proj

desert aspen
rough ibex
#

looks like (!)

chrome beacon
# desert aspen Yes

Note that due to the nature of explosions, BlockEvent.getBlock() will always be an air block. getExplodedBlockState() should be used to get information about the block state that exploded.
From Javadoc

#

also why are you checking blockList for beds

#

You want to check what exploded not what's being broken by the explosion

desert aspen
desert aspen
#

https://paste.md-5.net/ogoxutegoc.java trying to make when a player die it gets resistance, and when attacks a player it removes the resistance, the problem is, when i respawn i get the resistance removed

chrome beacon
#

Give the effect after the player has respawned

grave laurel
#

Hey, so I have a little problem that the world is null but the world really does exist. Could anybody help me?

Based on the context from my codebase, it seems that I am having an issue with the teleportToLastCheckPoint method in the CheckPointSystem class. The issue is that the teleportToLastCheckPoint method is trying to teleport a player to a location that has a null world.

Main Class: https://hastebin.com/share/tejosoqaya.java
CheckPointSystem: https://hastebin.com/share/gazifimoyo.java
MoveListener: https://hastebin.com/share/rubupivamo.csharp

chrome beacon
kind hatch
#

That's default behavior no?

grave laurel
sullen marlin
#

Yes that is default

#

What's your plugin.yml

grave laurel
#

name: Takeshi
version: '${project.version}'
main: de.silvan.takeshi.Takeshi
api-version: '1.20'

commands:
warp:
w:
welt:
world:
lobby:
l:
hub:
watch:
startflappybird:
start:
joingame:

#

the plugin/server is actually in the 1.21 but that didn't seem to have caused any problems up to this point

grave laurel
sullen marlin
#

Not sure, code looks ok to me

#

Are you sure your plugin jar is up to date and that's what the log says is the issue

eternal oxide
#

I see no loading of the world TAKESHI_1. Is it the default world of the server?

#

If its a world loaded by some other plugin you need a depends in your plugin.yml

shy belfry
#

Hello I was hoping to get some help with this error https://pastebin.com/93PWJMKz Im getting when building for 1.21.4. Same pom sub versions will work just fine with 1.21.1 . Pom is as follows https://pastebin.com/WtZFsHHq. Never seen an error like that before any help understanding the issue is appreciated

kind hatch
#

?paste the full pom

undone axleBOT
shy belfry
kind hatch
#

Could you please provide the parent pom?

shy belfry
#

sure

kind hatch
#

Do you know what maven version you are using?

wet breach
shy belfry
shy belfry
kind hatch
wet breach
#

Or you someone new

shy belfry
shy belfry
kind hatch
#

Maven now blocks insecure http repos by default in 3.8.1.

You can either change it to an https repo (if it's available)
Or you can add an exception to your .m2 settings.xml

wet breach
#

At least you can be happy to know at least one person hasnt forgotten you uwu

shy belfry
kind hatch
#
<repository>
  <id>mikeprim-repo</id>
  <url>http://repo.mikeprimm.com/</url>
</repository>

This repo right here is what's causing the error. :p

#

And I guess the vault-repo

wet breach
#

Vault repo changed

#

And didnt know mike still had one

shy belfry
#

which umm if I have the vault repo here Im not sure why

remote swallow
shy belfry
#

I cant think of anything staffplus would need from vault

wet breach
#

Perms

remote swallow
#

ive found ur issue

shy belfry
#

uses bukkits built in permission methods \

remote swallow
#

missing a colon

wet breach
#

Vault allows centralized permissions access

remote swallow
#

might be the issue that ss is throwing for

kind hatch
remote swallow
#

i just read the error and thought, why is that all one word and saw it

shy belfry
# remote swallow

gotta kidding me right? Did I screw up when I copied and then pasted and changed ver numbers from 1.21.1

wet breach
#

Lol

remote swallow
#

its always the simple issues that cause the most trouble

shy belfry
#

it's always a stupid mistake that causes you the most trouble now to twiddle my thumbs for a minuet while it builds and hope for no red

#

aye build success thanks y'all

remote swallow
#

we never expect simple issues anymore, np

shy belfry
#

here I was deleting my 1.21.4 build folder in m2 home and rebuilding thinking maybe I forgot a command argument

remote swallow
#

i was gonna say did you run bt with --remapped and then read the error and saw it and thought that might cause a few issues

kind hatch
#

I think I saw someone use maven variables for that section so they wouldn't have to change the version numbers every time.

#

Might try to set that up in my multi-module projects. :3

shy belfry
#

I would forget it if I didnt make a build script where I just type the version number and it goes

#

versionBumper.sh is what I have for staffplus a little script I made with the help of google lets me type what version I want staffplus to be and it goes through and does it so I dont have to go thru 15 modules and do it by hand

remote swallow
#

afaik you could do something like ```xml
<properties>
<minecraft.version>1.21.4</minecraft.version>
</properties>

<srgIn>org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>

#

then just use ${minecraft.version} everywhere instead of changing 50 variables

shy belfry
#

for that yes but I need each module to have the same project number as far as I know

#

so script it

kind hatch
remote swallow
#

the R0.1 bit never changes

kind hatch
#

It used to

remote swallow
#

i dont think thats ever not be R0.1 since like devbukkit days

shy belfry
#

I think it did for like 1.7 and 1.9

remote swallow
#

they dont get any fancy nms so it should be fine to use that or something along those lines

wet breach
#

I will show you

shy belfry
#
``` is how I do it now the script just goes thru all subfolders \
wet breach
#

So the way i have it setup it currently changes version number in plugin.yml to be same as pom version

shy belfry
#

well that certainly seems easier

wet breach
#

It is flexible in its configuration too

#

You change multiple files in multiple directories and accepts regex

shy belfry
#

Imma have to go look into that plugin

wet breach
#

Token in my example is what it looks for. In this case anywhere it sees maven-version-number it will auto replace

#

You can see my plugin.yml has that specific string lol

wet breach
wide cipher
#

I have this code using org.json ```String decoded = new String(Base64.getDecoder().decode(base64));
JSONObject jsonObject = null;
String url = null;
try {
jsonObject = new JSONObject(decoded);
// Extract the "textures" JSONObject
JSONObject textures = jsonObject.getJSONObject("textures");

        // Extract the "SKIN" JSONObject and then the "url"
        url = textures.getJSONObject("SKIN").getString("url");
    } catch (JSONException e) {
        throw new RuntimeException(e);
    }
    return new URL(url);``` how can i change it to do the same with Gson?
#

wait nvm i think i got it

mortal hare
#

who tagged me

wet breach
#

Lol

sleek island
#

w8

#

guys what happened in 1.21.4 to the packet ClientboundAddPlayerPacket?

young knoll
#

It’s part of addEntity now

sleek island
#

what?

#

alr

#

ill take a look

young knoll
#

They just merged the two packets

sleek island
#

hm

#

alr ty

#

well

#

i just inputed a serverplayer

#

into the packets field for an entity

#

uhm sorry to bother once again but what is a serverentity in nms?

sleek island
#

oh

#

tthats the website ive been looking for for the past 3 hours

remote swallow
#

?mappings is the main site

undone axleBOT
sleek island
#

alr ty

remote swallow
#

im guessing CraftPlayer#getHandle should return the entity you need

sleek island
#

thank you very much

remote swallow
#

just as a thing, id recommend using a lamda for those loops and doing all of those in 1 loop rather then 3 differnet loops

sleek island
#

ok thank you i will do that

unborn hollow
#

is there a way to negate the italicization in setDisplayName() for ItemStacks?

sleek island
#

yea

#

if u use chatcolor.clear

#

thats what i did if i recall correctly

sleek island
worldly ingot
sleek island
#

o mb

unborn hollow
buoyant viper
chrome beacon
#

Missing support for Spigot api methods

#

Like you can't set the item display name with that

#

Unless you're using Paper ofc

nova notch
#

yet another reason to use paper i guess

wraith dragon
#

hey guys, I am currently trying to set a lot of blocks within an area (millions), and I got to the point of using nms chunk sections to do the trick. It is INCREDIBLY fast, however, there is a lighting issue that follows when trying to use it. I tried to mitigate the issue using player.sendBlockChange, but that is just a temporary fix. I found some forum threads and they suggested to update the chunk itself, but all of the methods were outdated. Has anyone else gone through this? Thanks for the help!

buoyant viper
#

the devils work

nova notch
#

your loss

buoyant viper
#

quite frankly i think i lose nothing

river oracle
# nova notch adventure...?

adventure isn't proper on spigot anyways, the only reason its "cursed" is precisely because there is no native integration

#

the entire concept of audiences is a pain in the ass

echo basalt
#

I kinda need to deal with this at work and it's a lot slower than expected so I might be missing something

#

Running on a 6-core 10 year old xeon

#

For some reason multi-threading block pasting makes it like 50% slower than just running workdistro

wraith dragon
#

its pretty insane

#

just the lighting problem

echo basalt
#

I'm only achieving like 300k ish blocks a second which is fairly small for what I'm doing 👀

#

hoping for at least 10 million

wraith dragon
#

this was the guide I refered to

#

the third one

#

nms chunk sections

#

the last one is EVEN faster

#

but its got a lot of cons

#
  • I dont need it that fast lol
echo basalt
#

yeah I'm basically doing that

#

nvm I'm doing #2

wet breach
echo basalt
#

yeah I can prolly use it

#

I'm assuming it has to do with writing directly to either the data palette or nbt files

#

problem is that this cpu's multicore is doodoo and the guys don't want to invest more in the testing network for now

wet breach
#

If you want fastest speed possible you do it with server off and just modify the region files directly

echo basalt
#

because we're like 4 months late

#

We only need these to be in-memory and I'm pretty sure manipulating ram is quicker than packing ram and unpacking it again

wet breach
#

You can easily modify thousands of region files with direct approach

echo basalt
#

Yeah but is it any faster than modifying millions of blocks in another thread

#

because IO is a thing

#

as long as we keep a thread for each chunk section there's no need to lock stuff

wet breach
#

No locking needed if server is off

#

But ssd's are fast

echo basalt
#

IO is still a thing

#

we're CPU-bound not disk bound

#

this is a low-latency scenario

wet breach
#

On average a region file is like 1mb if empty 10mb if filled with somethings

wet breach
#

Its not like your using some pentium

echo basalt
#

we're using a really old xeon

#

with a whopping 6 cores

#

clocked at like 2.3ghz

#

I bet if we switch to a proper ryzen / threadripper it'll do good

#

but that's not my decision

#

BTW this is for pasting +-12.5 million blocks across a ~1100 x 1100 area

wet breach
#

That is plent good to manipulate thousand of files in one go

echo basalt
#

At the moment pasting a 47x47x47 structure takes +- 200ms

wet breach
#

You will hit your ram limit before you bogged the cpu down with region files

echo basalt
#

don't forget we still need to pack data

#

Switching from just queuing stuff to the main thread -> yeeting it to an executorservice increased the pasting time by 100ms

#

which is crazy

#

context switching is not a homie

wet breach
#

Manipulating files is not slow

echo basalt
#

packing a bunch of bytes, compressing etc is a lil

#

slower than just writing data to a data palette

wet breach
#

Not with direct manipulation

echo basalt
#

I disagree but cba arguing with you at 5am on a saturday

wet breach
#

One of these days i will write a test to show you can do millions in matter of seconds

wraith dragon
#

optimization TO THE MAX

echo basalt
#

seconds is a bit too much

#

I need less than that :)

wet breach
#

You need to leverage what the OS can do for you. If you write it properly your limitation is going to be open file handles

#

I wouldnt even use java for the direct approach except to initiate the process

#

But java is sufficient still

#

But your not going to get light speeds out of a computer that isnt using light to process anything

#

But we can get it going fast

#

Anyways, got some tires to do lol

wraith dragon
#

@echo basalt here ya go

#

it might not replicate your situation

#

but here are the profiler stuff

#

tested on 3m blocks

#

1 million per second

#

reset

#

ignore the LearningPlugin

#

thats diff

#

focus on BuilderDelight

echo basalt
#

specs?

wraith dragon
#

wait

#

its an oracle cloud free vps the one with 4 cores ampere

#

and 8gb of ram

echo basalt
#

crazy powerful for a 4 core ampere

wraith dragon
#

I have yet to test it on my mac

echo basalt
#

It'll prob be better

wraith dragon
#

ykw

#

ill test it rn

#

ill let you know asap

wraith dragon
#

this is actually insane

#

tested on m2 macbook

#

8gb still assigned to server

#

24m blocks

#

1m per second

#

0.71 ms

#

ill bump up the speed and check it out again

#

@echo basalt btw, do you have any idea on how to fix the lighting issue?

echo basalt
#

there's a way to tell it to do lighting updates

#

something with the light engine

#

serverLevel.getLightEngine().checkBlock(BlockPos)

#

sumn like that

wraith dragon
#

server keeps crashing now

#

I changed the speed to 10m blocks per second

#

just wont work

buoyant viper
echo basalt
#

as long as it beats this 6 core xeon im good

wraith dragon
#

the lighting also crashes me

#

omg

wet breach
#

Better off having a plugin fix lighting when a chunk loads otherwise you are going to have to load every single chunk and then check all params for light conditions lol

wraith dragon
wet breach
wraith dragon
wet breach
#

With spigot if you use the api, most things that interact with the world like that typically have issues with doing certain things async

#

However in modern versions of mc, light updates are separate from the chunks now and have their own file they get stored in

#

So i cant really say in regards to doing the actual light update fixes lol

sullen marlin
#

Why are there light issues anyway? Isn't there a --recreate option built into the server anyway as well

wet breach
wet breach
wraith dragon
wet breach
#

Uh, should be able to look in the world directory and see a directory i think for lighting similar how entity data is stored separately

wraith dragon
#

Oh alright, ill check it once I get home, thanks for the help btw

wet breach
#

Might be worth investigating that command and how it works internally

#

Might be able to use it somehow for your use case lol

#

Can thank md for that uwu

split gull
#

how do i check if a dog armor item is dyed?

tepid gust
#

Can someone help me with this?
I'm trying to use HikariCP on my Spigot Plugin

java.lang.NoClassDefFoundError: com/zaxxer/hikari/HikariConfig
    at org.craftex.service.MariaDB.init(MariaDB.java:14) ~[?:?]
    at org.craftex.service.MariaDB.getConnection(MariaDB.java:37) ~[?:?]
    at org.craftex.service.CourseDAO.getAllCourses(CourseDAO.java:35) ~[?:?]
    at org.craftex.gamemodeElytra.handler.GameHandler.chooseCourse(GameHandler.java:60) ~[?:?]
    at org.craftex.gamemodeElytra.handler.GameHandler.<init>(GameHandler.java:26) ~[?:?]
    at org.craftex.gamemodeElytra.GamemodeElytra$1.<init>(GamemodeElytra.java:32) ~[?:?]
    at org.craftex.gamemodeElytra.GamemodeElytra.onEnable(GamemodeElytra.java:31) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:267) ~[spigot-api-1.21.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.21.3-R0.1-SNAPSHOT.jar:?]

I'm trying to fix it since yesterday, but nothing works. I tried shading it, I asked ChatGPT, ... Here's my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.craftex</groupId>
    <artifactId>elytra_race</artifactId>
    <version>0.1-BETA</version>
    <packaging>jar</packaging>

    <properties>
        <java.version>21</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.21.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>5.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <version>3.5.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.4.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <relocations>
                                <relocation>
                                    <pattern>com.zaxxer.hikari</pattern>
                                    <shadedPattern>org.craftex.shaded.hikari</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.mariadb</pattern>
                                    <shadedPattern>org.craftex.shaded.mariadb</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

wraith dragon
tepid gust
wraith dragon
#

@echo basalt I found something interesting during my playtest, if set the blocks speed enough, it affects the other player's ping more

#

e.g. I set the blocks reset per second to 1m

#

and their ping went to 1k

#

very odd

split gull
eternal oxide
#

They are identical, both getColor from leatherArmorMeta and getDefaultLeatherColor in ItemFactory

#

However, default is the DEFAULT, it may not be the color you applied

grim hound
#

Any1 knows what's the fastest lib for zlib decompression?

proud badge
#

Just use the built in class

#

It runs the native c library, which is fast

grim hound
proud badge
grim hound
#

Same with zlib

#

Just because java uses a native c lib doesn't mean that there doesn't exist a faster alternative

eternal oxide
#

Why? Are you having a performance issue using compression?

grim hound
#

Just searching for alternatives

#

Like Velocity's lib deflate

upper hazel
#

in minecraft exists custom bars?

#

i was see smth liike this when found plugin for weather

scarlet gate
#

Is it possible to set a default permission for something like plugin.use.*, where * applies to any checked sub-permissions?

eternal oxide
#

it depends

#

Wildcards are not supported by Bukkit natively

#

So you need a Permission plugin that can handle wildcards

#

If you are talkiung about Just your own plugin, then no, you can not create a native wildcard for all variants

#

You could process wildcards within your own plugin though

#

check if the Player has plugin.use.* directly so cover any sub permission

#

if sub permissions are unknown you have to do it yourself

pseudo hazel
#

or just add a permission for plugin.use.all or something

eternal oxide
#

same as using *.

pseudo hazel
#

yeah but you arent fooling yourself

eternal oxide
#

you would still have to check for it

#

LuckPerms handles Wildcards but I don't like recommending it as it hacks Bukkit to do so. GroupManager handles wildcards if you query the plugin directly or check via vault.

#

But if you are writing a plugin that needs to handle wildcards you must do it yourself for compatability

slender elbow
#

I think that as an admin there is a lot of value in a plug and play solution for weighted permission inheritance, context resolution and wildcard resolving without having to scour plugins specifically having to handle those features which might not there be alternatives doing that in the market

eternal oxide
#

Yes, my only reason against LP is that it changes the native behavior of permissions.

frail willow
eternal oxide
#

?whereami

frail willow
#

The one I have issues with is Bungeecord. My Velocity to paper works fine

#

Is there a dedicated channel for Bungeecord?

eternal oxide
#

yes, this is for both spigot and bungee

#

Many will ignore question which reference paper as its behavior is not always the same as spigots

#

If the issue is repeatable with a spigot server you are likely to get more answers

#

Build against the lowest API you want to support

#

You can use Modules to support higher API versions if you want

#

but the base shoudl be the lowest API version

#

always latest, but depending on what you are doing back as far as 1.18

#

very few servers/players are on lower versions

#

3.7% of servers run 1.8

#

depends what plugin you want to write

#

then you can write it for 1.8 easily

#

1.8 will run on all versions

#

you only need the API so just a normal maven setup

#

?maven

undone axleBOT
eternal oxide
#

yes, but change teh version to 1.8 etc

#

not 1.21.1

#

looks fine

#

1.8

blazing ocean
#

api-version was introduced in 1.13

eternal oxide
#

yep, it will be ignored in prior versions, but its required to prevent a nag warning in newer versions

blazing ocean
#

why not 1.13

quaint mantle
#

Assign the items with unique ids and check if they are similar

chrome beacon
#

Client can skip on sending the inventory close packet

#

and then they open the backpack again

#

Triggering the close event but that's too late the new inventory has already been opened

smoky anchor
#

If you're in some recent version, there is a component to hide tooltips. Not sure how/if it's done in the API

remote swallow
old kettle
#

thanks for the help guys

harsh surge
#

`package me.kelz.glitched;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

public final class Glitched extends JavaPlugin {

@Override
public void onEnable() {
    // Plugin startup logic

    getServer().getPluginManager().registerEvents(new JoinLeaveListener(), this);

}

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    return super.onCommand(sender, command, label, args);


    return true;
}

}
`

Not annotated parameter overrides @NotNull parameter

Doesn anyone know what this means @NotNull parameter is highlited for sender, command, label and args

remote swallow
#

its telling you that the method params dont have @NotNull but the method its overriding does

harsh surge
#

im new i have no idea what that means

chrome beacon
#

I already told you what to do like a week ago?

harsh surge
#

Ik but it didnt work and then i quit

#

cause it had been 4 hours on it

chrome beacon
#

All you need to do is add the annotations

#

Or just ignore it

unborn hollow
#

are there any resources for CustomModelDataComponent() outside of the javadocs? i'm really unsure how to set it up

chrome beacon
#

What about it are you unsure about?

harsh surge
#

I feel like an idiot

#

i was replacing the things with notnull

#

not annotating

unborn hollow
chrome beacon
#

getCustomModelDataComponent -> getStrings() -> add (to new list) -> setStrings -> setCustomModelDataComponent

#

or just set strings directly if you don't care about keeping anything that's already there

unborn hollow
#

kk i'll try that out

#

tyvm

slender elbow
#

item model 🙏

#

items are so cool now

chrome beacon
#

Yeah you can make some cool stuff

unborn hollow
chrome beacon
#

You forgot to set the model data

#

Smth like

var modelData = meta.getCustomModelDataComponent();
modelData.setStrings(List.of("bat"));
meta.setCustomModelDataComponent(modelData);
itemStack.setItemMeta(meta);
unborn hollow
#

something went wrong hmm

#

the vanilla command "/give @p mace[minecraft:custom_model_data={strings:['bat']}]" gave me the proper item but not spigot

#

checking the data from the spigot generated one says it has 0 strings attached to it

summer scroll
#

What is that even supposed to do lmao, what is bat, is that like a custom texture?

unborn hollow
#

bat is just the identifying string in the resource pack files to render it as a different texture if the item in-game has it

summer scroll
#

Ah interesting

#

Could you send your code again please

unborn hollow
# summer scroll Could you send your code again please
ItemMeta meta = itemStack.getItemMeta();

List<String> strings = new ArrayList<String>();
strings.add("bat");

var modelData = meta.getCustomModelDataComponent();
modelData.setStrings(List.of("bat"));
meta.setCustomModelDataComponent(modelData);
itemStack.setItemMeta(meta);

event.getPlayer().getInventory().addItem(itemStack);```
summer scroll
#

Looks correct

unborn hollow
#

that's so weird because the game says the item generated has no string apart of its custom model data

#

"Felinkaa has the following entity data: {"minecraft:custom_model_data":{}}"

summer scroll
#

I wonder why getCustomModelDataComponent() is non-null however you can pass null to setCustomModelDataComponent

slender elbow
#

because ItemMeta is a highly flexible system

unborn hollow
#

hopefully i can find a way for it to work this is so frustrating

summer scroll
#

If I pass null it would just return to its original form?

slender elbow
#

no, it'll create a new, empty one

chrome beacon
#

null would just remove it

slender elbow
#

that's why you also check for hasFooBar

summer scroll
#

Oh remove it okay

unborn hollow
harsh surge
#

Whats the import to import GENERIC_MAX_HEALTH

chrome beacon
#

org.bukkit.attribute.Attribute

kind hatch
#

Attribute#MAX_HEALTH

chrome beacon
#

^ if you're not on an old version

harsh surge
#

im on 1.21.3

#

ive imported it but it cant resolve

chrome beacon
harsh surge
#

for both

summer scroll
harsh surge
#

im using org.bukkit.attribute.Attribute

summer scroll
#

IntelliJ has issues with that, kinda annoying

chrome beacon
#

Update Intellij if it's outdated

harsh surge
chrome beacon
#

(No idea why it's so common to run 1 year+ old versions)

harsh surge
#

wait it was git thats updating

#

im on 2024.2.4

#

for inteljj

chrome beacon
#

2024.3.1.1 is the latest

harsh surge
#

ah

turbid crown
#

and there's a way to do that:

For example, I have two worlds

one ordinary world

the second one: donate_world

and it is possible to make it so that in donate_world and world, there were separate homes for example in world to work the command /home

and in donate_world the command /dhome

and each command would have its own functionality?

harsh surge
#

Still got the prob

turbid crown
#

which one?

harsh surge
#

i was on bout my GENERIC_MAX_HEALTH not working

#

i was told 2 update and it still not working

chrome beacon
#

It's just MAX_HEALTH now

harsh surge
#

ohhhhh

chrome beacon
#

You can keep your homes in a map

turbid crown
#

like, I need the hams to be separate in each world.

like, I'm gonna have donate_world with no wipes.

and the donate_world will be wiped.

I need to make sure that after a vyp, all the hams in the world are deleted.

but in donate_world they don't get deleted.

can this be done with one plugin essentials?

chrome beacon
#

If you're not making a plugin this is the wrong channel

harsh surge
#

Is there a way to make the players screen have a purple tint overlay?

turbid crown
#

Oh, I apologize, I'm in the wrong place.

chrome beacon
#

?fork

undone axleBOT
#

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.

remote swallow
#

?howold 1.14.4

undone axleBOT
spiral light
harsh surge
#

import org.bukkit.boss.BossBar.Color;
import org.bukkit.boss.BossBar.Style;

whats the correct imports for these?

chrome beacon
#

Are you using GPT or smth 💀

harsh surge
#

no im using what i think will work

#

as

import org.bukkit.boss.BossBar;

this works

chrome beacon
#

Don't write your imports by hand

harsh surge
#

so a .colour might work

chrome beacon
#

Let your IDE handle it

harsh surge
#

ok

chrome beacon
#

And use the javadoc

#

?jd-s

undone axleBOT
chrome beacon
#

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

sleek island
sleek island
unborn hollow
#
ItemMeta meta = itemStack.getItemMeta();

List<String> strings = new ArrayList<String>();
strings.add("bat");

var modelData = meta.getCustomModelDataComponent();
modelData.setStrings(List.of("bat"));
meta.setCustomModelDataComponent(modelData);
itemStack.setItemMeta(meta);

event.getPlayer().getInventory().addItem(itemStack);```
whenever i run this, i get an item with custom model data of "{}" and not "{strings:['bat']}"
does anyone know why?
chrome beacon
unborn hollow
chrome beacon
#

.0?

#

.1

#

.2

#

etc

#

Actually just send the output from /version

unborn hollow
#

1.21.4-R0.1-SNAPSHOT

unborn hollow
chrome beacon
#

Send the full output

unborn hollow
# chrome beacon Send the full output

"This server is running CraftBukkit version 4416-Spigot-33ece3-c905a71 (MC: 1.21.4) (Implementing API version 1.21.4-R0.1-SNAPSHOT) You are 2 version(s) behind"

wise chasm
#

Hi, I'm having a player spectate a blockdisplay that is teleporting with the .setTeleportDuration() method.
During the blockdisplay movement, if it's too quick, the player triggers 'moved too quickly' in the console, is there any way to disable this for the duration the player is spectating the blockdisplay?

Through nms or something?

EDIT: I am using buildtools 1.21.4 mojang mappings

sleek island
chrome beacon
sleek island
#

yes

#

it allows me to use it in development

#

but loading it into my server

#

causes it to not load the plugin at all

chrome beacon
#

Are you sure you're using maven to compile

sleek island
#

i am

chrome beacon
#

Do not use Artifacts

sleek island
#

ok

chrome beacon
#

So you weren't using maven

sleek island
#

ty bro

#

im just dumb

#

maybe i should stick to c

quasi sundial
#

why is ItemMeta#getItemName() deprecated and how should i get an item's name instead?

quasi sundial
#

getDisplayName is also deprecated

#

oh nvm its just itemMeta#displayName

young knoll
#

You aren’t using the spigot api

chrome beacon
quasi sundial
#

oh is that just on paper?

#

mb i should go back to spigot

pseudo hazel
#

why

#

if you use paper, they also have a discord

harsh surge
#

Can someone tell me how people make their menu gui's using a chest?

chrome beacon
#

?gui

harsh surge
#

thanks

amber fjord
#

can anyone help me use nms and nbt with my plugin? I've been through almost every tutorial I can and intellij is still not cooperating with the imports. I think I'm missing a step somewhere but I genuinely have no idea what it is. DM me if someone can help so I can give more specific details

#

if it helps, what I'm trying to do is create custom skull texture meta but I can't import nms or nbt anything to create it.

chrome beacon
amber fjord
#

its on 1.21.1

chrome beacon
#

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

amber fjord
#

tysm

#

this is a huge help thank you!

golden turret
#

how can i keep a chunk to fully tick? adding a ticket is not making crops to tick

ancient wasp
#

I'm currently experimenting with text displays to make custom nametags.

Everything works fine, but when using the see through property it makes the nametag very visible through walls. When disabling see through you can't see it through walls at all.

Is there a way to make it so the text displays work just like player nametags, where it becomes transparent when viewed from behind a wall?

https://media.discordapp.net/attachments/1242617818214694944/1325140237143511140/image.png?ex=677ab484&is=67796304&hm=ea46c74b0154016d14fc32d44133e42fb014e051f27453b0ecb658d8f78e455f&=&format=webp&quality=lossless&width=1661&height=935

timid berry
#

what event handels throwing of lingering potions?

#

i want to disable throwing them

#

there use at all

sonic goblet
#

PlayerInteractEvent

keen acorn
rough ibex
#

add a tab completor method

mortal vortex
#

Hello. I've seen a claims plugin in the past, that uses particles on the ground to outline an area. It creates like a square perimiter of the area using particles.

Any idea how this is done, other than just recursively creating particles?

rough ibex
#

it doesnt need to be recursive

#

just loop over the perimeter

#

you can make a lot of optimizations but only doing particles within the players radius and not doing it so fast

cosmic elk
#

would anyone know any good way to make custom enchants with just the 1.21.1 API?

river oracle
#

Can read about pdc here

#

?pdc

cosmic elk
rough ibex
#

Why?

cosmic elk
#

its just alot more to handle than just adding an enchant, removing lore mainly some items with lore will be added

cosmic elk
river oracle
#

That method is broken and relied on bad api behavior anyways

#

It's either a datapack, the lore pdc method or registries pick your poison

summer scroll
#

Ah yeah

potent atlas
#

Can I get some help please? I need to scale an ender dragon down but it's not working. I could do it on my datapack so is there a way on a plugin? I have:
entity.getAttribute(Attribute.SCALE).setBaseValue(SCALE); but nothing happens. tried a few values for SCALE like 0.7 with no luck
I saw a bug report over a year old so I would think it was fixed by now

rough ibex
#

is the bug report RESOLVED or FIXED

potent atlas
#

oh it says resolved o:

#

so it should be working D:

#

do you have any ideas?

somber walrus
#

My code can't seem to access the org.bukkit.#.# things, any way to fix this?

#

It's also spamming cannot find symbol

sullen marlin
#

What build system are you using?

#

What have you done so far?

somber walrus
somber walrus
#

Now it's saying package org.bukkit.entity does not exist, this is what there is: import org.bukkit.entity.EntityType;

somber walrus
#

If it helps, im using IntelliJ IDEA

wet breach
blazing ocean
#

also update IJ to at least 2024.x

somber walrus
pliant topaz
#

its now done with components, custom model data got ditched by custom model or something

#

i found a reddit post 🥲

#

there seem to ve a few good tutorials on youtube

#

ah okay, so there 2 different things

pliant topaz
#

up to 1.21.3 its pretty simple, sinxe 1.21.4 it changed a lot

#
{
    "parent": "minecraft:item/handheld",
    "textures": {
        "layer0": "minecraft:item/item_id"
    },
    "overrides": [
        { "predicate": { "custom_model_data": 1 }, "model": "namespace:item/model_name" }
    ]
}
eternal oxide
#

PreLogin will be the first contact

#

nothing exists in 1.8

#

you can use the scheduler though

#

in your plugins onEnable schedule a task to run 1 tick later.

#

it will run in the next tick that the server is fully started

#

yes

ebon topaz
#
@EventHandler
public void onPrepareAnvil(PrepareAnvilEvent e) {
    AnvilInventory inventory = e.getInventory();

    ItemStack item = inventory.getItem(0);

    String data = item.getItemMeta().getPersistentDataContainer().get(key, PersistentDataType.STRING);

    if ("Hammer".equals(data)) {
        getLogger().severe("Trying to enchant Hammer using an anvil");
    }
}

im getting a bunch of errors saying item is null?

#
@EventHandler
public void onEnchantItem(PrepareItemEnchantEvent e) {
    EnchantingInventory inventory = (EnchantingInventory) e.getInventory();

    ItemStack item = inventory.getItem(0);

    String data = item.getItemMeta().getPersistentDataContainer().get(key, PersistentDataType.STRING);

    if ("Hammer".equals(data)) {
        getLogger().severe("Trying to enchant Hammer using a enchantment table");
    }
}

also this prepareitemenchantevent gets fired 3 times when you put a item in?

chrome beacon
#

getItemMeta returns a copy

#

and I believe getPersistentDataContainer does so too

#

so make sure you've set them correctly

young knoll
#

It doesn’t

#

Only meta

chrome beacon
#

👍 Good to know

young knoll
ebon topaz
young knoll
#

¯_(ツ)_/¯

ebon topaz
#

btw the enchant event doesnt say item is null only the anvil event

young knoll
#

Yeah the anvil event fires whenever the inventory changes

#

So the items may be null

ebon topaz
#

so basically i just need to make sure the item isnt null then it should be fine

somber walrus
#

Im always getting this error: java: error: release version 21 not supported

Module NightVision SDK 17 is not compatible with the source version 21.

Upgrade Module SDK in project settings to 21 or higher. Open project settings. All things have been set to Java 17, what's this?

ebon topaz
#

my end goal for the enchant event is to change the enchant offered if there is forture

pliant topaz
#

since i think 1.20 or something mc uses java 21

somber walrus
weak gust
twilit coral
weak gust
weak gust
chrome beacon
#

A good source of information is the Minecraft wiki

twilit coral
#

what is shield stunning and what have you tried so far

vague dawn
#

Can someone help me? Out of nowhere... no changes were made in code or etc

twilit coral
#

so is this a configuration thing? or are you trying to develop a plugin; if it's the former go to help server

upper hazel
#

i try add bukkit api module for 1.21

#

but constructor module not can find him

chrome beacon
#

Did you reload maven

upper hazel
#

yes

#

21 version not use nms

#

he use api

blazing ocean
#

well, have you added it to your project

glossy laurel
blazing ocean
#

(I have no idea how maven works)

glossy laurel
#

and why did u add dependencies of 2 versions

upper hazel
glossy laurel
upper hazel
#

this multi module system

#

some modules from other version use nms

#

but 1.21 will use protocolLib so

#

21 version will use only spigot api

#

but constructor not can find this module

#

but this module exists...

blazing ocean
#

have you added the module to the project

upper hazel
blazing ocean
#

in your parent pom

upper hazel
#

yes

blazing ocean
#

have you reloaded maven

upper hazel
#

yes

#

but parent think this not spigot module

#

constructor not can find him

#

this module exists just like package

#

this version disappeared from the module gui wtf

remote swallow
#

install that module