#help-development

1 messages Β· Page 931 of 1

lilac dagger
#

but you only do it for enchants

acoustic pendant
#

only*

#

i mean

#

let me try

acoustic pendant
ivory sleet
#

thats alright

#

tho isnt it more handy to just have a set of constants?

ocean hollow
#

hmm, the same thing will happen

ivory sleet
#

well now u have to access the field namespacedKey everytime u need the actual namespacedkey object

ocean hollow
#

oh it’s real, okay

lilac dagger
#

can i see the code?

acoustic pendant
#

do you want full code?

lilac dagger
#

yeah

vivid thunder
#

If I need to damage a player with p.damage, what would be the best way to get the player that last hit the player?
Does Player#getKiller() always return the damager or just when killed?
Player#getLastDamageCause()#getDamageSource() seems to be one way as well.

acoustic pendant
lilac dagger
#

plugin.items.getConfig().set("Rewards." + args[1] + ".enchantments", plugin.items.getConfig().createSection("Rewards." + args[1] + ".enchantments"));

#

maybe try this?

#

i think it shiuld work?

acoustic pendant
#

I mean, i'll try

lilac dagger
#

there's no way

#

the path is wrong then

acoustic pendant
#

I can send you a video if u wish

acoustic pendant
lilac dagger
#

i think just plugin.items.getConfig().createSection("Rewards." + args[1] + ".enchantments") should do it

acoustic pendant
#

I mean, if I have an enchantment in the item, it works, and is the same path

lilac dagger
#

maybe the args[1] is wrong?

acoustic pendant
#

no

acoustic pendant
#

@lilac dagger did some debuging and the else is never firing πŸ’€

lilac dagger
#

there you go

acoustic pendant
lilac dagger
#

maybe use is empty

#

instead

acoustic pendant
#

oh

#

makes sense

#

ty

tacit arrow
#

Hey so when i do left click in game while holding item it does an ability. (Works good)
But the issue is when i want to drop the item it triggers left click and makes ability work.
(its because of animnation packet from what ive seen on fourms)
I am wondering if theres anyway to make it not do that or do i have to mess around with packets?

tall dragon
grave laurel
#

Is there any where to give a player the trident impaling effect while they're gliding?

tacit arrow
# tall dragon show the code that triggers it
    @EventHandler
    public void onUseOfAbility(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        if (player.getInventory().getItemInMainHand().getType().equals(Material.STICK)) {
            if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
                player.sendMessage("The wand of truth has spoken!");
            }
        }
    }
#

when i drop from inventory and stuff it counts as a left click action cuz of the animation and calls this. (According to fourms)

tall dragon
#

yea

tacit arrow
#

I wish for the event to not be called when they drop it out of their inventory.

tall dragon
#

pretty sure this event should not be called for that

#

let me just test that real quick

tacit arrow
#

Alright

#

this is 1.20 btw

tall dragon
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
tacit arrow
grave laurel
#

Is there any where to give a player the trident impaling effect while they're gliding?

inner mulch
#

you mean riptide ?

#

the speed boost?

grave laurel
#

oh yeah I meant riptide

inner mulch
#

i think there is something like player.boostelytra

grave laurel
#

Well you can launch a player via setVelocity but I just want the riptide effect

#

like the white thing around the player

blazing ocean
#

thats an animation

tacit arrow
inner mulch
#

if you look closely when dropping something your character swings its arm

eternal night
#

You basically end up with a drop and aj interact listener

#

Drop event is called prior to the fake interact one so just

#

Yea

minor lark
#

Hello! Quick question. When using ItemStack.getItemMeta() intellj says that the ItemMeta could be null. When does this happen?

remote swallow
#

when the type is air

minor lark
#

Perfect, thanks!

dawn flower
#

idk how to explain this but i got this code

} else if (action.equals("auto-pickup")) {
  List<ItemStack> items = new ArrayList<>(((BlockBreakEvent) event).getBlock().getDrops());
  ((BlockBreakEvent) event).setDropItems(false);
  for (ItemStack item : items) {
    if (player.getInventory().firstEmpty() == -1) {
      player.getWorld().dropItemNaturally(player.getLocation(), item);
    } else {
      player.getInventory().addItem(item);
    }
}```

so basically, this is code for a custom enchants coding thing, the issue is 'auto-pickup' can be coded for an enchant that can be applied on armor and tools, if you have the enchant on your tool and armor you basically dupe since Block#getDrops returns a copy, is there a way to fix this?
vernal basalt
#

what is the NBT Data?
it's right there in my original question

young knoll
#

We need to see the actual data on the player

#

You can send the player data file ig

worldly ingot
#

To answer the question, no, you cannot add custom NBT data to a player. Arbitrary NBT isn't understood by the server and will be discarded

#

It won't read it and store it as a field, it will not write it. The only reason Bukkit's persistent data container values are saved is because we patched the server so that it actually reads and writes that data.

#

ItemStacks are different because they just read the whole NBT and store it, you can store as much arbitrary NBT on that as you want. But entities don't do that and actually read and parse that data into fields. ItemStacks actually do this now with components in 1.20.5, but they at least still support custom data with a custom data component

vernal basalt
#

thank you

#

so the solution is to have a db

young knoll
#

Huh

#

How did I not know that

pallid oxide
lilac dagger
#

just use hashmaps where possible and store them locally

zealous osprey
#

Does anyone know why I get a JedisConnectionException when I call the Jedis#get method?
For some more context: I have a Jedis instance which successfully connects to the DB, I can even query/get and set data to the DB. However, once I call #get in fast succession, it seems to give me the exception.
I'm new to Redis and any help would be greatly appreciated :D

manic beacon
#

Can anyone help me find the spigot 1.20 jar

lilac dagger
#

buildtools

echo basalt
#

Something something you should be using a jedis pool

zealous osprey
#

Ok, gotta read up on that. I'm currently trying to use #mget

cinder abyss
#

Hello, what do ItemStack#getDurability return if the item isn't damageable?

#

Or how can I get the list of items that can handle a enchantment (safe)?

umbral ridge
shadow night
#

Lmao what does that mean now

umbral ridge
#

since it can't be damaged..

cinder abyss
#

null ? 0 ?

umbral ridge
#

test it out and see

cinder abyss
#

okay x)

umbral ridge
#

?jd-s

undone axleBOT
cinder abyss
#

but, if an ItemStack has 0 durability, is he breaked?

cinder abyss
shadow night
#

not yet

umbral ridge
#

It's also deprecated

cinder abyss
#

I want to support 1.9+

#

I already have the check for Damageable

#

But not for the old system

cinder abyss
knotty aspen
#

with 1.20.5 every material can be damageable again, so you are gonna have to support three different versions of the same concept (pre-1.13, 1.13-1.20.4 and 1.20.5+)

carmine mica
#

every instance of ItemMeta already implements Damageable

#

every instance of ItemMeta can be cast to Damgeable, Repairable, and BlockDataMeta

hazy parrot
#

Damageable extends ItemMeta

lilac dagger
#

that's cool ^

#

i have some interfaces in my plugin and they don't extend back so it's quiet akward working at a base level

carmine mica
#

if you look at the implementation of ItemMeta (CraftMetaItem), you will see that it also implements those other 3 interface

icy beacon
tardy delta
#

how on earth is this producing 0b 0 110000100000000:

@Debug.Renderer(text = "\"%s data=0b%8s %8s\".formatted(this.toString(), " +
            "Integer.toString(this.data >> 8, 2).replace(' ', '0'), " +
            "Integer.toString(this.data << 8, 2).replace(' ', '0'))")
#

this.data is a short

fallen lily
#

Is this the built in IntelliJ arbitrary code execution

lilac dagger
#

i never seen this

fallen lily
quiet ice
#

It's used by the debugger to prettify the contents of a debugged object

lilac dagger
#

but it comes at the cost of uglyfing with annotations

quiet ice
#

Anyways, this is likely caused by negative values

kindred sentinel
#

I got a problem... So, I'm trying to change items in the barrel when it breaks, but dropped items from the barrel aren't changed

quiet ice
#

Since I have no fucking idea what that code should be doing, I cannot tell you more though

kindred sentinel
#

one minute

quiet ice
kindred sentinel
#
    @EventHandler
    public  void onBreakBarrel(BlockBreakEvent event){
        if(event.getBlock().getState() instanceof Barrel){
            Barrel barrel = (Barrel) event.getBlock().getState();
            String customName = barrel.getCustomName();
                NamespacedKey agingKey = new NamespacedKey(plugin, "Aging");
                updateInvHelper.updateInventoryItems(barrel.getInventory());
                barrel.getInventory().forEach(item -> {
                    //            Checking conditions
                    if(item != null && item.getItemMeta() != null){
                        ItemMeta itemMeta = item.getItemMeta();
                        PersistentDataContainer itemKeys = itemMeta.getPersistentDataContainer();
                        boolean hasItemTag = itemKeys.has(agingKey, PersistentDataType.LONG);
                        if(hasItemTag){

//                    Adding spoiled lore tag and removing tag

                            item.setItemMeta(updateInvHelper.spoilItem(item));
                            plugin.getServer().getLogger().log(item);
                        }
                    }
                });
                barrel.update();
#

The log is good, item is changed, but drop from barrel - no

umbral ridge
#

if i have a square 102x102 blocks wide

#

what should the worldborder be set to

#

if I want it to perfectly align the square

#

and where EXACTLY should it be centered

#

in the middle, at the center? (.5, y, .5)

#

or at non decimal values?

#

because for the past 30mins I can't get it to work

quiet ice
kindred sentinel
#

Oh good ide

#

thanks

lost matrix
#

Wait its not a radius so its exacly x

umbral ridge
#

is worldborder even a square?

lost matrix
#

Yes, the center just has an offset here

umbral ridge
#

So... what am I doing wrong?

#

can I set the offset to 0?

lost matrix
#

Stand at exactly 0/0 and try again

#

The middle of a block is x.5 and y.5

umbral ridge
#

So I should stand here right?

#

I can't teleport myself to exact zero

#

with /tp

#

it always centers my location to .5 y .5

#

nvm now worked...

tardy delta
#

really wondering why on earth System.out.printf("%8s", Integer.toBinaryString(12).replace(" ", "0")) is " 1100" rather than "00001100"

glad prawn
lost matrix
tardy delta
#

but instead i get spaces πŸ€”

lost matrix
#

Hm i see, and the spaces arent replaced. Check the char code of those spaces.

tardy delta
#

same thing as a whitespace

#

wait replace should be after printf

#

why cant we just have a {:08b}

slender elbow
#

I mean, no because that's gonna be after it's been printed

#

you can just do %08s, no?

tardy delta
#

0 padding is invalid for strings

slender elbow
#

pepega

tardy delta
#

frightening

    @Debug.Renderer(text = """
            "%s data=0b%s %s".formatted(this.toString(),
            String.format("%8s", Integer.toString(this.data >> 8, 2)).replace(' ', '0'),
            String.format("%8s", Integer.toString(this.data & 0x00ff, 2)).replace(' ', '0'))""")```
#

but hey atleast it works

tardy delta
#

changes object representation in debugger automatically

tawdry echo
#

Is it possible to block a player from collecting experience?

hybrid needle
#

is the event cancellable? if so, you may try: event.setCancelled(true);

twin venture
#

Hi uhh , iam working on a level system :
it keep duplicating .. why? i mean it should only be , :
uuid , 0 , 0
uuid , 1 , 0
uuid , 2 , 0 .
and so on , the third paramter is boolean which mean is claimed or no .

remote swallow
#

make uuid unique and handle it conflicting

young knoll
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

twin venture
#

can i still be able to do that?

remote swallow
#

sure?

ocean hollow
#

why am I getting this error?

remote swallow
#

Arrays.asList probably returns an immutable list

lilac dagger
#

it is

#

Arrays.asList and List.of are immutable

#

use new ArrayList<>(oldplayers);

#

but this won't work for array so you'd have to add them yourself

#

maybe there's a collection data type?

tardy delta
#

Collection::shallowClone when

narrow quest
ocean hollow
lilac dagger
lilac dagger
ocean hollow
#

okay, thanks

slender elbow
#

Arrays.asList is not immutable

#

it's just not resizeable

lilac dagger
#

so you can set it to something else

#

still not as good as arraylist

slender elbow
#

I mean it serves a different purpose

slender elbow
hybrid needle
#

Hey guys. I am creating a (for now) private plugin that has a terminal which is basically a chest with multiple pages. The items that are put in and taken out will be stored and updated in the config.yml, looking like this:

Storage:
  OAK_LOG:
    amount: 160
  WOODEN_SWORD?2f1cd314-41c7-4354-9d28-b46ce5cdd02b:
    meta:
      ==: ItemMeta
      meta-type: UNSPECIFIC
      enchants:
        DURABILITY: 3
      amount: 1

Stacks with only a maximum stack size of one (the sword in this case) have a unique ID appended to them in the config, seperated with a question mark.
I am aware it is a basic approach. I may use databases in the future and maybe serialized ItemMeta as well. For now, it works perfectly fine.

Items displayed in the terminal have a lore with its amount and the item material.

Everything mostly works, except one issue:
If i take out or put in the (in this case) oak log it will add said lore to the wooden sword in the config. The config now looks like this:

meta:
  ==: ItemMeta
  meta-type: UNSPECIFIC
  lore:
    - '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Anzahl:
          "},{"italic":false,"color":"yellow","text":"1"}],"text":""}'
    - '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"ID:
          "},{"italic":false,"color":"light_purple","text":"WOODEN_SWORD"}],"text":""}'
  enchants:
    DURABILITY: 3

I tried removing it using item.getItemMeta().setLore(null); but this did not resolve the issue entirely.

Does anyone have a clue why?
Please note, that I am willed to show code but it is a lot (I do not have a git repository yet). I am not sure which line the issue lies in either. A unique solution may be required or i have to search for snippets.

#

I could show snippets that people ask for.

sullen canyon
#

Lets say I have a class MinigamePlayer, it has methods: resetPlayerAbilities, updateVisibility, updateDisguise, updateLostStatistics, updateWinStatistics,
So, based on SOLID principles I should split the class into separate classes?
and as the result I should have something like

MinigamePlayer
PlayerDisguise
+ updatePlayerDisguise
PlayerAbilities
+ resetPlayerAbilities
IPlayerStatistics
+ updateLostGameStatistics
+ updateWonGameStatistics

And so there are two questions:

  1. what would I change to make it better, more correct ig?
  2. how do I call methods I need from external classes? Do I do it like new PlayerDiguise().updatePlayerDisguise(); or should it be done differently?

So, generally I am asking what are the best practices I can use at this point

hollow oxide
#

is it possible to make the player copy something on click?

for exemple:

the player click on a chat message and it's making him copy something

chrome beacon
hollow oxide
#

thx

hollow oxide
chrome beacon
#

It's not a listenable event

hollow oxide
#

ho ok

chrome beacon
#

You can't detect when a player does it

hybrid needle
chrome beacon
#

Show us how exactly you're trying to remove it

#

?paste the code or put it on github

undone axleBOT
hybrid needle
#

I will soon. Thanks for your interest.

#

Need to do something real quick before.

ocean hollow
#

does the items adder actually send every tick an action bar?

chrome beacon
#

yeah

ocean hollow
#

won't this put a lot of load on the server?

chrome beacon
#

no not really

#

also it doesn't have to be sent every tick but every few ticks

#

depends on how fast you want it to update

ocean hollow
#

then my understanding of scheduler is bad. Can you give an example of how much load it loads?

young knoll
#

You can do it async

#

Since it's just a packet

chrome beacon
#

^^

young knoll
#

But yeah it's not that heavy regardless

hybrid needle
# chrome beacon Show us how exactly you're trying to remove it

I'd put it here since your request only takes up 3 lines:

ItemMeta cutoutMeta = takeOutItem.getItemMeta();
if (cutoutMeta != null) cutoutMeta.setLore(null); // does get triggered
takeOutItem.setItemMeta(cutoutMeta);

I tried cloning the ItemStack (takeoutItem.clone();) too but this did not fix it unfortunately.

Edit: removed the request. Asking a friend instead.

young knoll
#

Especially since you have to use components to send action bars, which avoids the legacy conversion system

chrome beacon
#

When does that fire

ocean hollow
#

If I have two plugins, both have a PlayerJoinEvent, and if I need to take information from the other plugin, then how can I understand which executed first?

versed nest
#

Is there a way to change the seed of a world in runtime? I don't mind using NMS, just need to get it to work. I tried using reflection to get the seed field of the WorldOptions class but at runtime, it cannot find the field though (getting an error for that)? I assume that's because the actual fields are obfuscated. Not sure what it obfuscates to though. (not very familiar with nms currently)

chrome beacon
#

Why would you ever need to change the seed at runtime

versed nest
#

You see

#

long story

chrome beacon
#

also fields and methods can be mapped with Mojang mappings

#

?nms

versed nest
#

yes I am using that (I believe?)

ocean hollow
#

Can I place as many entities on a player as I want? or should I add for each?

versed nest
#

actually uncertain ow

#

I'm getting multiple output jars

chrome beacon
versed nest
#

should I upload the remapped-obf or remapped one, or just the regular output name

chrome beacon
#

regular output name

versed nest
#

hmm I am doing that

chrome beacon
#

so non-prefix and non-suffix one

versed nest
#

yeah I am doing that

#
                WorldOptions options = ((CraftWorld)world).getHandle().K.worldGenOptions();
                Field f = options.getClass().getDeclaredField("seed");
                f.setAccessible(true);
                f.setLong(options, WorldOptions.randomSeed());
                f.setAccessible(false);
#

this is what I currently am trying

chrome beacon
#

the fields will be obfuscated at runtime

#

anyways you still haven't explained why you need to change the seed

versed nest
#

okay so essentially, we've got a world for a minigame that get's randomized using minecraft its worldgen (with a datapack). But to regenerate the world (at runtime) I'd have to change the seed and then regenerate the chunks.

chrome beacon
#

Just create a new world

ocean hollow
# chrome beacon I don't understand the question

i made illustration:

For example, I have 2 entities.
to land on the player I can use the method:
player.addPassanger(entity1);

but to sit the second one, I need to use:
player.addPassanger(entity2)
or
entity.addPassanger(entity2)?

chrome beacon
#

and delete the old one

versed nest
#

doesn't really work

#

we tried

#

there's custom worldgen for multiple dimensions

chrome beacon
#

?notworking

undone axleBOT
#

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

versed nest
#

doing that and re-creating the world with bukkit seemed to break the worldgen

chrome beacon
#

?xy

undone axleBOT
versed nest
#

is that towards me?

chrome beacon
#

yeah

chrome beacon
versed nest
#

1.20.4

#

but there are multiple dimensions with custom worldgen. Recreating them using the bukkit worldmanager didn't seem to actually apply the custom worldgen to those worlds as they were (by the looks of it) different from the vanilla dimensions in the way they got created.

#

hence why I'm currently attempting to keep it in memory (because during startup it does work and find the world) and just changing the seed and regenerating the chunks.

chrome beacon
#

so what's controlling the world gen

versed nest
#

a vanilla datapack

#

it generates a dimension and supplies worldgen to it

#

but I'm still confused why the reflection failed in the first place

#

worldoptions has a private final long seed; in it so I'd expect it to find it.

chrome beacon
#

as I said fields are obfuscated at runtime

versed nest
remote swallow
#

thats only during dev

#

its still obsfucated at runtime

versed nest
#

so how would I get an obfuscated field or know its name

remote swallow
#

check the mappings

#

?mappings

undone axleBOT
versed nest
#

okay thanks

#

that did the job. Appreciate it!

quaint mantle
#

Is there any wahy to get a metadata from a player at bungeecord?

#

I don't find a method with ProxiedPlayer

young knoll
#

Send code

kindred sentinel
quiet ice
#

?jd-s

undone axleBOT
quiet ice
#

Might be a bug on spigot's side, otherwise it is possible that the API just isn't here yet

kindred sentinel
#

I tried it with chest, it didn't work too

#

Btw, I still need the solution to change items dropped from barrel

eternal oxide
#

a barrel drops its contents

tender shard
rough ibex
#

it is contents

young knoll
#

I am contents

eternal oxide
#

yeah

next plume
umbral ridge
#

and I am EntityPortalEnterEvent

zealous scroll
#

Is there a way to remove the explosion sound from a firework? Setting the entity to silent doesn't achieve that

kindred sentinel
# eternal oxide a barrel drops its contents

Yeah, but If I do something like this:

    @EventHandler
    public  void onBreakBarrel(BlockBreakEvent/BlockDropItemEvent event){
        if(event.getBlock().getState() instanceof Barrel){
            Barrel barrel = (Barrel) event.getBlock().getState();
            String customName = barrel.getCustomName();
                updateInvHelper.updateInventoryItems(barrel.getInventory());
                barrel.getInventory().forEach(item -> {
                    //            Checking conditions
                    if(item != null && item.getItemMeta() != null){
                        ItemMeta itemMeta = item.getItemMeta();
                        PersistentDataContainer itemKeys = itemMeta.getPersistentDataContainer();
                        boolean hasItemTag = itemKeys.has(agingKey, PersistentDataType.LONG);
                        if(hasItemTag){

//                    Adding spoiled lore tag and removing tag

                            item.setItemMeta(updateInvHelper.spoilItem(item));
                            plugin.getServer().getLogger().log(item);
                        }
                    }
                });
                barrel.update();
#

It doesn't work

#

log tells that everything is ok

#

items are changed

#

but the drop isn't changed

eternal oxide
#

um ? onBreakBarrel(BlockBreakEvent/BlockDropItemEvent event){

kindred sentinel
#

I tried with both

#

the same

#

it didn't work

#

Like firstly I tried with BlockBreak

#

after that with BlockDropItemEvent

#

result - it doesn't work

eternal oxide
#

well the issue with changing the inventory IN the break event is that your uipdate will nto happen until the next tick, after the block is broken

kindred sentinel
#

btw it works with changing name of the barrel

#

barrel.update();
barrel.setCustomName(barrelName);
barrel.update();

eternal oxide
#

drop the contents yourself, after making the changes, then clear drops

kindred sentinel
eternal oxide
#

yes

kindred sentinel
#

but how to clear drops...

#

of the barrel

eternal oxide
#

just set dropItems to false

kindred sentinel
#

oh

#

it could work

#

I will do it tomorrow

#

thanks for help

dry forum
#
        ArmorStand block2Stand = createConnection(block2.getLocation().clone().add(0.5, 0, 0.5));

        block1Stand.setLeashHolder(block2Stand);```

why isnt there a leash being created between the 2 armorstands
echo basalt
#

what do you expect us to do with that little amount of code

dry forum
#

idk what else is needed its 1 method that isnt working

young knoll
#

The method returns a Boolean

#

Print it

dry forum
#

false

young knoll
#

Okay so it’s failing to link them

#

Let’s have a look at the source

#

It immediately fails because ArmorStand is not an EntityInsentient (I believe this is called Mob in Bukkit)

dry forum
#

so armorstands cant have leashes?

young knoll
#

Would appear not

dry forum
#

i cant see anywhere that says what entities are/arnt leashable

young knoll
#

Should be any mob

#

Except the wither

dry forum
#

ok thanks

#

.setLeashHolder doesnt exist with slimes though?

eternal oxide
#

Slimes are LIvingEntities

young knoll
#

^ should be on every living entity

#

Unless slimes are extra weird

#

Nope slimes seem fine

dry forum
#

yeah mb i forgot to cast the slime

tacit totem
#

Hello, kinda new to the Spigot dev, i can't get the SetType of a block to work :

        World world = player.getWorld();
        Location playerLocation = player.getLocation();

        // Calculate the new position
        double newX = playerLocation.getX() + xOffset;
        double newY = playerLocation.getY() + yOffset;
        double newZ = playerLocation.getZ() + zOffset;

        // Create a new location for the block
        Location blockLocation = new Location(world, newX, newY, newZ);

        // Set the block to Obsidian at the new location
        Block block = world.getBlockAt(blockLocation);
        block.setType(BlockType.OBSIDIAN);

    }

#

I Also tried with the Material.OBSIDIAN but won't work either

#

I did register the event and it does proc

eternal oxide
#

player.getLocation().add(0,-1,0).getBlock().setType(Material.OBSIDIAN)

tacit totem
#

that's a nice oneliner ngl but The Material.OBSIDIAN seems to not correctly resolve the import

eternal oxide
#

are you missing an api version in your plugin.yml?

tacit totem
#

no it's in

#

and the import is import org.bukkit.Material;

eternal oxide
#

any error/warning?

tacit totem
#

'setType(org.bukkit.block.BlockType<?>)' in 'org.bukkit.block.Block' cannot be applied to '(org.bukkit.Material)'

eternal oxide
#

Sounds like you are using an experimental build

tacit totem
#

hoo

young knoll
#

Think that’s the second time this has happened

#

Not sure how

eternal oxide
#

Some fork I guess

tacit totem
#

what build should i fall back on for a 1.20.2 server ?

young knoll
#

Whatever buildtools builds

eternal oxide
#

just the one you build with Buildtools

#

?bt

undone axleBOT
young knoll
#

Just don’t add the experimental flag/check the box

#

I think getcuckit publishes the experimental builds for whatever reason

tacit totem
#

welp imma retry

#

thanks !

young knoll
#

I think that’s where the last person with this problem got it

#

Could be wrong tho

next plume
#

Check the domain name. Looks like it expired 2 days ago.

young knoll
#

?

tacit totem
#

Okay i found the culprit !

#

I was using the experimental api spigot lib, downgraded to spigot-api-1.20.2-R0.1-20231119.061606-67-shaded.jar and it works perfectly

#

Thank you for your time everyone (and also the cool oneliner)

umbral ridge
tacit totem
#

Nothing more nothing less

young knoll
#

Tell β€˜em to update

tacit totem
#

I'll sure do but given the number of custom set up they have done pretty sure they don't want to

#

But hey, can ask anyway

young knoll
#

Perfect time to test out that crash exploit on them

stray shore
#

I've just uploaded a premium plugin and it's awaiting review, however, since it has to be reviewed, I've uploaded an unobfuscated version of my plugin. Will I be able to remove it afterwards?

young knoll
#

You should upload what’s going to be on the page

stray shore
#

is there any way I can remove it now?

young knoll
#

Not sure

stray shore
#

is there any way I can contact support for such a thing?

young knoll
#

Idk if it’ll help but

#

?support

undone axleBOT
stray shore
#

thank you

#

there's no way to delete the resource either right?

worthy yarrow
#

?services

undone axleBOT
lost matrix
#

You cant eat food in survival while you are full.
Also: You are doing some really dangerous things here.

  • Create a separate class for your Listener, dont create a nested class
  • Dont make your fields public, they should all be private
  • Dont check custom items by their name, people will exploit this by renaming their items (Some plugins allow colored renaming)
glad prawn
#

btw dont naming your field the same as the class

rough ibex
#

I think so

lost matrix
#

https://github.com/Flo0/Ambrosia

Im still fiddling with the Spigot serializer so wait for one more release version before using it for that.
But it works and can be used for development.

peak jetty
#

this is my code:

if (e.getCurrentItem().equals(PlayerInteractListener.pyramidGlobal)) {

                // Cancel the event
                e.setCancelled(true);

                // Checks if player is in world
                if (p.getWorld().equals("lobby")) {
                    p.sendMessage(ChatColor.RED + "You can't locate POIs at spawn!");
                } else if (p.getWorld().equals("world_nether") || p.getWorld().equals("world_the_end")) {
                    p.sendMessage(ChatColor.RED + "You must be in the overworld to locate POIs!");
                } else {

                    // Set GPS target
                    Location l = new Location(p.getWorld(), 0, 0, 0);
                    p.setCompassTarget(l);
                }

                // Close GUI
                p.closeInventory();
            }

when i click on pyramidGlobal tho it just closes the gui why is that?

rough ibex
#

did the compass target change

peak jetty
rough ibex
#

do you close the GUI anywhere else

peak jetty
rough ibex
#

can you show full code

sterile flicker
#

is it possible to set textures for a block via durability in 1.12.2?

rough ibex
#

i assume you mean held blocks

#

and not placed

sterile flicker
# rough ibex no

then how do I make a texture for the block without replacing the block itself?

#

I have an item and I want it to be placed as a block

rough ibex
#

ah

#

you can use itemmodels

peak jetty
rough ibex
#
Minecraft Wiki

Models are three-dimensional shapes used in Minecraft which are used to display objects encountered in the game.
The models pertaining to the vast majority of blocks and items can be configured, as well as those of a small selection of entities. Models are stored as JSON files in a resource pack in the assets/<namespace>/models folder.

#

Alright, uh

#

I hope you have plans to refactor this

#

you may have the wrong item?

#

double check

peak jetty
sterile flicker
rough ibex
#

ensure you have the right item

#

okay one moment

sterile flicker
rough ibex
#

go in threads both of you, thanks

peak jetty
#

yep ok

empty temple
#

what is the issue

rough ibex
#

this is your plugin?

#

or someone elses

empty temple
#

plugin

#

not minee

rough ibex
#

then why did you post here

empty temple
#

but it from Mythicmobs

rough ibex
#

dont crosspost

empty temple
#

Ohhhh this channel for Own Built plugin issue

rough ibex
#

yes

empty temple
#

okk i removed

green prism
#

How do you handle the "problem" that the SQLite JDBC weighs around 12mb? (It obviously needs to be shaded)

empty temple
#

????

#

mee ???

green prism
#

no

#

I'm talkin to everyone

remote swallow
stray shore
#

it downloads the library from maven central on server start

#

you can do this with every library, you just have to define its scope in maven as "provided"

green prism
#

oh, wow!

#

Thank you so much

stray shore
#

πŸ™‚

lilac dagger
peak jetty
#

im making a reload command for my plugin but when i type it i get this in console

#

this is my code:

// Reload Command
        if (cmd.getName().equalsIgnoreCase("ptreload")) {

            // Reload the plugin
            Plugin plugin = Bukkit.getPluginManager().getPlugin("PlutoTools");
            Bukkit.getPluginManager().disablePlugin(plugin);
            Bukkit.getPluginManager().enablePlugin(plugin);

            // Send success message
            if (sender instanceof Player) {
                Player p = ((Player) sender).getPlayer();
                p.sendMessage(ChatColor.GREEN + "PlutoTools successfully reloaded!");
            } else if (sender instanceof ConsoleInput) {
                getLogger().info(ChatColor.GREEN + "PlutoTools successfully reloaded!");
            }

            return true;
            // Daily Command
        }```
lost matrix
peak jetty
tall dragon
#

with prayer and high hopes

lost matrix
#

PlugMan is a perpetual problem generator.
Loading and Unloading plugins on runtime always leads to mind boggling problems down the line.
If you want to introduce a reload command, then you should implement a strategy which doesn involve unloading
the entire plugin.

remote swallow
#

they just reload configs

#

its not very easy to reload your plugin from inside if it

tardy delta
#

i simply have a list of reloadable components, voila as simple as that

lilac dagger
#

ah wait, i'm talking about perworld plugin

lilac dagger
remote swallow
#

per world plugins can kindly go and fuck themself

slim gate
#

I need help my jar is super big (most likely shading makes this)

lost matrix
#

Show your pom

slim gate
#

i got 5 poms

#

well ill show common and spigot

#

all almost have same size tho

lost matrix
#

So a multi module setup? Then just show the pom for the first module that gets big.

slim gate
slim gate
lost matrix
#

Is your maven shade plugin configured in the parent pom?

slim gate
#

no

#

common: 54kb
spigot: 30mb

and it should be pretty light almost no code

lost matrix
#

Why do you have so many spigot related dependencies in your common module?

slim gate
lost matrix
slim gate
#

oh yeah

lost matrix
#

I dont see anything out of order here.
If your code is statically analyzable, then you could try to minimize your jar.
This omits classes which are not used on runtime. Might lead to problems.

#

the maven shade plugin has a minimizeJar property in its execution configuration

slim gate
lost matrix
#

This should be ${java.version} btw.

echo basalt
#

Hey smile you know enough about classloaders right?

#

Is it possible to replace, let's say, the bukkit scheduler with a custom scheduler through funky classloading

echo basalt
#

:(

rough drift
#

Plugins are loaded later when the bukkit scheduler is already loaded

#

HOWEVER

#

You can change the object that getScheduler returns

echo basalt
#

I can do that yeah

#

But I'd like it for this plugin in specific

rough drift
#

if it's final you'll need to get the field offset w/ unsafe and edit it with that, otherwise use reflections

echo basalt
#

And keep all others intact hmm

rough drift
#

least hacky way πŸ’€

echo basalt
#

Might as well

rough drift
#

what do you need this for

echo basalt
#

Some dude's paying to add folia support

rough drift
#

omd

#

just replace stuff it's not that hard

echo basalt
#

On an obfuscated premium resource

rough drift
#

fair, but then what about async issues?

#

you'll need to sync stuff up manually

echo basalt
#

UniversalScheduler and move on

rough drift
#

😭 omfg

#

sure

echo basalt
#

not my problem

rough drift
#

I-

echo basalt
#

why do I feel like we'd have a problem if like

#

I did this

tardy delta
echo basalt
#

because CraftScheduler

rough drift
#

not really

tardy delta
#

not in kotlin

#

class CustomServer(private val server: Server) : Server by server { override fun getScheduler() = CustomScheduler() }

rough drift
#

Yeah but that's still overkill

tardy delta
#

he has to know

rough drift
#

fair

echo basalt
rough drift
#

not really? you can just again set the variable

#

it's not even final

echo basalt
#

uh no

tardy delta
#

i have no idea how the impl works but just give Bukkit.getServer() as delegate?

rough drift
#

OH

#

yeah I forgot

echo basalt
#

If you've ever done this hacky shit

#

you'll realise

rough drift
#

(CraftServer) Bukkit.getServer()

echo basalt
#

there are a lot of fucked up casts

#

like

#

everywhere

tardy delta
#

whats the problem, Server is an interface or atleast abstract class

echo basalt
#

oh yeah this is gonna fuck things up

#

I need to extend the class

tardy delta
#

i have no idea

echo basalt
#

let's see if this shits the bed

#

mm nasty reflections

tardy delta
#

i hope those are methodhandles

echo basalt
#

nope

#

get fucked

#

is craftscheduler obfuscated? o_o

lilac dagger
#

no?

#

why would it?

echo basalt
#

Ah I gotta add params

#

cool this works

#

hacky shit

#

I wonder how UniversalScheduler is gonna play with having the bukkit scheduler reroute to itself

#

hm

#

need to add a bunch of rerouty stuff

lilac dagger
#

what's this universal scheduler for?

echo basalt
#

folia shit

echo basalt
#

yeah

lilac dagger
#

i can't think of a reason on what can this be useful for

echo basalt
#

but I'm using UniversalScheduler

lilac dagger
#

it seems like a cool project

#

but i can't think on anything to put in practice

echo basalt
#

the idea is that you just rewrite all your schedulers to use this and it magically supports folia

#

problem is task ids are a thing

lilac dagger
#

desynchcronization is also a thing

chrome beacon
#

No Minestom support smh

wet breach
#

I probably won't bother with folia

tardy delta
#

what on earth is folia?

eternal night
#

πŸ‘€

sullen canyon
wet breach
wet breach
icy beacon
rough drift
cinder abyss
#

Hello, is it possible to manipulate cherry leaves particle? (I want to change the color)

winter cradle
rough drift
#

nevermind you're right

#

I got it wrong

shadow night
kindred sentinel
eternal oxide
#

clear the inventory once you have dropped what you want

kindred sentinel
slender elbow
eternal oxide
#

yes

kindred sentinel
#

Inventory.clear()?

minor lark
#

Hello! I am having a problem. Im writing an Interactable Item System.
The interactable item class extends ItemStack but I noticed that as soon as I give the object to the player the itemstack is no longer an instance of interactable item. Is there some way to fix this issue? Or is there another way to make it work? Is it possible to save the class into the item?
I don't want to create a listener for every item or create a list cause everytime the plugin is restarted the list is gonna reset

kindred sentinel
#

nah

#

it doesn't

icy beacon
kindred sentinel
minor lark
icy beacon
#

Add PDC to your items and work from there

minor lark
#

Is it possible to add a class?

kindred sentinel
#

Boolean I think

icy beacon
#

Whatever you want. I don't know what you're making, "interactable item" is a very broad statement

icy beacon
#

Just add some identifier for the item to mark it as interactable

#

And then work with that

minor lark
#

Already done so

icy beacon
#

So what's the problem

minor lark
#

I need to know what identifier it is

icy beacon
#

You should not be extending bukkit classes unless they are explicitly for extension like BukkitRunnable

icy beacon
heavy void
#

Guys, im making a Override on tabComplete function of my command directly on commandMap, it is working fine.

  • But how do i define a type for the argument, and how do i make the argument need to be one of those options
kindred sentinel
# eternal oxide yes

It doesn't work, items are still dropped when I break Barrel even if I try on break block event event.getBlock().getInventory().clear()

rough drift
heavy void
icy beacon
#

I have literally no idea what this is supposed to mean

#

Example

rough drift
#

You have to manually do that

icy beacon
#

If you mean to require, for example, an integer as your second argument, then just grab your second argument and verify that it's an integer

heavy void
#

Theres command that gives you an error in client-side when it is not Integer(for example)

icy beacon
#

If you're not using a library like ACF, do it manually

icy beacon
#
int value;
try {
    value = Integer.parseInt(args[1]);
} catch (NumberFormatException ex) {
    ...
}
heavy void
#

But, how do i throw an error to client-side argument

minor lark
# icy beacon So what's the problem

I have an abstract class called interactableitem and other classes that extend that class. Every instance overrides an abstract method of the interactable item which I want to execute when the user right clicks with the item. I have a listener for the right click, how do I call the execute method?

heavy void
#

Its literally throwing an error?

icy beacon
#

Yeah... Read the docs

rough drift
icy beacon
rough drift
jagged bobcat
#

Chat api?

#

Ah I never liked that way adventure messages are 100% better. Cant help

minor lark
#

Meaning that the object would not work

iron glade
#

Don't understand what's causing the gradient to be "out of phase" when using more than 2 colors. Notice the red jumping to the right end. Works perfectly fine with 2 colors. Any idea what's causing that?

#

phase debug

#
            if (animationDirection == AnimationDirection.LEFT_TO_RIGHT) {
                phase = (phase - getAnimationSpeed() < -1) ? 1 : phase - getAnimationSpeed();
            } else {
                phase = (phase + getAnimationSpeed() > 1) ? -1 : phase + getAnimationSpeed();
            }```
That being in a repeating task
echo basalt
#

uH

lilac dagger
#

Some color offset missing, i've seen acer's keyboard program having a similar issue sometimes

proven fern
#

Is it against rules to move BungeeCord chat module into my project under my package name?

rough drift
blazing ocean
#

i mean shading exists

proven fern
wet breach
proven fern
blazing ocean
#

read the license

proven fern
#

but i want to make sure

cinder abyss
#

Hello, how to change the color of cherry leaves particle?

blazing ocean
#

if the license tells you its okay, do it if you really need to

blazing ocean
cinder abyss
iron glade
proven fern
wet breach
#

its a large jump you are doing going from negative to positive

blazing ocean
wet breach
#

also, you go to 1.0 and then you are going down back to zero

#

when it should be positive going to 1

proven fern
iron glade
minor lark
blazing ocean
#

or just not do it

#

because why the hell

wet breach
#

if that is the beginning that is fine, but you are worried about the end, which I am telling you it does a large jump but then after the large jump it goes in the wrong direction

#

it should go from -1 to 0 then to 0.1 going to 1.0

#

instead you are going from -1 to 1, then going down to 0.9

iron glade
#

wait, I start at 0 and keep subtracting 1/16 until it reaches -1

#

so you say once it reaches -1 I should go back to 0 and up to 1, instead to 1 and down to -1 again?

wet breach
#

well, that is what it should do. 1 is greater then anything less then 1, and I don't see why you are skipping 0? -1 to 1 is a skip of a single number. You gradually decrease but then you jump to a whole number and then gradually decrease again?

#

to me, it makes sense that it gradually decreases and then increases gradually

iron glade
wet breach
#

also note, by technicality its actually 2 number skips

#

there is -0 and 0

wet breach
#

the more colors you use, the more time it should take to go through all the colors

#

it also would make number skips more noticable the more colors there are

wet breach
#

also, it depends how longg of time there is to do all the changes vs how many colors there are

#

if you use 2 colors, and there is 10 seconds for the entire transition, this means both colors get 5 seconds

#

if you added 3, this shortens the amount of time each color gets for the transition

#

if the time isn't increased

iron glade
#

that's basically the function or am I wrong? Just for my understanding

wet breach
#

idk what you mean about function

iron glade
#

the phase cycle

zealous osprey
#

yesn't
The line going downwards shouldn't exist, but it still illustrates what it should do

kindred sentinel
#

If an item doesn't have item meta, how to add one to it??

zealous osprey
#

ItemStack#setItemMeta

shadow night
#

an item should always have an item meta, unless it's air from what I remember

kindred sentinel
#

oh

#

it explains everything

shadow night
#

and air can't have an item meta

zealous osprey
iron glade
#

photoshop god xD :D

zealous osprey
#

ms paint... :)

iron glade
#

even better :D

zealous osprey
#

Is the discussion about that gradient still going on, or was this for something else?

iron glade
#

still going on

#

can't figure it out tbh

#

I fought cycling the phase from -1 to 1 should make a perfect loop no matter the amount of colors

zealous osprey
#

Did you make sure that they are all evenly spaced?

#

Also, how are you combining/interpreting between colors?

iron glade
zealous osprey
#

that's neat

iron glade
#

true

#

think I'm missing something

drowsy cloud
#

Is the Player class the same when a player disconnects and then reconnects?

young knoll
#

no

drowsy cloud
pseudo hazel
#

save the uuid instead

wet breach
#

probably better off just creating your own implementation

quaint mantle
#

is it bad that I basically have two classes with the same exact code just different names

worthy yarrow
#

If they are trying to achieve the same function then yes

quaint mantle
#

I mean they are trying to, but it's for like a different thing

worthy yarrow
#

Otherwise not really, separation of concerns makes your code readability higher and easier to manage

quaint mantle
#

actually it isn't that bad it's just one method

shadow night
#

You could extend

quaint mantle
#

I could make an abstract skeletal class

worthy yarrow
#

If it’s a single method inside a whole class you could probably just keep them local

shadow night
#

Lol

quaint mantle
#

but going through that process made me run into naming issues

worthy yarrow
#

I mean

#

Like I said if it’s a single method then you don’t need a whole class haha, just condense until your concerns require multiple classes

worthy yarrow
shadow night
#

True

worthy yarrow
#

I don’t think you’re gonna extend any local classes unless they’re interfaces right? I mean I certainly have never had an issue otherwise

shadow night
#

Just keep it one class

worthy yarrow
#

Agreed

upper hazel
#

how get Recipe key from craftItemEvent without nms

ivory sleet
#

people care a bit too much about DRY sometimes

inner mulch
wet breach
#

and why would you need two classes if the code is the same

#

it makes sense from an interface perspective but not implementation

peak jetty
#

this is my code:

String url = "http://textures.minecraft.net/texture/17d7b3c8e5735b0da3db74abfdce870c2e904689f5cb2c29bcd2a51ed71fddff";
dance.setItemMeta(getSkull(url));
    public ItemStack getSkull(String url) {
        ItemStack skull = new ItemStack(Material.PLAYER_HEAD, 1, (short) 3);

        if (url == null || url.isEmpty())
            return skull;

        ItemMeta skullMeta = skull.getItemMeta();
        GameProfile profile = new GameProfile(UUID.randomUUID(), null);
        byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
        profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
        Field profileField = null;

        try {
            profileField = skullMeta.getClass().getDeclaredField("profile");
        } catch (NoSuchFieldException | SecurityException e) {
            e.printStackTrace();
        }

        profileField.setAccessible(true);

        try {
            profileField.set(skullMeta, profile);
        } catch (IllegalArgumentException | IllegalAccessException e) {
            e.printStackTrace();
        }

        skull.setItemMeta(skullMeta);
        return skull;
    }```

why does it say required type ItemMeta provided type ItemStack at `dance.setItemMeta(getSkull(url));`?
echo basalt
#

You're returning an ItemStack and expecting an ItemMeta

sterile flicker
#

https://pastes.dev/5O7TJXPxKw suppose there is such a method to replace a mob ```java
@Override
public void write(ChannelHandlerContext channelHandlerContext, Object packet, ChannelPromise channelPromise) throws Exception {

            if (packet instanceof PacketPlayOutSpawnEntityLiving) {
                System.out.println("spawneddd");
                Field idField = packet.getClass().getDeclaredField("c");
                idField.setAccessible(true);
                int id = idField.getInt(packet);
                System.out.println(id);
                if (id == 102) {
                    replaceEntity(FakeZombie::new,"zombie", EntityTypes.ZOMBIE, "ZOMBIE", EntityZombie.p());
                }
            }
            super.write(channelHandlerContext, packet, channelPromise);
        }``` how to make a zombie look like a player in 1.16.5? It is currently being replaced by a pig
peak jetty
echo basalt
#

learn java

peak jetty
sterile flicker
echo basalt
#

IIRC

#

However, player metadata and a bunch of other factors are completely different

#

So you'll have a lot of issues if you just try to "replace an entity" rather than making one from scratch

sterile flicker
echo basalt
#

Isn't the pig the first entity type registered?

#

Might be something to do with that

sterile flicker
echo basalt
#

The spawn entity packet has an entity type field

sterile flicker
echo basalt
# peak jetty thought this was a help channel ngl

We help people, we don't babysit them. I gave you pointers to what's causing you trouble, your own IDE will tell you the same. Asking me how to fix one of the most basic issues out there screams to all of us that you don't know the minimum required

#

When we help people we expect them to know the bare minimum

echo basalt
#

What you can do is intercept the packet, get the entity ID, cancel the packet and spawn a custom player from scratch with the same entity ID

#

Sending brand new packets

#

And even then I wouldn't use the same entity ID due to entity metadata packets causing the possibility of client disconnects / crashes

sterile flicker
#

can I send entity destroy packet for zombie

#

or hide it somehow

dawn flower
#

can you strike lightning that only exists for ?? ticks?

#

for example 10 tick lightning

echo basalt
cinder abyss
#

Hello, how can I teleport smoothly (for 0.05 block every tick) because it's not really good looking

echo basalt
#

Run a task every tick and interpolate

#
public double calculateAxis(int tick, int totalTicks, double scale) {
  return (double) tick / totalTicks * scale;
}
#

Simple lerp

cinder abyss
#

whaat ?

echo basalt
#

Run a task every tick

cinder abyss
#

yeah I know that

echo basalt
#

your scale is the total distance between start and end

cinder abyss
#

I want to make something smooth like the cherry leaf particle

rare rover
#

i feel nooby for asking this but like how do i execute methods from another one of my plugins which is on my server. Not sure how it all works cuz its saying the class wasn't found, although the JVM should've loaded it

echo basalt
rare rover
#

yep, both are loaded and my sub plugin is dependant on the main

#

and is being loaded before it is

#

made sure of that

echo basalt
#

They are entities however

echo basalt
cinder abyss
echo basalt
#

Also make sure you're not shading one in another

cinder abyss
#

it's not good looking

#

I want to make it smoother

echo basalt
#

20 per second

cinder abyss
rare rover
#

i have tried to restart, and i've also looked at shading and it seems all fine. I ain't shading anything 😭

cinder abyss
#
scheduler.runTaskTimer(plugin, task -> {
            Location nextLocation = leaf.getLocation().add(nextx, FALL_SPEED, nextz);

            if(!nextLocation.getBlock().getType().isAir()){
                leaf.remove();
                task.cancel();
            } else {
                leaf.teleport(nextLocation);
            }
        }, 1L, 1L);```
echo basalt
#

uH

#

Then yeah your nextX and nextZ need to be smaller

rare rover
#

actually feel dumb cuz i've done this before but every resource i've came across they grabbed the JavaPlugin which is dumb imo, just wanted to make sure you didn't need to do that

cinder abyss
echo basalt
rare rover
#

why do you need to do that exactly? What does that change?

#

since i'm not trying to execute anything from that class

echo basalt
#

sigh show code

#

I kinda gotta go

rare rover
#

haha, it's all good if you gotta go, i'll figure it out someday

#

but here rq

dawn flower
#

i found LightningStrike#setLifeTicks

#

is that it?

echo basalt
#

Try it

dawn flower
#

alr

#

nope

rare rover
#

Sub-Plugin: Bukkit.broadcast"${player.getData()}".parse()) // getData and parse is from the main plugin
Main: fun Player.getData(): PlayerData = playerDataManager.getData(this)

#

legit all it is cuz i was testing

#

and cannot find the class

cinder abyss
dawn flower
#

do i just use tasks and kill the lightning

icy beacon
#

Can I recalculate the damage in EntityDamageByEntityEvent? I change the attacker's hand item (e.g. from an enchanted sword to an unenchanted one) and I expect the final damage to change, but it doesn't, probably because it is not recalculated afterward. Is it possible to do so?

keen valve
keen valve
chrome beacon
#

I don't recommend using VSCode for Java

#

You should use a proper IDE like Intellij or Eclipse

chrome beacon
#

but not for Java

#

It's good for web development and languages that don't have good purpose built IDEs

keen basin
#

Does anyone know why EntityExplodeEvent sometimes doesn't return all broken blocks?

keen valve
chrome beacon
#

It's just less efficient

#

the tooling is worse

#

but if you really want to keep using VScode I won't stop you

keen valve
random monolith
#

I'm trying to replace non-players chat messages using packets

public class DisguisedChatPacketListener implements SimplePacketListener {
    @Override
    public PacketType packetType() {
        return PacketType.Play.Server.DISGUISED_CHAT;
    }

    @Override
    public void register(JavaPlugin plugin) {
        ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin,packetType()) {
            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer packetContainer = event.getPacket();

                String json = packetContainer.getStrings().read(0);
                if(json == null) return;

                String text = Utils.readJsonField(json,"text");
                json = json.replace(text, Utils.convertText(text,event.getPlayer()));
                packetContainer.getStrings().write(0,json);
                event.setPacket(packetContainer);
            }
        });
    }
}```
I'm testing for example doing /pl for see what I get, and I get no errors, but message isn't replaced. Do somebody can help me? :-)
echo basalt
#

Wouldn't it be a wrapped chat component?

random monolith
#

Do you mean?

@Override
    public void register(JavaPlugin plugin) {
        ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin,packetType()) {
            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer packetContainer = event.getPacket();

                String json = packetContainer.getChatComponents().read(0).getJson();
                if(json == null) return;

                String text = Utils.readJsonField(json,"text");
                json = json.replace(text, Utils.convertText(text,event.getPlayer()));
                packetContainer.getChatComponents().write(0, WrappedChatComponent.fromJson(json));
                event.setPacket(packetContainer);
            }
        });
    }
}```
cinder abyss
#

Hello, how can I get the biome leaves color?

sterile flicker
#

how to get the texture and signature of the 128x128 skin?

cinder abyss
young knoll
#

No

iron glade
# wet breach seems it has a flaw then

Yep, tried until now. Opened a ticket now. Doesn't make sense to me that it works with 2 colors but not with more.
Not sure but I think they have an issue here https://github.com/KyoriPowered/adventure/blob/main/4/text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/standard/GradientTag.java

GitHub

A user-interface library, formerly known as text, for Minecraft: Java Edition - KyoriPowered/adventure

cinder abyss
undone axleBOT
remote swallow
#

Are you trying to libraries hibernate

#

You have to set their class loader to spigots

#

For the entire hibernate config

#

Ill find the method when im home give me like 10 min

keen basin
#

Does anyone know why EntityExplodeEvent sometimes doesn't return all broken blocks?

@EventHandler (priority = EventPriority.MONITOR)
    public void onEntityExplode(EntityExplodeEvent e){

        if (!(e.getEntity() instanceof EnderCrystal)) return;

        EnderCrystal crystal = (EnderCrystal) e.getEntity();
        Block crystalBlock = crystal.getLocation().getBlock();

        System.out.println("--------------------");
        if (blocks.containsKey(crystalBlock.getLocation()) && UnbreakableManager.existList(blocks.get(crystalBlock.getLocation()))) {
            if (crystal.getCustomName() != null && crystal.getCustomName().equals("crystal")) {
                String listName = blocks.get(crystalBlock.getLocation());
                for (Block block : e.blockList()) {
                    UnbreakableObject unbreakableObject = UnbreakableManager.getListByName(listName);
                    System.out.println(block.getType().name());
                    if (unbreakableObject.getBlocks().contains(block.getType().name())) {
                        e.blockList().removeIf(blockList -> blockList.getType().equals(block.getType()));

                        blocks.remove(crystalBlock.getLocation());
                    }
                }
                System.out.println("--------------------");
            }
        }

    }
--------------------
STONE_BRICKS
STONE_BRICK_STAIRS
--------------------
--------------------
STONE_BRICKS
STONE_BRICK_STAIRS
--------------------
--------------------
STONE_BRICKS
STONE_BRICK_STAIRS
--------------------
--------------------
STONE_BRICKS <--------------- STONE_BRICK_STAIRS BROKEN
--------------------
--------------------
STONE_BRICKS
--------------------
valid burrow
#

please use

#

?paste

undone axleBOT
keen basin
lost matrix
remote swallow
#

@solar musk in something i used i had .applyClassLoader(this.getClass().getClassLoader()) being called on org.hibernate.cfg.Configuration

shadow night
#

how does the bukkit scheduler, like, tick?

lost matrix
lost matrix
shadow night
#

so, there is nothing like a tick method in the CraftScheduler or anywhere in that package?

lost matrix
#

What do you need that for?

shadow night
#

I was going through it to see if I can rewrite it a bit to run on fabric or forge

#

it's a cool thing so I thought why not

cinder abyss
#

Hello, I've got this nms code :java Biome biome = CraftBlock.biomeToBiomeBase(, location.getBlock().getBiome()).value();

What do I need to put in first arg? It requires a net.minecraft.core.Registry<net.minecraft.world.level.biome.Biome>

lost matrix
inland whale
#

hey can anyone tell mee how i can enable offhand item swap
i dont know why it is disabled in my server

alpine urchin
#

XD

cinder abyss
alpine urchin
#

chill out dawg

lost matrix
inland whale
#

I ALREADY ASKED

remote swallow
#

so wait

inland whale
#

OHK

remote swallow
#

its been 4 minutes since you answered a question, calm down

cinder abyss
#

πŸ’€

sterile flicker
#
org.bukkit.inventory.ItemStack diamond_helmet = new org.bukkit.inventory.ItemStack(Material.DIAMOND_HELMET);
            diamond_helmet.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
            ``` how to make a helmet invulnerable so that zombies don't burn
cinder abyss
lost matrix
#
  1. Cast to CraftBukkit implementation
  2. getHandle on CraftBukkit object
cinder abyss
#

oh okay thanks

alpine urchin
#

i know the answer @inland whale

sterile flicker
slender elbow
#

you need to set the meta back

#

but yes

alpine urchin
#

@inland whale i gtg

#

sowwy πŸ€·β€β™‚οΈ

inland whale
#

what ?

lost matrix
# inland whale what ?

@inland whale You have been hereby warned. Dont spam channels unrelated to your issue and pls refrain from using capslock.

alpine urchin
#

7smile7 you're staff? congrats

inland whale
#

sorry i didnt meant to

remote swallow
inland whale
#

he told that he knows so i told him to come to server section

alpine urchin
#

i forgot the answer

inland whale
#

ohk

alpine urchin
#

i remember now

#

but i have to go

cinder abyss
#

So, how can I get CraftBukkit instance please? πŸ˜…

alpine urchin
#

do you know reflection?

eternal oxide
#

depend on spigot not spigot-api

cinder abyss
lost matrix
sterile flicker
alpine urchin
#

yup 7smile described it perfectly

#

and similar would work with many other structures in minecraft

slender elbow
#

did you actually put the helmet in their helmet slot..?

alpine urchin
#

with a .getHandle() function

cinder abyss
lost matrix
lost matrix
cinder abyss
#

oh okay thanks

lost matrix
#

X = World
in your case

slender elbow
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

sterile flicker
#

yes ```java
org.bukkit.inventory.ItemStack gold_helmet = new org.bukkit.inventory.ItemStack(Material.GOLDEN_HELMET);
gold_helmet.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
gold_helmet.getItemMeta().setUnbreakable(true);

        PacketPlayOutEntityEquipment helmet = new PacketPlayOutEntityEquipment();
        List<Pair<EnumItemSlot, ItemStack>> list1 = new ArrayList<>();
        list1.add(new Pair<>(EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(gold_helmet)));

        setField(helmet, "a", entityID);
        setField(helmet, "b", list1);
        for (Player p : Bukkit.getOnlinePlayers()) {
            PlayerConnection conn = ((CraftPlayer) p).getHandle().playerConnection;
            conn.sendPacket(helmet);
        }
alpine urchin
#

@cinder abyss X could also be Player

slender elbow
#

bro

slender elbow
#

what did i say about the meta

cinder abyss
lost matrix
#

He is mixing virtual and physical entities again.

slender elbow
#

get the meta, set its unbreakable state, then set the meta back into the item

#

you're gonna have a hard time doing nms without knowing how to deal with api itemstacks

alpine urchin
#

damn

lost matrix
#

He has been doing this for like a month now.
Spawning something in the world and then sending packets to the player, wondering why the server
doesnt pick it up.

alpine urchin
#

packets are like whispering to a player @sterile flicker

#

using the api, is gonna let the server understand whats going on

#

if ever possible use the api

#

and avoid packets

cinder abyss
# lost matrix ```java World bukkitWorld = ...; CraftWorld craftWorldImpl = (CraftWorld...

So, it's good?```java

World bukkitWorld = location.getWorld();
if(bukkitWorld == null) return 0;
CraftWorld craftWorldImpl = (CraftWorld) bukkitWorld;
ServerLevel nmsWorld = craftWorldImpl.getHandle();
Optional<Registry<Biome>> biomeRegistry = nmsWorld.registryAccess().registry(Registries.BIOME);

if(biomeRegistry.isEmpty()) return 0;
Biome biome = CraftBlock.biomeToBiomeBase(biomeRegistry.get(), location.getBlock().getBiome()).value();
return biome.getFoliageColor();```

cinder abyss
#

okay thanks

#

I removed craftWorldImpl to directly use it in nmsWorld

#

ServerLevel nmsWorld = ((CraftWorld) bukkitWorld).getHandle();

inner mulch
#

Should i put all the data of a player in one playerdata class or Split it up?

lost matrix
twin venture
#

Hello so , again iam facing a problem .. with time and date ..
so i have this :
so when a user didn't claim the package it will say is not claimed .. etc

when user claim it :
it should display the time left till he can open it again..
but there is a problem the timer dissaper when the user log out , and log in again its all 0 ..
in the database it looks like this :

#

This is what iam using rn :

#

the getStartedDate is the when user clicked on the package and claimed it
and the getTime is the Package time.

#

my problem is when a user log out , log in again it display the time left as :
0 day , 0 hour , 0 minute .. etc and that's wrong!

cinder abyss
#

@lost matrix is it good if I copy paste the code from 1.20.2+ method to my 1.20.1 method?

public static net.minecraft.world.level.biome.Biome bukkitToMinecraft(org.bukkit.block.Biome bukkit) {
    return bukkit != null && bukkit != org.bukkit.block.Biome.CUSTOM ? CraftRegistry.getMinecraftRegistry(Registries.BIOME).getOptional(CraftNamespacedKey.toMinecraft(bukkit.getKey())).orElseThrow() : null;
}```
twin venture
#

This is how i load it from database :

tall dragon
#

@twin venture find out at which point its not going right by logging

rare rover
#

oml

#

why doesn't anything go well for me πŸ’€

#

why is this showing up?

#

one sec

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.

chrome beacon
#

You're using a Paper system ask Paper

slender elbow
#

join-classpath
false

#

mfw

chrome beacon
#

ah yeah that's true :kekw:

lost matrix
#

Wait... he interrupted the classpath joining

peak jetty
#

this is my code for a bunch of GUIs i made:
but the issue is i can still move an item into the gui, how can i fix it since i need it to be locked? (the last else if statement is my best attempt at it)

lost matrix
peak jetty
lost matrix
peak jetty
#

but it still didnt fix from moving items into the gui

#

they would get locked once they were in but they could still be moved in