#help-development

1 messages · Page 1235 of 1

summer scroll
#

How can I copy item's nbt using nms on newer version (1.21.x), previously on 1.20.x I could just do net.minecraft.world.item.ItemStack#setTag(CompountTag)?

eternal night
#

you can't

#

items in 1.21.4 do not have NBT anymore

#

outside of the custom_data component

summer scroll
#

So I just need to transfer the components instead of the nbt?

#

So basically I'm trying to sync inventories but I found a problem if the server version are different, on 1.20.x I serialized the item to base64 then deserialize it, it will work when I switch from older version to newer version, but not the other way around because downgrading item is not possible, because of that I decide to make my own serializer.

eternal night
#

How would that ever work

#

"your own serializer"

dense falcon
#

Alright.

eternal night
#

like, if you are just doing NBT instead of Base64, that won't fix it

summer scroll
lost matrix
#

I would just check out the nms ItemStack.copy() method

eternal night
#

what do you mean "the nbt too"

#

that is all the item is

#

its nbt

summer scroll
#

Sorry I meant like basically storing the nbt and then applying that nbt to the new item.

eternal night
#

That will not work when downgrading

summer scroll
#

But it works, was testing it on 1.20.4 and 1.20.1 server

eternal night
#

yea

#

because those versions have little to no difference

thorn isle
#

something something transmute

eternal night
#

it will absolutely not work when going from 1.21.4 to e.g. 1.20.4

summer scroll
thorn isle
#

ItemStack::transmuteCopy

eternal night
#

I think your entire approach is just flawed

thorn isle
#

applies the components of the item it's called on onto the item its passed

eternal night
#

1.20.4 to 1.20.5 will also e.g. not work

#

the only remotely sane approach here would be to write, what is basically a "reverse data fixer upper" implementation

thorn isle
#

what is he even trying to do

eternal night
#

I'm trying to sync inventories but I found a problem if the server version are different, on 1.20.x I serialized the item to base64 then deserialize it, it will work when I switch from older version to newer version, but not the other way around because downgrading item is not possible, because of that I decide to make my own serializer.

#

but not the other way around because downgrading item is not possible

thorn isle
#

yeah that's uh

#

well

#

you can look into whatever viaversion/viabackwards does

#

which is like driving the dfu in reverse somehow

#

beyond that, you're basically shit out of luck

#

if you only need lore/name/enchants + "nbt" as in the persistent data container, you can do the (de)serialization manually

summer scroll
#

damn, this is a tough one

thorn isle
#

why are the servers on different versions?

summer scroll
thorn isle
#

unless they are stupid they will have that in the persistent data container

summer scroll
thorn isle
#

skill issue

summer scroll
thorn isle
#

that stuff is now on the CUSTOM_DATA component iirc, which holds a nbt compound

eternal night
#

Via basically implements the DFU in reverse yes

#

well, on ViaBackwards

thorn isle
#

unfortunately from what i remember they don't have a convenient or even usable api to arbitrarily translate things back and forth

#

i had this magnificent idea at one point to write a very simple wire packets based plugin and then offload version compatibility to via

#

i would just write like 1.20 packets and via would update them to whatever the current version is, so it'd be maintenance free

#

but from what i remember trying to get it to work was like having sex with a cheesegrater

summer scroll
#

anyways, thanks for the help guys. from now on i'll make sure to use same version

dense falcon
#
    @EventHandler
    public void onPlayerInteractWithArmorStand(PlayerInteractEntityEvent event) {
        System.out.println(1);
        Player player = event.getPlayer();
        Entity entity = event.getRightClicked();
        String serverName = player.getServer().getMotd();
        System.out.println("Server: " + serverName);
        if (!serverName.toLowerCase().startsWith("lobby")) {return;}
        System.out.println("Entity:" + entity.getClass().getName());
        if (!(entity instanceof ArmorStand)) {return;}

        event.setCancelled(true);
    }
``` I would like to disable interactions with Armorstand but the event is not called... Why?
eternal oxide
#

an Event not firing means you either didn;t register it or you are watching the wrong event

thorn isle
#

consider getting worldguard

quartz sorrel
#

I noticed that the CrafterCraftEvent does not have a method to obtain any remaining item from a craft. Like the empty buckets from a cake (which the Crafter ejects too btw).
Is this intentional? Technical limitation? Just an oversight? If intentional, what's the intended way of detecting any remaining items from a Crafter craft?

thorn isle
#

i'm not sure where that might be available on spigot, in nms it's Item::getCraftingRemainder, paper exposes it through the experimental ItemType class

eternal night
#

the recipe has remaining items

#

it would have to be exposed on the event

dense falcon
#

Bungee Class: https://hastebin.com/share/yofitehojo.java
LobbyCommand: https://hastebin.com/share/cocadufeyo.java

I would like that when I do /lobby it connects me to the first lobby server that has less than 20 players which is the maximum number of players on these servers, except that it connects me to all the servers that have less than 20 players, I have two lobby servers for testing and it connects me to the first, then to the second, except that I would like it to connect me only to the first one that finds, and not to the following ones, because if I have 50 servers it will connect to 50... and besides sometimes it refuses the connection, it times me out.

eternal oxide
#

Break out of the for loop if the count is less thn 20 in sendPlayerToAvailableLobby

dense falcon
#

But how I know back that's the count is less than 20?

eternal oxide
#

ah I see

dense falcon
#

I mean, I ask the info but get the result in another class, and now how I get back to my command class the result.

eternal oxide
#

where are you doing the actual connect?

#

ok its in teh bungee class

dense falcon
#

Yeah.

eternal oxide
#

because you are requesting ALL server counts you keep triggering the onPluginMessageReceived even after you found a free server

dense falcon
#

So what can I do to stop requests when the player can be tped?

eternal oxide
#

do a single request and process it on bungee

#

you can query player counts on bungee

dense falcon
#

Uh how?

eternal oxide
#

or

#

delete all your bungee listener and process it when the response is returned to Spigot

#

teh Player count is a built in bungee response

#

basically you can;t fire/forget your player count

#

well you could query ALL servers

#

that way you are not sending multiple queries

quartz sorrel
quartz sorrel
quartz sorrel
#

So at most could I probs get the Crafter Block and go through its slots, checking if any item returns a remaining item.... fun

eternal night
#

Sounds like you might wanna open a feature request typing

sacred cedar
#

hey,
i am currently trying to make a ability wich spawns multiple lines in front of the player like this example -> https://imgur.com/a/HXgb1kK not sure if i am allowed to paste those links but i think imgur.com should be safe
it should spawn always in the direction of the player and at the height of the crosshair but i cannot figure a way out how to make this properly
not very good at vector and location stuff but i tried it over the past days and i couldn't get it to work so here i am

thanks for any help its much appreciated

warm mica
#

That's your start point. Then have a simple for loop that adds a constant value to both x and z values, and draw a particle

#

For constant height, set the y of the direction vector 0 (or something) and call #normalize() afterwards. Do that before multplying the vector

eternal oxide
#

EyeLocation if he wants it aligned to teh head

manic delta
#

Guys i want to load a lot of heads into an inventory, like this, but the server lags when opening the menu, for obvious reasons, is there any way to optimize it? I can't think of anything

blazing ocean
#

don't block the main thread for profile lookups

#

i feel like it might still be doing them

manic delta
thorn isle
#

alternatively getYaw and use that

manic delta
#

im currently using it like this

thorn isle
#

what grinds my gears are head database plugins that keep the cache in memory

#

YES PLEASE i want 15,000 head textures on my heap at all times

blazing ocean
warm mica
manic delta
manic delta
warm mica
thorn isle
#

i don't think getOfflinePlayer loads anything

manic delta
#

any ideas how I can do this in an optimized way?

blazing ocean
thorn isle
#

iirc it's when you call on properties of the offlineplayer, like name, that loading happens from the usercache or wherever

manic delta
thorn isle
#

the texture/profile lookups

#

createprofile just creates a blank profile with uuid and possible name

#

its properties like name and skin then possibly need to be looked up from mojang/disk

blazing ocean
#

also #setPlayerProfile is paper API so yeah

manic delta
#

yea using paper

blazing ocean
#

?whereami

manic delta
#

i know

#

But I think the problem is not from paper.

thorn isle
#

why is it by the way that so many paper people ask their questions here

#

did they shut down their help channel?

blazing ocean
manic delta
blazing ocean
#

You're using a paper api

#

so off you go

manic delta
#

okay by the way, thank you

blazing ocean
#

hi kat

worthy yarrow
#

Hi rad

thorn isle
#

yeah spigot is super passive aggressive because of its shrinking (single-digit) market share so if they smell paper on your person they tell you to go ask them

#

what confuses me is why paper people even come here in the first place

worthy yarrow
#

@eternal night explain

blazing ocean
#

it's lynx' fault

quartz sorrel
quartz sorrel
#

(It's now the PaperMC discord)

rough drift
#

it's like asking help on the fabric discord server for quilt, they are similar, some overlap is there, but you're better off asking in the specific discord.

worthy yarrow
dense falcon
#
@EventHandler
    public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
        Player player = event.getPlayer();
        Entity clickedEntity = event.getRightClicked();
        ItemStack itemInHand = player.getInventory().getItemInMainHand();

        if (clickedEntity instanceof Player && itemInHand != null && itemInHand.hasItemMeta()) {
            NamespacedKey key_glace_freeze = new NamespacedKey(this.plugin, "modt-glace_freeze");
            NamespacedKey key_playerhead_whois = new NamespacedKey(this.plugin, "modt-playerhead_whois");

            if (itemInHand.getType() == Material.ICE && itemInHand.getItemMeta().getPersistentDataContainer().has(key_glace_freeze, PersistentDataType.DOUBLE)) {
                Player targetPlayer = (Player) clickedEntity;

                if (targetPlayer.hasPotionEffect(PotionEffectType.SLOWNESS) && targetPlayer.getGameMode() == GameMode.ADVENTURE) {
                    player.performCommand("unfreeze " + targetPlayer.getName());
                } else {
                    player.performCommand("freeze " + targetPlayer.getName());
                }
            } else if (itemInHand.getType() == Material.PLAYER_HEAD && itemInHand.getItemMeta().getPersistentDataContainer().has(key_playerhead_whois, PersistentDataType.DOUBLE)) {
                Player targetPlayer = (Player) clickedEntity;
                player.performCommand("whois " + targetPlayer.getName());
            }
        }
    }

Why is it doing the action in double?

#
    @EventHandler
    public void onPlayerRightClick(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        Action action = event.getAction();
        ItemStack itemInHand = player.getInventory().getItemInMainHand();

        if (itemInHand.getType() == Material.IRON_HOE && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)) {
            NamespacedKey key_hoe_vanish = new NamespacedKey(this.plugin, "modt-hoe_vanish");
            if (itemInHand.hasItemMeta() && itemInHand.getItemMeta().getPersistentDataContainer().has(key_hoe_vanish, PersistentDataType.DOUBLE)) {
                player.performCommand("vanish");
                event.setCancelled(true);
            }
        }
    }
chrome beacon
#

?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
}
worldly ingot
#

Alternatively, and preferably, make use of PlayerInteractEvent#getItem() or #getMaterial() and compare against that so you could support off hand clicking of the item too

#

While the hand check is useful, it also unnecessarily blocks functionality from the off hand, which might actually be useful

slender elbow
#

that bot message really needs a facelift

worldly ingot
#

It kinda does, yeah

#

Also, smh, public event handles

slender elbow
#

what, you wanna see my private ones?

#

perv

worldly ingot
#

WOAH WOAH WOAH

#

You want to make it public!? Chill out

slender elbow
#

it's protected territory

worldly ingot
#

I personally keep my package private

young knoll
#

I hate all of these puns

#

Go sit in the corner and think about what you’ve done

slender elbow
#

in private?

grand flint
jagged thicket
#

How does spigot handle circular dependency?

#

like in which order are the dependencies loaded if two different plugins want different orders

long ocean
#

Why was the event.getSpawnReason() in CreatureSpawnEvent for fish out of buckets changed to SpawnReason.DEFAULT? Is this purposeful or a glitch in the current version?

#

IMO this is bad, because now the plugin can't distinguish the difference between a natural spawning mob at night and a player action. I don't think they should all be grouped together as SpawnReason.DEFAULT.

jagged thicket
#

makes sense

sullen marlin
#

none of the reasons look obviously related to buckets to me, so I would love to know what it used to be. Also NATURAL and DEFAULT are two different reasons

lime pulsar
#

You know how when you type a command and it says in red your messing up? Is that possible in a plugin like with onTabComplete?

long ocean
long ocean
sullen marlin
#

Not sure I'd believe chat gpt

long ocean
#

Me either, just providing all i know.

#

But logically, i guess a fish bucket in concept is like a spawn egg from the creative menu.

sullen marlin
#

I'd be interested in knowing what it actually was, if you can show what it actually was and it's different then it's very easy to change (same with the natural spawning)

jagged thicket
#

md5 md_5

long ocean
# sullen marlin I'd be interested in knowing what it actually was, if you can show what it actua...

There is no current SpawnReason. that i can see which would fit fish from bucket. If i had to pick one that was the closest i would go with SPAWNER_EGG. And i agree that vanilla mob spawning in the wild because its dark should be NATURAL instead of the current DEFAULT. I can't show you what it used to be, as i have in my plugin the allowed methods of EGG, SPAWNER, and SPAWNER_EGG and can't remember which one of those was for fish in a bucket.

sullen marlin
#

could test an old version

long ocean
#

I don't know when it changed, might have to go really old. I just noticed today my fish weren't being spawned from a bucket so debugged the spawn reason.

sullen marlin
#

code on its face does look like it uses SpawnReason.NATURAL for spawning at night

long ocean
#

Okay, i made a mistake, testing again i see that mobs in the wild are showing SpawnReason.NATURAL.

main dew
#

I remember in 1.12.2 ocelot spawn egg sometimes spawn small ocelot from reason OCELOT_BABY

long ocean
#

But you can see, bucket fish are DEFAULT

lime pulsar
#

so default means by a standard game mechanic other than natural?

#

whats it say when you bread 2 animals?

#

err breed

long ocean
sullen marlin
long ocean
#

I dont have an old version, i just run buildtools all the time. Is there somewhere to download old jars? Or do i set something in buildtools to make it do an old version? And what version should i try? And what about client? How far back will MS let you roll back your client version to connect to an old server version?

sullen marlin
#

Forever

#

--rev (version)

#

Maybe try 1.19 or something to start? Whenever you think it was different

jagged thicket
#

wait lemme try

#

im gonna try 1.16

#

Here it is spawner egg in 1.16

#

@long ocean

sullen marlin
#

Nice

#

I'll fix

jagged thicket
#

alrr

#

thx

sullen marlin
#

Thanks

jagged thicket
#

broo i had to download jdk 16 to compile CryHard

long ocean
slow dagger
#

hello

#

i need some help

#

i have some problem

slim wigeon
#

How do I get the dispensers inventory?

slow dagger
#

the problem is itemsadder

#

can someone help?

blazing ocean
#

?ask

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!

slim wigeon
slow dagger
#

so

#

i installed the itemsadder plugin

jagged thicket
slim wigeon
slim wigeon
# jagged thicket from blockstate?

I at the phase to getting the items the miners mine. Currently it just breaks the block and sends it to the void. But I need to put the items in its inventory like its suppose to. I just need help getting the inventory, I can deal with the rest

slim wigeon
jagged thicket
chrome beacon
#

Inventory is part of the block state

lime pulsar
#

in = block.getState().getInventory()

chrome beacon
#

Do note that it (get state) returns a copy

#

And therefor needs to be manually updated
EDIT: turns out getInventory doesn't require this if the state belongs to a valid block. It's only required for getSnapshotInventory

slim wigeon
#

Wait, that is not working either. What in the f***?!

lime pulsar
#

show the line as you have it now?

chrome beacon
#

Did you do what I told you to

slim wigeon
#

This is the lineInventory inv = ((Container) block.getState()).getInventory();

lime pulsar
#

Inventory inv = this.block.getState().getInventory();

chrome beacon
#

That won't work

lime pulsar
#

what class is block?

slim wigeon
#

Its just the block in the world as shownthis.block.getRelative(0, -2, 0).getRelative(0, -(this.mineTrailPlaced-1), 0).equals(Material.BEDROCK)So if its suppose to work like you saying, there is no reason that the IDE should be throwing errors but it is

warm mica
#

== is fine for enums

slim wigeon
lime pulsar
#

how is block defined? is it Dispenser block or Block block?

slim wigeon
#

Block block

warm mica
#

Alternatively you may cast it to InventoryHolder

lime pulsar
#

if(block.getType() == Material.DISPENSER) Dispenser dispenser = (Dispencer) block.getState();

blazing ocean
chrome beacon
#

Not ideal

#

getState is an expensive operation so do keep the type check

blazing ocean
#

oh right the snapshots yea

chrome beacon
#

Yeah

lime pulsar
#

check out this nightnmare:

#

` static Chest getChest(Sign sign) {
Block signBlock = sign.getBlock();
if (signBlock.getBlockData() instanceof WallSign) {
WallSign signData = (WallSign) signBlock.getState().getBlockData();
Block attachedTo = signBlock.getRelative(signData.getFacing().getOppositeFace());

        if (attachedTo != null && attachedTo.getType().equals(Material.CHEST)) {
            Chest chest = (Chest) attachedTo.getState();
            return chest;
        }
    }
    return null;
}

`

slim wigeon
chrome beacon
#

I did already tell you what the issue is

#

But I seem to be ignored

#

So someone else can repeat it later I suppose

blazing ocean
#

trying to help them is just useless since they ignore any kind of input

#

wow my discord really crashed after saying that

lime pulsar
#

if its a dispenser from the get go why is it stored as a block?

slim wigeon
chrome beacon
lime pulsar
#

blindly casting is a bad habit

slim wigeon
lime pulsar
#

Dispenser dblock = (Dispenser) this.block.getState(); dblock.getInventory();

slim wigeon
#

Its still not working

lime pulsar
#

is inventory null?

#

or just empty?

slim wigeon
#

This is what its doing

#

This is the code where the block destroy occurs``` if( block.getType().isSolid() && !block.getType().equals(Material.BEDROCK) ) {
inv.addItem(new ItemStack(Material.STONE,1));

            block.getWorld().playEffect(block.getLocation().add(0.5, 0.5, 0.5),Effect.STEP_SOUND, block.getType());
            block.getWorld().spawnParticle(Particle.FLAME,block.getLocation().add(0.5, 0.5, 0.5), 10, 0.2, 0.2, 0.2, 0.1);
            block.setType(Material.AIR);
        }```
lime pulsar
#

inv.update()

slim wigeon
lime pulsar
#

like Olivo said

chrome beacon
#

Preferably the entire method

#

?paste

undone axleBOT
slim wigeon
slim wigeon
chrome beacon
#

^^

#

I was talking about the getState being a copy operation

#

It snapshots the state

slim wigeon
chrome beacon
#

It means that the changes to the block state won't apply until you call update on it

#

since it's a copy

#

Anyways I'm not a fan of how you're keeping a reference to the Block instance

#

You're probably better of holding the Location

#

and then getting the block if you need it

sullen marlin
jagged thicket
#

thx bro!!

slim wigeon
chrome beacon
#

hm?

#

That could still be done with the Location

#

You can get the block at the location if you want to check it

slim wigeon
#

If you saying I have to change how I program, you going to be blocked. I did what you asked when it comes to the dispenser check. You got my methods

chrome beacon
#

There's no need to be offended

pliant topaz
chrome beacon
#

Yeah

#

If you don't you can keep an old outdated reference to it

#

Also if you don't clean up you can leak much more memory by mistake

blazing ocean
lime pulsar
#

what if someone uses something liek worldedit to remove the dispenser?

#

then your still chugging away with your saved block and ...

chrome beacon
lime pulsar
#

I tend to use records when dealing with blocks so the block is always coming from an event or a location

bright spire
#

Hey guys! I am developing a plugin and I need to get materials from the player inventory.

This plugin should work on 1.8 to 1.21

My problem: If I dont set api version, it uses legacy materials. If I set api-version to 1.21, it doesnt work on 1.13, If i set api-version to 1.13, bundle stripped logs are took as normal logs.

How can I have 1.21 api-version behaviour while supporting 1.13?

#

I just want plain materials as they are

eternal night
#

you can't

#

like, the only solution would be two modules using pre/post 1.12 API

bright spire
#

Are you 100% sure? The problem is I am comparing 1.21 packets with the inventories, and if i set api-version to 1.13 the packets material's differ from the spigot's

eternal night
#

if you want to support 1.8, you need pre flattening material BS

bright spire
#

The problem is 1.21 and 1.18

eternal night
#

1.8 is fine if you set the API version

bright spire
#

Yeah the problem basically is the packet sent by player has a stripped log and if i set api version to 1.13 that stripped log in the spigot inventory is shown as normal log

eternal night
#

1.8 would not be fine if you set the api version to 1.21 and compile against 1.21 spigot

bright spire
#

No thats fine, the problem is another one

#

When comparing packet's material to server materials, if the api version is 1.13, the spigot's inventory materials differ

#

If the api version is 1.21 it works fine, but it doesnt run on 1.18

eternal night
#

so you have a plugin with api-version: 1.21
You run it on a server with spigot 1.18
And your difference is what?

bright spire
#

No bro

#

api-version 1.21 doesnt run in 1.18
api version 1.13 runs in 1.18 but stripped log is converted to normal log (this causes issues)

eternal night
#

mhm

bright spire
#

Is there a way to bypass conversion?

#

My other plan is to change api-version based on the server version... not sure if its possible

#

I think not

eternal night
#

only with a jar in jar approach

bright spire
#

Hmm

#

Is there a way to apply a conversion to a specific material?

eternal night
#

no the plugin does not have any say in the bytecode rewriting

#

could look into something like xmaterials

bright spire
eternal night
#

Material#valueOf iirc is rewritten too?
Tho only for pre 1.13 plugins

bright spire
#

I have to test

#

but i think not thx

#

are you sure there is no way to completely disable this api version behaviour?

eternal night
#

logic for that certainly exists

bright spire
#

i dont use materials at all, i just compare ones sent and received by clients

#

so they are fine, and do not need any touching

#

but spigot touches them for some reason

eternal night
#

I am honestly surprised it even explodes then when you specifc 1.13 as an API version

bright spire
#

stripped log is changed to normal log

eternal night
#

Well yea, thats what I meant with explosion kekwhyper

bright spire
#

ah okay

#

yeah I am basically making an antiexploit feature that compares materials sent by clients and the ones actually in the server

#

so you cannot just send any item

#

but the ones whitelisted

#

problem is when api-version is specificed to 1.13, they get converted and differ, causing a client kick

lime pulsar
#

so bots like ServerOverflow can't place bedrock everywhere?

eternal night
#

How are you getting the material

#

like, converting internals Item type to Material

bright spire
#

I think this was the culprit...

#

Using toString instead of name... gets the non-converted value, and using name to compare, gives a converted value

#

I will use toString always

eternal night
lime pulsar
#

1.13 is when they stopped using numeric IDs and started using names

#

you had to add --forceUpgrade to your startup flags so you could use an existing world

finite path
#

Hi guys, im trying to make an rpg game (Economy oriented) so I need to create a mining system.

The way I would like it is like on Hypixel Skyblock.

The animation should match the current phase and it should be compatible with a Mining Speed stat (a double) from my PlayerManager

If anyone could help me I would highly appreciate it.

young knoll
#

You have to redo mining server side

#

Or make use of the new mining speed attribute

finite path
#

Im on 1.18.2 so I dont think that attribute is an option for me

finite path
chrome beacon
#

Give mining fatigue to stop the clientside block break animation

#

and then send the packet for it yourself

finite path
chrome beacon
#

I forget what you need to set it to

#

Might have been a negative value

#

Mining fatigue 255 should work

finite path
#

Ahh, alright and how should I get into packets? (Possibbly trying to be using as least unnecesarry libraries as possible)

blazing ocean
#

?nms

chrome beacon
#

I do recommend PacketEvents or ProtocolLib

blazing ocean
#

packetevents >>>

finite path
#

Ohh hack, thanks guys

blazing ocean
# blazing ocean ?nms
public final class Packets {
    private Packets() {}

    public static void send(Player player, Packet<ClientboundPacketListener> packet) {
        var vanillaPlayer = ((CraftPlayer) player).getHandle();
        vanillaPlayer.connection.send(packet);
    }
}
young knoll
#

Yeah negative mining fatigue is the way

#

The only problem with the attribute is ideally you set it before they start breaking the block

#

Which means constant ray tracing to see what they are looking at :/

finite path
#

Meh, I dont even know what to do, how to even start it...

chrome beacon
#

Start by giving the mining fatigue to the player

#

Then detect that the player is trying to break a block

#

I don't think 1.18 has the BlockDamageEvent

young knoll
#

There’s a BlockDamageEvent for the start breaking

finite path
#

It has

chrome beacon
#

so might need packets for that

young knoll
#

Idk if BlockDamageAbortEvent is in 1.18 tho for stop breaking

finite path
#

It is

young knoll
#

Well there ya go

finite path
#

And what is the packet for the animation?

young knoll
#

Is Player#sendEffectChange in 1.18?

young knoll
chrome beacon
#

Yeah that exists in 1.18.2

#

Just checked

#

Neat might not need packets after all

young knoll
#

If you have all of those methods you won’t need any packets

#

SendEffectChange for client side mining fatigue
SendBlockDamage for damage
BlockDamageEvent for start breaking
BlockDamageAbortEvent for stop breaking

finite path
chrome beacon
#

hm sendEffectChange seems to be missing

#

Also does the effect need to be on client only?

young knoll
#

It makes it easier to calculate the progress on the server

#

Since you can use getBreakSpeed

#

But otherwise no

finite path
finite path
chrome beacon
#

yeah block damage is what you're looking for

#

block change is used for fake blocks

finite path
#

And yea effect change is just missing

young knoll
#

You might not have the one that allows you to specify the entity id for the damager tho

finite path
#

And which file should I use? remapped or remappd-obf

chrome beacon
#

Use the regular one

#

Don't use the jars with an extra prefix or suffix

finite path
#

Then why are they there?

chrome beacon
#

They're used during the build step

#

Some of the tooling uses the jar during the remapping process

finite path
#

But the main jar gets out first so it couldnt use it so im confused

blazing ocean
#

are you using paperweight

#

no wait they have a different classifier iirc

finite path
#

Noh Im using Spigot

wet breach
lusty wolf
#

can anyone help me with line 9 and 18 im getting errors ```
on death of player:
if victim's held item is a totem of undying:
set the cooldown of totem of undying for victim to 10 seconds
if {totemCooldown::%victim%} is not set:
cancel event
set victim's health to victim's maximum health
send "&aYou have been revived by the power of the totem!" to victim
play sound "entity.totem.use" to victim
play 10 of particle "redstone" at location of victim offset 0.4, 0.4, 0.4 with speed 0.05
set {totemCooldown::%victim%} to now
else if difference between now and {totemCooldown::%victim%} is less than 30 seconds:
send "&cThe totem's power needs to recharge! Try again in &e%difference between 30 seconds and (difference between now and {totemCooldown::%victim%})% seconds &c." to victim
else:
cancel event
set victim's health to victim's maximum health
send "&aYou have been revived by the power of the totem!" to victim
play sound "entity.totem.use" to victim
spawn 20 of particle flame for player at player offset by 0.4, 0.4, 0.4 with speed 0.05
set {totemCooldown::%victim%} to now

blazing ocean
#

this channel is for plugin development

lime pulsar
#

play 10 of particle shouldnt that be spawn?

#

and flame is missing "

#

flame for player at player. "flame" at player

lime pulsar
chrome beacon
#

Skript

#

They really should head over to the SkUnity discord and ask there

lime pulsar
#

Olivo! teach me how. to use Maven, im still using ant builder :p

chrome beacon
#

ant 💀

eternal night
blazing ocean
lime pulsar
#

I also use eclipse

chrome beacon
#

I haven't used Eclipse in like 7 years

#

As for maven it's quite simple to use and there are plenty of guides online

#

Feel free to ask if you get stuck on something

lime pulsar
#

k

glossy laurel
#

How to make an apple have the texture of a head without resource pack or make a head edible

remote swallow
#

use the new food component iirc

glossy laurel
#

1.21.4?

remote swallow
#

afaik yeah

hushed spindle
#

Inventory#addItem() seems to be changing the quantity of items added to it, how does that work?

slender elbow
#

it, uh

#

wdym how does that work lol

hushed spindle
#

like

chrome beacon
#

It is known that in some implementations this method will also set the inputted argument amount to the number of that item not placed in slots.

hushed spindle
#

why the fuck is the quantity changing

chrome beacon
#

From Javadoc

slender elbow
#

because what it couldn't add, it mutates the item to have the remaining amount

hushed spindle
#

this happens even with an empty inventory

#

both spigot and paper

lusty wolf
quaint mantle
hushed spindle
#

this game is trolling me

vast ledge
#

Maybe you have to update the itemstack in the inventory?

worldly ingot
#

I don't really understand what the problem is, but it's worth mentioning that addItem() will mutate the ItemStack you pass into it

#

If you pass in itemStack with stack size 64 but it could only fit 10 items into the inventory, that itemStack instance you passed will now have a stack size of 54

#

I wish it didn't mutate the stack but that's a whole other issue

#

If your problem is that you're expecting addItem() to keep reference to the item in the inventory and expect changes to it to automatically apply to the item stack, that won't work either. When you add an ItemStack to the inventory, what's being added is a copy of that item as an NMS ItemStack, not a Bukkit ItemStack. The only time where updating an ItemStack will reflect its changes in the inventory is if you have a CraftItemStack that is mirroring an NMS ItemStack, which usually you get from Inventory#getItem() or an event or something

warm pine
chrome beacon
#

Looks like you have a bad jar in your local maven repo

warm pine
#

I deleted the corrupted jar, it still does that.

chrome beacon
#

A couple of maven-metadata-evoke-snapshots.xml look bad as well

warm pine
#

Yeah, I tried deleting all the files in the 2.4.11-SNAPSHOT\ folder

chrome beacon
#

Could you send your pom

#

?paste

undone axleBOT
warm pine
remote swallow
#

did you add artifacts through intellij?

warm pine
#

I didn't add anything

onyx tiger
#

Dear revered SpigotMC members,

I hope this letter finds you all well. I am anticipative of this writing, as it will aid me in finding not only a new friend, but a fellow competent server developer. I already own a server of the highest caliber specifications. Budget is not a problem for me. With all this being said, I still do not want to enjoy this journey alone. For more questions please DM me.

p.s. I cover all server expenses + resources
tldr: i wanna friend who is also good at developing because it sucks doing stuff by yourself.

PLEASE DM

eternal oxide
#

?services

undone axleBOT
blazing ocean
remote swallow
#

reminds me of someone

eternal night
#

amen

onyx tiger
dense falcon
#

How may I remove the cd between hits like in the old pvp (in 1.8) in recent versions?

silver robin
#

is it normal that player's name tag disappears when i player.addPassenger(textDisplay) ?
1.21.4 and i'm not using any weird plugins just my own rn

orchid furnace
#

Is this still correct`
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);

silver robin
vast ledge
#

What is args?

orchid furnace
#

i meant like if it's still okay to use as it does say it's depreciated

orchid furnace
#

?

vast ledge
#

from what, a command?

orchid furnace
#

im making a report command

#

so i just pretty much need the name of the target

silver robin
orchid furnace
#

okay, ty ^^

forest hedge
#

Can anyone help me with creating spigot code in memory and then executing it?

vast ledge
#

What

#

How does one create spigot code in memory?

#

What is that?

silver robin
#

probably something like exec() in python or eval() in java
but why would one want to do that?

eternal night
#

*fun reasons Hackerman *

valid burrow
#

what exactly Are you trying to achieve?

vast ledge
forest hedge
eternal night
#

"something"

vast ledge
#

Test what?

eternal night
#

you'll need to elaborate

vast ledge
#

Define something

silver robin
#

that's probably a general java question more than spigot question

valid burrow
#

tell us exactly what you are trying to do

#

often the best solution is something you wouldnt even consider

forest hedge
eternal night
vast ledge
#

But why???

valid burrow
#

hes probably trying to make maleware

#

lolz

eternal night
#

little bit of malware sparkle

vast ledge
#

This sounds like the discord gansta with the remote rats :D

valid burrow
#

ratting a minecraft server gotta be one of the saddest things ever

#

i mean

#

most people dockerize their servers anyways

vast ledge
#

I mean I've played with the thought of somehow running code on runtime that can be edited

forest hedge
vast ledge
#

Then what

#

explain yourself

vast ledge
#

What's it called?

young knoll
#

Oh hey I did that

silver robin
forest hedge
vast ledge
#

tf is particle beam code

thorn isle
#

you'd typically do that with javascript rather than java

forest hedge
silver robin
# forest hedge Execute bukkit code which is sent in a discord channel

the overcomplicated way:
fetch whatever values you need from the discord channel
and then call the hard-coded method with those values
for example you make java public void iLikeThisFunction(Player player, float a, float b, int x, ...); and then java var data = fetchDataFromChannel(); iLikeThisFunction(data.getPlayer(), data.getA(), )

vast ledge
#

You're the first person ever to call Java code for Particles in spigot particle beam code

silver robin
forest hedge
slim wigeon
thorn isle
#

if you want to let admins super customize your particle effects, have them just write them in javascript and then execute it with nashorn or whatever

silver robin
#

that's how Skript works, no?

thorn isle
#

but that's overengineering it by quite a bit

#

well script has its own interpreter, it's a bit different

forest hedge
slim wigeon
#

Like a remote RCON?

vast ledge
#

make a command on discord that sends a ws req to your server and just have the server take the data it got and push into that method

young knoll
#

You can use jshell to add/modify code at runtime

forest hedge
vast ledge
#

Why not?

#

Are you trying to inject code?

forest hedge
vast ledge
#

You can't

#

that would break every server

#

if you could just inject code whenever you wanted

forest hedge
chrome beacon
#

I mean you can in certain versions with a certain RCE exploit

silver robin
chrome beacon
#

but what you're making does sound more like malware

forest hedge
chrome beacon
#

That doesn't explain anything

vast ledge
#

You're trying to hide some of the most simple code there is?

eternal oxide
#

WTH is a Minecraft Particle Beam?

vast ledge
#

or?

vast ledge
forest hedge
eternal oxide
#

If the code is to run at ANY time on the server it will be available to access.

forest hedge
#

And it doesn not allow me to upload an image so

chrome beacon
#

?img

undone axleBOT
#

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

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

forest hedge
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

slim wigeon
forest hedge
#

Cooked

vast ledge
#

just use imgur or smth

silver robin
# forest hedge Def not simple

like this? java public static void drawLine(Location from, Location to, int points, Color color) { World world = from.getWorld(); assert world == to.getWorld(); Vector adder = to.toVector().subtract(from.toVector()).multiply(1.0 / (points+1)); Location cur = from.clone(); for (int i = 0; i < points; i++) { spawnParticle(world, cur.add(adder), color); } }

vast ledge
#

We do not understand what you're trying to do

silver robin
#

to be fair, you've gotten us all confused. so don't expect anything

thorn isle
#

i haven't been readin

#

what does he want

silver robin
#

¯_(ツ)_/¯

vast ledge
#

We don'tknow

thorn isle
#

🤡

eternal oxide
#

We are not here to guess what you want to do. Explain it clearly and precisely.

silver robin
# thorn isle what does he want

chatgpt summary of this channel:

User "Object" is seeking help with dynamically creating and executing Spigot (Bukkit) code in memory. They want to run a particle beam effect by executing code sent through a Discord channel, rather than embedding the method directly in the plugin. This approach is intended to test the functionality while keeping the code hidden from someone who will receive the plugin.

eternal oxide
#

impossible

#

at some point it will be ran by the server so can be accessed

slim wigeon
#

I hope this is not what he is making otherwise I recommend everyone to learn programming to be safe

vast ledge
#

But still why are you trying to hide it?????

vast ledge
#

BLYAT

forest hedge
chrome beacon
vast ledge
#

If you're trying to make a line of particles from the sky to the ground at x position, you can use the code that was provided by @silver robin

forest hedge
silver robin
#

i'll remember
if the particle beam part is irrelevant, and all you want to do is hide code from friend, then use a java obfuscator

silver robin
vast ledge
#

wild pls send here @silver robin

silver robin
#

it's just your everyday particle effect, just with tons of different particles presumably to make it look nicer
expirable link

#

it makes sense if OP would like to hide the actual math from a friend

#

still, obfuscation is the way to go (said it like third time lol)

quaint mantle
#

Does anybody why even though i cancel my inventoryclick event i can still click the items and duplicate them? it gets cancelled but i duplicate it too?

rough drift
forest hedge
vast ledge
#

And if you don't want that, you can have the discord thing send the formula to the plugin or smth

rough drift
vast ledge
forest hedge
silver robin
forest hedge
#

Any tutorial

silver robin
#

@forest hedge please confirm that the part about 'particle beams' is irrelevant to what you trying to do

rough drift
vast ledge
#

he wants the formula to not be revealed

#

afaik

silver robin
rough drift
silver robin
forest hedge
# forest hedge Wdym?

only reason Im doing this is because of the particle beam I dont want my friend to have the code for it

thorn isle
#

it's going to run on his server so his server must have the code for it

#

period

quaint mantle
silver robin
# forest hedge Wdym?

i mean that it's not related to particle beams at all, it could be any other functionality....
for particle beams if you want to hide the maths then pre-calculate all coordinates and particles which should be spawned there at specific tick then just iterate through that list

rough drift
#

it's a thing of life, people will read & steal your code if given the chance

thorn isle
#

don't give him the plugin

rough drift
#

^^

thorn isle
#

that's the only way

forest hedge
thorn isle
#

it's still loaded

silver robin
thorn isle
#

he still gets it

#

whether you load it statically or dynamically or generate it programmatically; he gets it

vast ledge
#

It's that simple, nobody even needs your code ._.

rough drift
#

OR make the plugin make a get request to and endpoint which returns json for particle positions, sizes and colors and make it call every 1 tick and make sure it's on the main thread so the server waits frfr

forest hedge
chrome beacon
#

Your code isn't anything hard to make

#

also if it's your friend you can trust them, no??

vast ledge
#

I forgot the patse

#

?paste

undone axleBOT
rough drift
#

yeah this would work

#

not sure abt the millis one though

silver robin
#

it's a mayhem

#

also it's Particle.DUST instead of REDSTONE

vast ledge
#

Sir

#

i dont care

silver robin
#

ik nobody does either

rough drift
quaint mantle
# silver robin probably a dumb question from me but have you maybe forgot to```java player.upda...

Now its more buggy it cancels the first time but when i click the item again i can still duplicate it

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getWhoClicked() instanceof Player player) {
            if (Objects.equals(event.getClickedInventory(), player.getInventory())) {
                if (Cosmetics.isCosmeticItem(event.getCurrentItem())) {
                    System.out.println("Cosmetic Item clicked!");
                    event.setCancelled(true);
                    player.updateInventory();
                }
            }
        }
    }
silver robin
vast ledge
#

Im trying to show how simple it is to re-create what he wants, so theres no point in obfuscating it or using a friggin api endpoint as if it was important data that cannot be on the local machine

silver robin
#

do you really think the dev wanted to hide this code?

thorn isle
#

oorah oorah

rough drift
thorn isle
#

what are those, beacon beams or text displays

vast ledge
rough drift
#

beacon beams are clientside

rough drift
silver robin
#

also @quaint mantle are you sure that it's not just a visual ghost item? or if you're in creative mode then

silver robin
silver robin
#

(it's not my video or plugin....)

rough drift
quaint mantle
rough drift
#

talking about the author

silver robin
#

creative mode is weird

#

it allows clients to just spawn any kind of item

#

with any nbt data

#

so it's actually a desync problem

#

but the server "accepted" that item you pulled out of the inventory, if you were in survival it would disappear

#

using a specific cheat client on creative servers to spawn heads, barriers, dragon eggs and command blocks was cool back in 2015

#

or a minecart with command block which was a force OP exploit 😄

slim wigeon
silver robin
#

paid and open source don't really go together but whatever

chrome beacon
#

They definitely can

silver robin
#

yall made me double check it lol the 'Source Code' link leads to just the wiki and not source code

slim wigeon
thorn isle
#

unfortunately songoda plugins aren't worth the money even if you get them for free

#

and the source code is an active cognitohazard

slim wigeon
#

Just making a point. That is what came to mind when @silver robin said paid and open source don't go together. But you right, Songoda are not worth the money. Its unrelated to this current talk

thorn isle
#

another example is mcmmo

silver robin
#

and xenforo, a website forum framework, allows you to even edit code after buying it

slim wigeon
#

...

ivory sleet
#

ofc its nowhere near enterprise standard

ivory sleet
#

🏃‍♂️

blazing ocean
#

con when you gonna do the jd thing

ivory sleet
#

i started it

silver robin
blazing ocean
#

@Contract("random") is what gets me the most

rough ibex
#

nullable notnull

valid burrow
rough ibex
#

wheres @EqualsAndHashCode

echo basalt
#

I feel like instead of functions you should make them all just functional interfaces and assign them to variables

#

so instead of this.whatever it's this.function.run()

#

cached functions woOo

rough ibex
#

LRU caches in the house tonight

ivory sleet
echo basalt
#

I mean we avoid being point-free

#

every function call has a .

ivory sleet
#

point free has nothing to do w kotlin :c

echo basalt
#

aw

#

I swear you can't just runnable()

#

unless I got the memo wrong

ivory sleet
#

one day 🙏

echo basalt
#

I was gonna look something up and now I forgor ffs

slim wigeon
#

I found my issue with the inventories. I was compiling to the wrong plugin. Was set to the farmRod (Not related to the miner)

#

So its fixed now

#

As a note, I still using "Block block" and it still inserts the item, no .update() required

chrome beacon
#

Yeah I did note that

#

getInventory vs getSnapshotInventory got them confused for a bit

#

Though I still feel it's a bit odd that getInventory actually refers to the block and not the state snapshot that you call it on

slim wigeon
chrome beacon
#

You can get most of the information from the javadoc

slim wigeon
chrome beacon
#

Doesn't need to really

smoky anchor
#

I feel like that's the job of the programmer, piece it all together ?

thorn isle
#

myes

#

can't be spoonfed every little thing

#

an example here and there is fine but mostly it's just up to the programmer to read the docs and put the things together in such a way that it does what they want it to do

slim wigeon
# chrome beacon Doesn't need to really

Example of what I mean

PHP Date<?php echo "Today is " . date("Y/m/d") . "<br>"; echo "Today is " . date("Y.m.d") . "<br>"; echo "Today is " . date("Y-m-d") . "<br>"; echo "Today is " . date("l"); ?>I got the code from w3schools. So if this was spigot api, you think it will help most people?

lime pulsar
#

if i need an example i just ask leo in brave

thorn isle
#

and to be fair there are the spigot forums, where for years people have been asking mostly stupid questions and some good samaritans have spoonfed them answers

lime pulsar
#

yea leo finds that stuff for you 😛

thorn isle
#

off the top of my head i could maybe name 3-4 finicky bits about the api for which you need or want to copy paste an impl from someone who's already spent 10 hours fiddling with it

#

one of them would be to get scoreboard sidebars updating correctly without flickering

#

but that isn't really the api's fault; it's a client problem

#

generally just the docs are sufficient

remote swallow
#

Learnspigot be like

dense falcon
#

How may I remove the cd between hits like in the old pvp (in 1.8) in recent versions?

worldly ingot
#

You'll want to add an AttributeModifier either to the player or to the item they're using for the ATTACK_SPEED attribute

#

Higher the number, faster the player can attack. I believe it's full strength attacks per second or something, so if you just do an ADD_NUMBER operation with a value of like 100, it will work fine

young knoll
#

Yeah it’s attacks per second

mortal vortex
#

Is there a method for a plugin to retrieve a path to itself in the filesystem?

#

Actually I should probably explain why. I want to generate a hash of the installed plugin, to check for modifications.

worldly ingot
#

JavaPlugin#getFile()? Is that what you're looking for?

mortal vortex
dense falcon
worldly ingot
#

The constructor is a bit simpler now. Should be able to use (NamespacedKey, double, Operation, EquipmentSlotGroup)

#
new AttributeModifier(
    new NamespacedKey(pluginInstance, "attack_speed_1_8"),
    4.0, // Might want to make this a bit higher. Up to you though
    AttributeModifier.Operation.ADD_NUMBER,
    EquipmentSlotGroup.ANY
);
worldly ingot
#

Can use toPath() if you want an NIO path

dense falcon
#

Thanks.

mortal vortex
#

'getFile()' has protected access in 'org. bukkit. plugin. java. JavaPlugin'

worldly ingot
#

Mhmm. It's protected :p

mortal vortex
#

Reflection time?

worldly ingot
#

You can only use it from within JavaPlugin. If you want to use it externally, I guess a hacky workaround would be to make your own method in your plugin class called something like getPluginFile() and just return getFile() lol

#

No no, just a wrapper method

mortal vortex
#

out of the mainclass?

worldly ingot
#

Outside the plugin class, yeah

ivory sleet
#

I wanted to say override and make it public - but god forbid

worldly ingot
#

You can't open access KEKW

mortal vortex
worldly ingot
#

Sure you can

#

I'm confused

mortal vortex
#

I'm confused.

ivory sleet
#

abbev is it ur own JavaPlugin subclass?

mortal vortex
#

All I'm doing is this right now:

private String generatePluginHash(JavaPlugin plugin) {
        try {
            File pluginFile = plugin.getFile();
            if (pluginFile == null || !pluginFile.exists()) {
                return "UNKNOWN";
            }

            MessageDigest digest = MessageDigest.getInstance("SHA-256");
            try (FileInputStream fis = new FileInputStream(pluginFile)) {
                byte[] buffer = new byte[8192];
                int bytesRead;
                while ((bytesRead = fis.read(buffer)) != -1) {
                    digest.update(buffer, 0, bytesRead);
                }
            }

            byte[] hashBytes = digest.digest();
            StringBuilder hexString = new StringBuilder();
            for (byte hashByte : hashBytes) {
                hexString.append(String.format("%02x", hashByte));
            }
            return hexString.toString();
        } catch (Exception e) {
            return "ERROR";
        }
    }
worldly ingot
#
public class MyPlugin extends JavaPlugin {

    public File getPluginFile() {
        return getFile();
    }

}

public class MyCommand implements CommandExecutor {

    private final MyPlugin plugin;

    public MyCommand(MyPlugin plugin) {
        this.plugin = plugin;
    }

    public void onCommand(too lazy, to fill, out the, parameter list) {
        File file = plugin.getPluginFile();
    }

}
#

Yeah it will have to be your own instance instead of just JavaPlugin

#

If you're wanting to do this generally for other plugins, then yes, you will have to use reflection

mortal vortex
#

In my plugin, I have:

this.plugin = plugin;
``` in the constructor already.
worldly ingot
#

Yeah, note I'm defining it as MyPlugin though instead of JavaPlugin

mortal vortex
#

OH i see what yo'ure aying.

worldly ingot
mortal vortex
#

IM FUCKING EDGING

#

Thank you

worldly ingot
#

Oh okay

small kestrel
#

can someone help me i am trying to make that the player is getting a colored message but its a error

worldly ingot
#

Likely using the wrong ChatColor. You want the one from net.md_5.bungee.api

#

Or whatever the package is :p

mortal vortex
#

"or whatever"?? chud. do you not respect the work of our good lord md5?

small kestrel
#

im very new to coding so i wont understand much

worldly ingot
#

Are you using any other ChatColors in that class?

#

Like ChatColor.RED, etc.?

small kestrel
#

uhm lemme check

#

yes

mortal vortex
worldly ingot
#

So instead of ChatColor.of, use net.md_5.bungee.api.ChatColor.of()

ivory sleet
small kestrel
#

k

worldly ingot
#

You have to wrap getFile() instead

ivory sleet
#

yea you can

worldly ingot
#

You're making me double check

ivory sleet
#

:,)

small kestrel
#

can i just use &4 or some other formatting code from minecraft

ivory sleet
#

im pretty sure if u have a non-final protected (maybe pack priv also) method, subclassing will allow u to override and open access

worldly ingot
#

The #of() method in the bungee package is for RGB colours

mortal vortex
#

I dont like the name translateAlternateColorCodes.

#

I just have a method called "bob" which is a wrapper for translateAlternateColorCodes. Bob is more pleasant.

small kestrel
worldly ingot
worldly ingot
small kestrel
#

thx for your help

ivory sleet
worldly ingot
#

No you're right lol. Not a nitpick

worldly ingot
# worldly ingot ```java public class MyPlugin extends JavaPlugin { public File getPluginFil...
public class MyPlugin extends JavaPlugin {

    @Override
    public File getFile() { // Access from protected -> public
        return super.getFile();
    }

}

public class MyCommand implements CommandExecutor {

    private final MyPlugin plugin;

    public MyCommand(MyPlugin plugin) {
        this.plugin = plugin;
    }

    public void onCommand(too lazy, to fill, out the, parameter list) {
        File file = plugin.getFile();
    }

}
#

It becomes this instead, my mistake

#

(good to leave a comment next to those so people don't think you're stupid for redefining a method and just calling super PeepoDumb)

mortal vortex
#

cant believe a mfer asks one question, and 2 people argue back and forth for 30 minutes. /j

#

what is this mental illness?

worldly ingot
#

Conclube and I? Cause he was just right KEKW I had my access knowledge backwards

young knoll
#

Conclube: 1
Choco: 0

#

Tune in next time for round 2!

ivory sleet
#

💀

#

choco wont have mercy on me next time

worldly ingot
slim wigeon
#

How can I add a list of items to a inventory?

inv.addItem(block.getDrops()) <!-- Errored

thorn isle
#

i could give you a direct answer but in favor of actually learning something, let's see what the error is

#

this goes back to the whole "the programmer is supposed to put the things together" thing; what you have here is a cube and a circular hole, and you need to do something with the cube to make it fit

slim wigeon
#

I just did, thanks

slender elbow
worldly ingot
#

YEAH FUCK YOU @ivory sleet!!!

slender elbow
#

public_getFile()

slender elbow
#

I didn't need to read that Toni

#

ght

ivory sleet
worldly ingot
#

NO, IT'S NON FINAL

#

FUCK YOU EMILY D:

#

Probably final in Paper or something

ivory sleet
#

lol

#

hahay ye good point

surreal wadi
#

the placeholder spi is working but we can't download the expansion

sullen marlin
#

you own hypixel?

surreal wadi
#

bro it's hypixel's lobby

slender elbow
#

swear it was

#

like I'm dead convinced

#

I've been making bridge methods for it this whole time for no reason xD

quaint mantle
outer tendon
#

Hey does anyone know how I might be able to go about building my own world generator that just makes changes to the world generation that is already made? I've been looking at the ChunkGenerator and BlockPopulator classes; I may be wrong, but it looks like BlockPopulator only works with blocks added in after chunk generation, and any overrided ChunkGenerator seems to default to a void generator, and so I am unable to work with the default generation using it as I know how to. Anyone have any advice?

sullen marlin
#

But otherwise a populator should be fine, not sure what the concern you have is

ashen crane
#

Hey guys, I wanna create a detection system to detect if you're inside a certain zone or not, but these zones will be very small as its for detecting if you're on top of very small structures generally, is there anything you think i could look into to help with this implementation? It needs to be a bit optimized since there can be a lot of these in the world at once

mortal vortex
#

And maybe define your small zones as axis-aligned bounding boxes

mortal vortex
#

wait thats maven

#

idk why i asked

#

@warm pine cant you just delete your maven cache??

#
[WARNING] The metadata C:\Users\ammar\.m2\repository\com\github\technicallycoded\FoliaLib\main-SNAPSHOT\maven-metadata-evoke-snapshots.xml is invalid: unexpected markup <!d (position: START_DOCUMENT seen <!d... @1:4) 

I mean it kind of gives you an indication here.

warm pine
#

I did it several times

smoky oak
#

how do i tell a beacon 'hey you're at y=-60'

old stone
#

Hello someone has alreeady done custom world generation and know how to handle biome transition regarding noise values (e.g terrain height) ?
I'm using LERP with smoothstep for the step of the lerp, for the X and Z axis on biome edges with a blendfactor of 10 and then I average them but I have an artefact problem where I have werid spikes comming out

mortal vortex
old stone
#

perhaps I can do it another way ?

mortal vortex
#

No, thats the right way. sometimes people do it incorrectly.

#

What operations are you already doing?

old stone
# mortal vortex What operations are you already doing?

Basically, I have a loop that checks 10 blocks ahead if there is a biome change, if it finds one it uses smoothstep & LERP to redefine the height if the noise at this location, and then breaks the cycle. Since the generateNoise function is called for each block. It works well with only X, when I put Z, I have as I said artifacts

#

I've also try weighted average like so

        for (int i = 0; i < k ; i++) {
            Biome biX = baseBiomeProvider.getBiome(worldInfo, worldX + i, worldInfo.getMaxHeight() / 2, worldZ);
            Biome biZ = baseBiomeProvider.getBiome(worldInfo, worldX, worldInfo.getMaxHeight() / 2, worldZ + i);

            if(biX != currentBiome || biZ != currentBiome) {
                float t = WorldUtil.smoothstep(0.0f, 1.0f, (float) i / (float) k);

                int caveTopX = biomeServiceFactory.getBiomeService(biX).getCaveTop(worldX, worldZ);
                int caveTopZ = biomeServiceFactory.getBiomeService(biZ).getCaveTop(worldX, worldZ);

                double smoothCaveTopX = WorldUtil.lerp(caveTopX, caveTop, t);
                double smoothCaveTopZ = WorldUtil.lerp(caveTopZ, caveTop, t);

                double deltaX = Math.abs(caveTopX - caveTop);
                double deltaZ = Math.abs(caveTopZ - caveTop);

                double totalDifference = deltaX + deltaZ;
                double weightX = totalDifference > 0 ? deltaX / totalDifference : 0.5f;
                double weightZ = 1.0f - weightX;

                caveTop = (int) (smoothCaveTopX * weightX + smoothCaveTopZ * weightZ);

                break;
            }
        }

But it doesn't work quite well, I still have artifacts

#

and with the normal arithmetic average I have

mortal vortex
#

do you also notice like incosistent blending when it comes to diagonals?

old stone
#
        for (int i = 0; i < k ; i++) {
            Biome biX = baseBiomeProvider.getBiome(worldInfo, worldX + i, worldInfo.getMaxHeight() / 2, worldZ);
            Biome biZ = baseBiomeProvider.getBiome(worldInfo, worldX, worldInfo.getMaxHeight() / 2, worldZ + i);

            if(biX != currentBiome || biZ != currentBiome) {
                float t = WorldUtil.smoothstep(0.0f, 1.0f, (float) i / (float) k);

                int caveTopX = biomeServiceFactory.getBiomeService(biX).getCaveTop(worldX, worldZ);
                int caveTopZ = biomeServiceFactory.getBiomeService(biZ).getCaveTop(worldX, worldZ);

                double smoothCaveTopX = WorldUtil.lerp(caveTopX, caveTop, t);
                double smoothCaveTopZ = WorldUtil.lerp(caveTopZ, caveTop, t);


                caveTop = (int) (smoothCaveTopX + smoothCaveTopZ) / 2;

                break;
            }
        }
mortal vortex
#

Have you tried a cubic or quintic interpolation?

old stone
#

i'm gonna show you

old stone
#

Because I have the feeling that the problem here comes from the way smoothCaveTopX and Z are handled together

mortal vortex
#

Weighting should have worked.

old stone
#

I'll send you images in DM because I cannot send here

#

note that k = 10

#

and int caveTop = biomeService.getCaveTop(worldX, worldZ);

#

with BiomeService biomeService = biomeServiceFactory.getBiomeService(currentBiome);

#

just gives me basic settings for each biomes, (here just a number which is the caveTop)

old stone
old stone
smoky oak
#

according to the wiki beacons only care about horizontal distance, limited by simulation distance
according to mojanks code as in spigot, this doesnt work downwards

lime pulsar
#

did you try update?

old stone
smoky oak
#

i do not have the beacon effect if im below it

nova notch
#

thats just how vanilla works, no?

smoky oak
#

isnt it supposed to give the effect down too?

nova notch
#

im pretty sure i researched it and it looked like it doesnt cus i was gonna put a beacon above my base and realized it wouldnt work

#

let me double check

#

oh ok i was partially right

#

so it actually goes infinitely upward but only like 20 blocks below

smoky oak
#

thats such nonsense bruh

nova notch
#

yeah it honestly makes no fucking sense but it is what it is

smoky oak
#

hm

#

can you turn the beacon beam invisible

nova notch
#

probably with a texture pack

#

or just like manually apply the effect

fickle spindle
#

now everything work properly sry for bothering 🙂 thanks

wet breach
wet breach
#

it gets a bit tricky because the beam is mostly client side

#

but it is doable

mortal vortex
placid estuary
#

how can i create a clickable text component with multiple in the same message?
I tried this, but i get a "IllegalStateException: zip file closed" exception on the sendMessage line

BaseComponent acceptComponent = TextComponent.fromLegacy(ChatColor.translateAlternateColorCodes('&',  "&a&l[Accept]"));
        acceptComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duel accept " + from.getName()));
        acceptComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("/duel accept " + from.getName()).create()));
        BaseComponent rejectComponent = TextComponent.fromLegacy(ChatColor.translateAlternateColorCodes('&',  "&c&l[Reject]"));
        rejectComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duel reject " + from.getName()));
        rejectComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("/duel reject " + from.getName()).create()));
        BaseComponent[] component = new ComponentBuilder("")
                .append(acceptComponent)
                        .append("  ")
                                .append(rejectComponent)
                                        .create();
to.spigot().sendMessage(component);
pliant topaz
wet breach
blazing ocean
blazing ocean
#

in a recent snapshot they killed core shader defs so you can't even add uniforms anymore, they're dictated by their new render pipelines 😭

#

dinnerbone why

young knoll
#

Maybe we’ll get core shaders 2.0

blazing ocean
#

they said that in a couple previous snapshots before too

worldly ingot
# placid estuary how can i create a clickable text component with multiple in the same message? I...

You shouldn't be mixing legacy colour codes with components. You're at least using fromLegacy() but still not ideal. Something like this would work

BaseComponent message = new ComponentBuilder("")
    .append(new ComponentBuilder("[Accept]")
        .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duel accept " + from.getName()))
        .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("/duel accept " + from.getName())))
        .color(net.md_5.bungee.api.ChatColor.GREEN)
        .bold(true)
        .build()
    )
    .append(" ")
    .append(new ComponentBuilder("[Reject]")
        .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duel reject " + from.getName()))
        .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("/duel reject " + from.getName())))
        .color(net.md_5.bungee.api.ChatColor.RED)
        .bold(true)
        .build()
    )
    .build();
to.spigot().sendMessage(message);
#

I also don't remember if the run command action requires a forward slash or not in its value. I don't think it does but I could be wrong

#

(the ISException is possibly the use of the deprecated HoverEvent constructor, note I used Text instead of passing in a component)

worldly ingot
#

Stupid >:(

placid estuary
#

ill give it a go, one moment

rough drift
#

Since they are being run from chat, commands must be prefixed with the usual "/" slash, and player must have the required permissions. In signs, the command is run by the server at the sign's location, with the player who used the sign as the command executor (that is, the entity selected by @s).

https://minecraft.wiki/w/Text_component_format#Java_Edition > interactivity > click event > action

fickle spindle
#

why everytime i do the command /worldcreate void hello
it send this error in console [13:17:01 ERROR]: No key layers in MapLike[{}]

the code behind the command is this:

public class testcreate implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] arg) {
    if (commandSender instanceof Player) {
        Player player = (Player) commandSender;
        if (arg.length == 2) {
            if (Bukkit.getWorld(arg[0]) == null) {
                switch (arg[0]) {
                    case "void":
                        WorldCreator wcvoid = new WorldCreator(arg[1]);
                        wcvoid.type(WorldType.FLAT);
                        wcvoid.generator(new EmptyChunkGenerator());
                        wcvoid.createWorld();
                    case "flat":
                        WorldCreator wcflat = new WorldCreator(arg[1]);
                        wcflat.type(WorldType.FLAT);
                        wcflat.createWorld();
                }
                commandSender.sendMessage("World " + arg[1] + " created");
            } else {
                player.sendMessage("aready exist");
            }
        } else {
            player.sendMessage("Correct usage /worldcreate <void/flat> <world name>");
        }
    }
    return false;
}
}

class EmptyChunkGenerator extends ChunkGenerator {

    @Override
    @NonNull
    public ChunkData generateChunkData(@NonNull World world, @NonNull Random random, int x, int z, @NonNull BiomeGrid biome) {
        return createChunkData(world);
    }
}
eternal oxide
#

that error is known

#

it can be ignored

#

google

lost matrix
#

Was about to say that. If the world generates, just ignore it.

thorn isle
#

this is like the third or fourth major release in which this happens

#

they should just attach a log filter by default at this point that drops any records containing MapLike

smoky anchor
#

And destroy most datapack errors ?

thorn isle
#

if that's what it takes

fickle spindle
grim hound
#

Are there any ultra-small generative models?

valid burrow
#

they are also ultra-ass

thorn isle
#

how do you define ultra-small

quaint mantle
#

microscopic

smoky anchor
#

About 🤏

silver robin
#

this is an enlarged version: .

grim hound
lost matrix
grim hound
lost matrix
#

Ah

grim hound
#

For a minecraft plugin tho, yes

lost matrix
#

You could pull a StableDiffusion model straight from HuggingFace. No need to distribute it with your plugin.

#

How are you planning on loading the model?

#

I honestly think it might be better to simply define a standardized endpoint in your config. The user then has to select if he wants to start a model locally in api mode, or if he simply
pays for an online service. There are two standard api implementations for rest endpoints afaik.

#

But maybe you can find a Quantized StableDiffusion 1.5 Model that is around a GB

grim hound
grim hound
#

How much memory does it consume?

lost matrix
#

Inference will always consume a couple of GBs. And generating an image on your CPU will also take several minutes.

#

Ive seen it run on a raspberry pi, consuming around 6GB of ram for a single generation.

#

This is probably the lowest you can get with the base model:

from diffusers import StableDiffusionPipeline
from PIL import Image

pipe = StableDiffusionPipeline.from_pretrained("../stable-diffusion-v1-5", low_cpu_mem_usage=True)
pipe = pipe.to("cpu")

prompt = "a black tree with golden leaves painted by Monet, autumn"
image = pipe(prompt, num_inference_steps=30, width=512, height=512).images[0]

image.save("output.png")

Requires the user to have Pyhton, Diffusers and Torch installed.

#

Honestly, you can probably quantize an SD 1.5 model. But this requires quite a bit of tinkering and knowledge about quantization.

thorn isle
# grim hound How much memory does it consume?

depends a bit but typically the size of the model itself, could be a little bit less because there's metadata in the file and could be a bit more if the weights don't align with native data structures

#

because at the end of the day inference is just crunching the weight numbers with a smaller set of transient numbers

#

if you have 250mb of weights, then it'll use 250mb of memory

#

all that said huggingface also offers free-to-use endpoints so it probably doesn't make much sense to bundle it into your plugin

blazing ocean
thorn isle
#

just call their api (and probably let the user specify an api token in case they want to get the paid-for rate limits) and use that

blazing ocean
#

or just use the openai api

#

or just don't use ai

thorn isle
#

that costs money

blazing ocean
#

right, models aren't free to train and run either

thorn isle
#

huggingface requires an account and an api token, but usage is free

#

of course you're competing with 5 billion other free users so it can be quite slow

#

and if you use some fringe model nobody else uses it'll take like a minute for it to get loaded from the void realm

blazing ocean
#

i love having 5 billion api consumers

valid burrow