#paper-dev

1983 messages · Page 2 of 2 (latest)

hollow glen
#

:)

true flint
#

Intellij sometimes is just dumb

visual prism
#

Is there a way to open another inventory without closing the first one? Like when you click an item in the inventory, it will open another inventory and when closed it will return me to the old one

#

Without manual work

tender relic
#

no

buoyant barn
#

its not hard to store a stack of open menus 😭

hollow glen
#

if you control the menus, sure, but if you don't then it gets iffy

twin sable
#

yeah this is how my gui setup works

#

just a stack of inventories

buoyant barn
#

we even have a button util around it

bitter pythonBOT
#

I store the history in my GUI library too (but only of GUIs created through the library. Vanilla inventories or other plugins would not be easy to support automatically)

buoyant barn
#

oh yeah not at all

twin sable
#

yeah, all the custom inventories my plugin is managing are created by it

golden estuary
#

is there a way to check which player used the campfire? CampfireStartEvent doesn't report on the player who started it, but i think the player is the only entity that can cook on a campfire, so idk why its not included in hat event

bitter pythonBOT
#

you can probably just use the interact event

golden estuary
#

yeah that was my second thought, just wanted to make sure there wasnt another way

hollow glen
#

wellllll

#

yeah no nvm

vagrant tree
#

What causes CustomBossEvents to be stored on a world's level.dat file. Deleting all bossbars from Bukkit.getBossBars() doesn't result in them being removed from any actual file that I can tell

ebon plover
#

@halcyon briar @tulip urchin

tender helm
hollow glen
#

because since the storage format change, those are no longer stored there, and when upgrading from a previous version they are moved out into its own file (data/minecraft/custom_boss_events.dat) and removed from the level.dat

rancid apex
#

Is it better to create a runnable that executes after a set amount of ticks, or make 1 runnable that runs every tick and waits for the correct time?

For context I am trying to create an animation to chest GUI.

bitter pythonBOT
#

depends on how high the frequency is

#

in which you would have to schedule new tasks I mean

#

also is the animation important enough that you need to decouple its framerate from your server's tick rate?

rancid apex
# bitter python depends on how high the frequency is

It's a library so can't tell how it'll be used in the future (the frequency can be changed when building the animation freely). Could be as often as every tick, but I don't think anyone would even notice the changes at that point..?

rancid apex
#

but wouldn't that create a lot of packets for changing the inventory? (would that even be an issue?)

bitter pythonBOT
#

I mean, that would start being an issue once you go over the network speed of the server xD

#

also it sounds like you expect changes every "tick" so a task timer would be best for that tbh

rancid apex
#

I have no idea how much bandwith updating a single inventory takes

bitter pythonBOT
#

you could potentially do some extra calculation to see if the next frame is very far in the future and cancel the timer and schedule a task but I doubt it's worth it in most cases

rancid apex
rancid apex
#

ig I'll just keep everything on 1 timer, since that's probably the cleanest in terms of the logic and performance anyway.

tiny storm
#

It's funny

austere niche
#

If the Minecraft server and the website are hosted on the same VDS and both are public, what is the best way to set up communication between the website and the server? How can we ensure that players purchase in-game items on the website and receive those items on the server? Data exchange between the website and the server must be two-way, meaning the Minecraft server must also be able to send data to the website at any time. What would be the best approach?

hollow glen
#

weren't you suggested to just read/write to the database directly, like, two days ago?

#

or yesterday

bright flame
#

Rest is probs fine

austere niche
bright flame
#

Or that not sure what your entire problem is

vagrant tree
hollow glen
#

you can't get rid of the section entirely i don't think, but removing the persistent bossbars will empty it for sure

idle sentinel
#

Hi, is there any clear way in papermc api to disable invulnerability ticks (3 seconds) on join? Doesn't appear as if noDamageTicks, and it appears like setting isInvulnerable = false right before player.damage(n) has no effect either. The only source I found on this that had any helpful information was a spigot forum post from 2012 pointing at NMS

#

I'm trying to prevent rejoin exploits as well as immediately deal damage to the player from combat log functionality I've implemented, but it doesn't seem possible, as the server insists on forcing the player to be invulnerable

twin sable
tender helm
#

I thought mojang got rid of invulnerability on join

hollow glen
twin sable
austere niche
tender helm
#

I know they got rid of it in a snapshot, I want to say 1.20?

idle sentinel
#

in my checks with runTaskLater, it still seems to be 60 ticks until isInvulnerable gets set to false; in that period, I cannot disable it whatsoever

tender helm
#

Maybe it didn't stick though

twin sable
#

hmm

idle sentinel
#

I'm on 1.21.11, and player.damage does nothing unless I wait ~60 ticks, shrug

tender helm
#

Easy workaround for the combat log stuff, just kill them in the quit event 😄

#

You tried to escape battle, you lost

#

Even easier fix: pvp=false

lament venture
#

that property got turned into a gamerule semi recently

queen plinth
#

Heya, does Entity#setVelocity(vector) not work on ItemDisplays?

spare yarrow
#

ItemDisplays can't be moved iirc

novel radish
#

Displays basically kinda don't tick on the server, so no

spare yarrow
#

yeah

weary topaz
#

What data component type manages attack cooldown?

idle sentinel
hollow glen
queen plinth
#

Okay, that sucks. I have the following problem:

  • I want moveable ItemDisplays as part of player controlled vehicles (think cars, helicopters and such)
  • I'm currently teleporting the display every tick to make everything work (works as intended)
  • Sadly, depending on some random things (I suspect connection speed and latency), the entity visually rubberbands for some players (vanilla and modified)
    It makes the whole experience much worse, before the switch to display entites we used armorstands, which still rubberbanded, but much less.
    Any ideas or suggestions on how to improve this are welcome
hollow glen
#

you'd add an attribute modifier for that attribute to the item if you wanted to control it

winter anvil
#

they do that

idle sentinel
#

yeahh I could read source code

novel radish
#

ah, yea, attack cooldown is 100% attributes, I don't think that there is something else there, you'd need to add an attribute to offset the players own attribute value

weary topaz
#

ouch

#

even with the ItemAttributeModifiers datatype?

novel radish
#

I mean, there is a component to apply attribute modifiers to a item, yea

hollow glen
#

that's where you store attribute modifiers for items, yes

novel radish
#

There is just no direct means of setting a value

idle sentinel
#

it's marked as an experimental api, but I do it like this, I think that's what you want:

override fun applyModifierInternal(name: String, item: ItemStack, value: Double) {
    val builder = item.attributeModifiersBuilder()
    val slot = item.type.equipmentSlot.group

    builder.addModifier(
        Attribute.ATTACK_SPEED,
        AttributeModifier(
            getNamespacedKey(name, slot, "attack_speed"),
            value,
            AttributeModifier.Operation.ADD_NUMBER,
            slot,
        ),
    )

    item.setData(DataComponentTypes.ATTRIBUTE_MODIFIERS, builder.build())
  }
winter anvil
#

paper plugin dev first step: disable experimental warning for project

weary topaz
#

Does setting the assetId actually change the itemstack's item? For example would changing a itemstack with no attribute modifiers asset id from a netherite helmet to a diamond helmet change the armor points?

hollow glen
#

the asset id only affects the visual model

#

it doesn't alter the equipment mechanically

queen plinth
weary topaz
tender helm
#

They'll always lag behind unless they're mounted to the player somehow

#

You can potentially do tricks to minimize that but you can't make it smooth no matter what

past bramble
#

tho not sure if marker armor stand ticks, but you get the idea

queen plinth
#

I think we disabled armorstand ticking

tiny storm
#

You simply need to transform all of the displays from the player origin, which requires a bit of math, but it's doable

past bramble
tiny storm
queen plinth
tiny storm
#

Why wouldn't it be possible?

tender helm
#

You can have more than one passenger mounted to a player, no?

tiny storm
#

Yeah ^^

tender helm
#

Don't make the player mount the entity, make the entities mount the player

#

Other than the seat I guess if you're looking for vehicle controls

queen plinth
#

What if there are multiple seats? I don't think I can mount the texture to all of the players

tiny storm
#

In that case I would just say mount it to the primary player (like the driver) and give the other players corresponding velocity to the main one

#

It might look a big janked, but it will definitely not rubberband

past bramble
#

you may also play around with per player entities and packets

tiny storm
#

That could also be a possibility, though that would add one more dimension to the transformation of the displays

#

Not a big deal, but can be a bit hard to get right at first

past bramble
#

like, create the helicopter entity for each player, offset them per the player, and then mount the other passengers client-side with some offset tricks

queen plinth
#

... I have to get some paper and draw this lol

open tendon
#

or a minecart, apparently minecarts interpolate over 5 ticks instead of the typical living entity 3 ticks

#

anyways... ping me for client interpolation questions. i've dealt with this code a lot

queen plinth
#

Very crude paint thing

#

When the main thing is teleported, every seat recalculates its new target location by using the new main location and adding the offset

#

Controls use Player#getInput, which in turn are parsed into custom vehicle control events, which in turn are checked on the driving manager thread to adjust the new location of a currently active vehicle

open tendon
#

is the player mounted on the itemdisplay, or the itemdisplay mounted on the player?

queen plinth
#

Player on the ItemDisplay

winter anvil
#

how do luckperms auto detect permission nodes? do they hooked into haspermission check or what

abstract raven
open tendon
hazy fog
#

how can i put sword in actionbar?

#

or any item

novel radish
#

sprites, see the object component

hazy fog
#

this right?

twin sable
#

yep

hazy fog
#

thank u

trail crystal
#

when were sprites added (as in mc version) ? and how exactly would this typa sprite look on older versions before sprites existed?

novel radish
#

was fairly recent, and well, idk how handling of invalid/incompatible components works

tiny storm
#

1.21.6 I believe

novel radish
#

I think it sorta just ignores them but I might be wrong on that front

tiny storm
#

Or it could be .8

#

One of those

#

Oh I am lying

#

1.21.9

open tendon
# queen plinth Thank you <:CH_Thanks:813431949154451496>

Are you sure that you are doing it right? I asked codex to simulate this for me using a headless client and it's returned that mounting a player on a display entity didn't affect it's interpolation. The most likely scenarios are that you didn't set the interpolation metadata to be the same on all of the item displays, or are somehow moving/updating the item display the player is on differently than the other item displays.

dawn kiln
#

So that pre creature spawn event fires for all natural spawns?

tender helm
#

Yes

dawn kiln
#

I had no idea. That will be a huge help for me. Thank you.

tender helm
#

Like it says listen to the normal one too but if you block at the pre event the regular one won't even happen

#

And the pre one is more efficient

queen plinth
# open tendon Are you sure that you are doing it right? I asked codex to simulate this for me ...

I'm pretty sure I'm doing it right. It's not always lagging behing, just sometimes. Sometimes, a restart of the server causes this problem for some players to appear and for others to disappear.
Entity metadata:

// Main
itemDisplay.setInterpolationDelay(0);
            itemDisplay.setInterpolationDuration(3);
            itemDisplay.setTeleportDuration(1);
// Seat
itemDisplay.setInterpolationDelay(0);
            itemDisplay.setInterpolationDuration(3);
            itemDisplay.setTeleportDuration(1);
tender helm
#

It's still a bad idea to use events to block spawns rather than turning down mob caps and such, this just hurts less

dawn kiln
#

I have a per player monster spawn toggle they can use. I don’t have any other option.

#

Oh it seems I was already using that event. That sucks. No performance increase for me today.

dawn kiln
#

Exactly what method am I looking at?

arctic geode
#

setAffectsSpawning

dawn kiln
#

But then they lose animal spawns as well.

tender helm
#

Animal spawns don't really happen, they're a myth 😛

#

Unless you're doing it on purpose

dawn kiln
#

I have mine increased.

tender helm
#

worldgen spawns are pretty much guaranteed to put you over the stock limit and breeding farms will keep you over the limit even if you kill off the rest

dawn kiln
#

Would that setAffectsSpawning create a significant performance increase over just canceling the pre spawn event?

tender helm
#

iirc the spawning loop starts with players, not chunks

#

So you'd just skip that iteration of the loop entirely

dawn kiln
#

I’ll look into it. I tried using that method once and stuff was spawning anyways.

tender helm
#

I dunno, read the source code

dawn kiln
#

Yea I’ll look into it when I get a chance. I hope you’re right.

arctic geode
#

yes, it's better than canceling normal spawn event

#

but still ideal way is to not have all those lookups at all

dawn kiln
#

👍

#

I’ll give it a try when I can.

open tendon
# queen plinth I'm pretty sure I'm doing it right. It's not always lagging behing, just sometim...

when it occurs for a player, does it permanently occur for that vehicle? If so, then the issue lies with the item display metadata being lost somehow. if it occurs until the vehicle stops moving, then you aren't sending these packets close enough together or in a place that ends up delaying some packets between the client's ticks, basically splitting when the client knows it should interpolate the display entity. If it's the later, you can use a bundle packet to force the client to process interpolation in all the same ticket to ensure that all display entities interpolate the same way.

#

bundle is simpler than bundle delimiter to deal with

#

or otherwise update all displays at the same time on the server such that the packets are sent close to one another. don't update the one the player is on, then start calculating how everything else should behave. Calculate first, then send all at once

queen plinth
#

I'm not calculating packets, I'm actually spam teleporting everything using Entity#teleport. Currently, the main entity is being calculated and teleported first (necessary so the seats know the new « center » location), then all seats are looped (max should be 15 on the huge bus)

#
Vector movementVector = vehicle.getMovementVector();
            Location resultLocation = mainStand.getLocation().add(movementVector);
            resultLocation.setYaw(vehicle.getYaw());
            if (!mainStand.getLocation().equals(resultLocation)) {
                vehicle.setLocation(resultLocation, false);
                VehicleUtils.setEntityLocation(mainStand, resultLocation);
                movedVehicles.add(Pair.with(mainStand, vehicle));
                
                for (VehicleSeat seat : vehicle.getAllSeats()) {
                    if (seat.isSpawned()) {
                        VehicleUtils.setEntityLocation(seat.getEntity(), seat.getAlignedLocation(vehicle));
                        movedVehicles.add(Pair.with(seat.getEntity(), vehicle));
                    }
                }

                vehicle.addDrivenKilometers((float) (movementVector.length() / 1000f));
            }

That's basically all the movement code, getMovementVector() checks for collisions/terrain/.... setEntityLocation is from a time when you still needed the special flag to keep the passengers

vague iron
#

Whats the current method to remove this when display name is empty? ItemFlag.Hide_Attributes?

normal island
#

you can just hide the tooltip entirely

novel radish
#

See the tooltip display component

#

ItemMeta won't work for that

#

(ItemFlags are especially deprecated)

vague iron
#

ahh okay, thank you!

open tendon
serene cosmos
#

SniffCraft time! I feel obligated to mention this just due to its name

#

make sure you are on 26.1 though, I remember a bug related to display entity passengers and the interpolation being fixed there just recently

queen plinth
#

Ahhh, that could be the issue. Server is not on 26.1 yet, but very soon

true flint
#

why SniffCraft isnt a paper fork that only allows sniffer entities

#

damn <@&748618676189528155>, ty!

granite latch
#

Why is it, that whenever I try to schedule a task, it throws an error saying my plugin tried registering a task while disabled, even though from what I can tell the plugin is enabled. I am very new to this so sorry if I'm missing something really obvious

[23:00:24 ERROR]: Could not pass event PlayerJoinEvent to Swagmobo v1.0-SNAPSHOT
org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register task while disabled
tender helm
#

Did you do it from your plugin's constructor or onLoad method?

#

You have to do it from onEnable or something called later than that

granite latch
novel radish
#

server logs?

#

I mean, the thing is fairly explict in how it checks for a plugin being disabled or not

tender helm
#

Although thinking about that more if you were able to register the event handler that means you at one point called the register at the right time but your plugin got disabled later

#

But it didn't get disabled the normal/right way since it left stale event handlers behind which sounds like something hacksy is going on

granite latch
#

In the logs it never showed that it had been disabled and also still shows green in /pl

serene cosmos
#

are you using the bootstrapper?

#

All I can think of is that your plugin instance somehow became null

#

If you don't specifically need paper-plugin features (registry editing), I would stick to normal bukkit plugins for now

hollow glen
#

what does your plugin code look like?

#

the main class

granite latch
#
package gg.justservers.swagmobo;

import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents;
import org.bukkit.plugin.java.JavaPlugin;

public final class Swagmobo extends JavaPlugin {

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new TestListener(), this);
        this.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, commands -> {
            commands.registrar().register(GuideCommand.createCommand().build());
        });
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
tender helm
#

Oh you did make it to the event handler, I'm clearly too Friday'd out for this conversation

novel radish
#

and the code for the TestListener?

granite latch
#

im scared to release ts 🙏

novel radish
#

The fact that you don't pass in the plugin instance to the test listener screams that you're probably calling runTaskLater with something totally wild instead of your plugin

hollow glen
#

yeahh

tender helm
#

oh they probably do new Swagmobo() in there

granite latch
#

Thanks LOL

#

Fixed it

quartz nacelle
#

Is there a way to restrict access to the creative mode inventory? I basically only want to allow them to use specific blocks and not have access to everything.

serene cosmos
#

nope

#

the inventory is entirely client-side, its a glorified /give command

#

you can use the InventoryCreativeEvent to cancel item creation, but that will look very buggy to the player

tiny storm
#

I am impressed

granite latch
tiny storm
granite latch
#

At least I gave it a shot, eh?

tiny storm
#

I would've probably ended up answering your question if I had seen it earlier too

#

You seem to be doing quite well though

#

Constructing a new plugin instance is not an unheard of mistake, that can happen, don't worry about it

granite latch
tiny storm
#

Well, commands, for example, are a topic some people seemingly cannot wrap their heads around, most notably with brigadier

#

You have knowledge from it from Skript, sure, but the Java side of things can still turn out relatively complex

granite latch
tiny storm
#

Were the Paper docs helpful at least?

cursive crypt
#

As your lawyer I advise you not to answer that question.

tiny storm
cursive crypt
#

I make joke. Strokk is docs team.

granite latch
granite latch
modest oxide
# tiny storm Were the Paper docs helpful at least?

i find the paper docs very helpful personally though i wish they had more constructive and building content (def opinionated though)
like, maybe they teach you to make smth a lá the rust book’s example projects, eg a kitpvp plugin or a simple skyblock plugin using modern papermc best practices
i say that since while i thinm the docs do a great job telling you about the breadth of content, you’re sorta left on your own to compose them in my experience
and since many ppl getting into mc modding are learning how to program alongside this, it might be nice to give pointers
they are good docs tho im a fan

novel radish
#

I mean, that would more be an example repo rather than something that really belongs in the docs

#

otherwise you basically end up writing a course, and that's more sorta full time "I get paid for this" levels of dedication

somber verge
#

are there particle libraries that have built in effects

serene cosmos
#

EffectLib does

warped coral
#

I'm getting a very weird issue. I've been thinking it was an error in my own code, but after a lot of messing around I'm starting to think it comes from Paper.
My server is running the latest version of Paper (26.1.2 65-stable) and my plugin has the exact same version in dependencies
I put a stack of 64 white wool in a chest in slot 0, nothing else in any other slot.
When I get the source inventory from an InventoryMoveItemEvent and log the result of getContents() to the console, I get this

[ItemStack{WHITE_WOOL x 1}, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]

It clearly says there's only one white wool in the chest, even though there's clearly 64.

#

Is this the intended behaviour or did I actually find an issue?

warped coral
spring haven
warped coral
#

it's how I discovered it, I was testing my filtered hoppers plugin I've been maintaining for a while

spring haven
#

I was able to reproduce it. Dropper > Chest seems to work fine

warped coral
#

should've specified that at the start, mb

spring haven
#

so chest > hopper > dropper?

warped coral
#

I mean chest to hopper*

#

I had chest > hopper > chest

spring haven
#

So, apparently this is intentional. Right before the event is called, the count of the ItemStack that is about to be moved is changed (Math.min(level.spigotConfig.hopperAmount, originalItemCount)). ~~No idea why this is done tho. ~~You could change the hopper-amount value in the spigot.yml config to 64 to "fix" the issue.

spring haven
warped coral
spring haven
#

It happens for both hopper push and pull actions

warped coral
spring haven
#

net/minecraft/world/level/block/entity/HopperBlockEntity.java:271

warped coral
#

thanks

spring haven
#

hopperPush and hopperPull are both part of the hopper optimization patch, and I may not 100% understand all of the changes. But, changing it so that we copy the original item stack into the moved item stack (so no mutation of the underlying container when changing the amount of the moved item stack to Math.min(level.spigotConfig.hopperAmount, originalItemCount)), allows to properly read out the inventory contents of the InventoryMoveItemEvent. From my testing, this doesn't break anything. This wouldn't help you for now, @warped coral, but maybe it's something that can be changed to fix the issue with the event.

warped coral
#

aaaand nevermind

spring haven
warped coral
#

I wonder, is it the actual inventory or a snapshot of it?

spring haven
#

the actual I believe

warped coral
#

dang

#

if it was a snapshot I would've gotten the location, block, blockstate, tilestate and then its inventory

#

I have thunk up a new work-around

#

instead of using my own logic (which was meant to work-around Minecraft's logic of checking only the first occupied slot, which I needed it to check the entire inventory for my filter to properly apply instead of getting stuck), I'll revert to normal minecraft logic when it's the first occupied slot

winter anvil
#

how can I prevent entity moving at all like set its AI to false?

#

is cancelling the entity move event enough?

last gazelle
winter anvil
#

that's why I ask

last gazelle
#

What do you want from its AI that it can do without movement?

winter anvil
#

some other custom logics

#

they can still rotate though

merry zealot
#

maybe messing with mob goals might suit your use case, you could remove their pathfinding goals

last gazelle
#

"maybe" could be avoided with a clear explanation of the XY

spring haven
upbeat marsh
#

I'm making a custom gui and it gets darkened, what is the cause and how can i fix it?

karmic citrus
#

By default titles are gray

upbeat marsh
#

oh, that was one of the things i would've never thought of

#

ty

golden estuary
#

is there a "time since last death" i can check for Player? thought maybe getTicksLived would display that but it doesnt seem to get reset on death

lament venture
#

there's a time since last death statistic

lethal edge
#
MenuType.MERCHANT.builder()
    .merchant(villager)
    .checkReachable(false)
    .build(player)
    .open();

When I open a menu for the player like this, the villager’s reputations don’t work. Is this a bug, or is there another way to do it?

upbeat marsh
#

there's like a pixel of a black line, what might cause it? the texture itself doesn't have it, and it's not the default gui under it

karmic citrus
upbeat marsh
#

bro u might be my life saver

karmic citrus
bright flame
bright flame
#

Thanks a lot 🙏

brittle marten
#

what is the bukkit representation (probably enum) of humanoid arm (left or right)

lethal edge
bright flame
brittle marten
#

the bukkit representation of net.minecraft.world.entity.HumanoidArm

brittle marten
bright flame
brittle marten
#

it's used in the protocol to tell the server which hand the player has selected for main hand

#

none?

bright flame
brittle marten
#

oh

#

thanks

bright flame
#

Found it not sure if this is what yoh want

brittle marten
#

I think it is

queen plinth
#

Heya, how do I get the path to the world folder itself? It used to be World#getWorldFolder#getPath, but now it adds ./dimensions/minecraft/overworld/ to it

spring dew
#

Hey is paper anti Xray good and how is it different from others?

queen plinth
cursive crypt
lucid canopy
#

-# ~~Is there a way to dynamic utilize something like that but on a per player case? I guess the best way is to build a complete tree but just for the one player as executor permission? And with that, I currently don't see how I would get the dispatcher - ~~
-# Nevermind, I just steal store the commands dispatcher from the lifecycle until I find the api method to get it later since I can't use the commands instance. Removing also works when you finally don't always use the wrong name ^^
-# The only problem is that the console can't use the command (it is not registered in the bootstrap phase) but at least players can /execute as them.

However, I got an actual issue I thought I had seen on GitHub but can't find it:

getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, commands -> {
      commands.registrar().register(Commands.literal("getPlayersName")
        .requires(stack -> stack.getExecutor() instanceof Player)
        .executes(context -> {
            final Player executor = (Player) context.getSource().getExecutor();
            assert executor != null;
            context.getSource().getSender().sendMessage("Players name: " + executor.getName());
            return Command.SINGLE_SUCCESS;
        }).build());
  }
);

restults in
[14:11:00 ERROR]: Command exception: /execute as @n[type=!minecraft:player] run aethosevents:getPlayersName java.lang.ClassCastException: class org.bukkit.craftbukkit.entity.CraftArmorStand cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.entity.CraftArmorStand and org.bukkit.entity.Player are in unnamed module of loader java.net.URLClassLoader @179d3b25)

#

So either I messed up with the tree or the execute really does not care about the requirements?

tiny storm
#

That's very fun

#

I do have to say that I have encountered similar before. In my cmd lib I actually double-ensure executor validation by putting in the instanceof check inside the .executes method as well, just in case something goes wrong

#

I do not know what causes that behavior though

lucid canopy
#

Yeah ok no, Inverting the condition lets me use the command from the console and executes it correct.

#

`> execute as TheosRee run getPlayersName
[14:19:30 INFO]: Players name: TheosRee

getPlayersName
[14:19:31 ERROR]: Command exception: /getPlayersName
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because "executor" is null
`

karmic citrus
tiny storm
karmic citrus
#

Yeah but idk how much it's made to take this into account, since vanilla only checks the sender

tiny storm
#

My IntelliJ froze when opening a project

lucid canopy
karmic citrus
karmic citrus
tiny storm
#

To me it smells more like the /execute as is being problematic here

hollow glen
#

what if you register during bootstrap

tiny storm
#

Me?

hollow glen
#

sure why not

#

and try with /execute as as well

grand cave
hollow glen
#

no

tiny storm
#

Very interesting for sure

#

It seems /execute as @e[type=!player,limit=1] run only-player from the player actually might've run it for the non-player entity

#

Since no error message is present

karmic citrus
grand cave
tiny storm
hollow glen
#

iirc the ones available in RegistryKey

karmic citrus
#

In the registry class

karmic citrus
hollow glen
karmic citrus
lucid canopy
tiny storm
#

I am actually not able to get any debug debug logging in the .requires method for some reason

#

Like none at all

#

Oh now it worked

#

But only for the console

#

Oh nevermind, I am just stupid, I misplaced me sout call

#

(it only caught it if no player was present, duh)

#

Yeah so this is interesting

#

That smells an awful lot like unintended behavior

karmic citrus
tiny storm
#

It's still a bug?

lucid canopy
#

It pretty much is a bug?

#

At least way more a bug than removing the commands from the dispatcher results in them no longer in the tab complete but still executable :/
-# not related to the execute issue

karmic citrus
# tiny storm It's still a bug?

Yeah, but unlikely that it's gonna be fixed, especially since looking at it, the parsing is done completely separately from execution, so the as takes effect after the whole chain is done. This is most probably a big rewrite to fix it

lucid canopy
#

So the execute passes its current executor/sender to the other command before resolving the as part?
This then gets denied and nothing is done.

tiny storm
#

Something like that

lucid canopy
#

Kinda understandable respecting the existence of @e..
-# performance wise at least

karmic citrus
#

Yeah it would kill the performance to recheck this all for every entity

tiny storm
#

Would it?

karmic citrus
tiny storm
#

I don't think running one predicate more or less will change the outcome by a lot if you run some command for a thousand entities

#

Yeah but I feel like the command itself will be much heavier

karmic citrus
#

And also that it may end up resolving to a different node otherwise, which wouldn't be available for the recheck anymore

lucid canopy
#

More like, you would need to evaluate it for each character?

tiny storm
#

Like at that point you are not bottle-necked by running one predicate

lucid canopy
karmic citrus
tiny storm
lucid canopy
karmic citrus
lucid canopy
karmic citrus
#

It's much faster to parse the command 1 time at datapack load and then run it with different executors

tiny storm
#

You already have the nodes, lol

karmic citrus
tiny storm
#

You just construct a different CommandSourceStack (as is already done, considering the .executes correctly uses it) and re-check each node's requires predicate with it

tiny storm
#

There's no need to re-parse the same thing a thousand times for each entity

#

Unless I am massively misunderstanding you here

karmic citrus
lucid canopy
#

But when I have one node that requires a player and a same named one that only works without? That would break then when I interepret what you wrote correct?

karmic citrus
#

Also I feel like this is way beyond what should be in this channel

tiny storm
#

But why would having a different executor change the node output from parsing

karmic citrus
# tiny storm Why?

Because, in your example, one time a node is available and you can check it, another time it isn't

#

Every time you need to recheck the string to make sure that you consider all further nodes

tiny storm
lucid canopy
#
commands.registrar().register(Commands.literal("newCommandAtRuntime")
    .requires(stack -> stack.getExecutor() instanceof Player)
    .executes(context -> {}
    .requires(stack -> !(stack.getExecutor() instanceof Player))
    .executes(context -> {}

like that
-# edit: yeah, that does not work at all as it gets overrriden even when defining the literal multiple times

tiny storm
#

That's not how that works?

lucid canopy
#

Yeah, that is shortened with the actual node name, it was more for the visual

edgy plank
#

I often find putting player executor requirement in requires predicate to be useless, given that /execute as exists

tiny storm
#

The predicate values change per-executor, sure, the predicate instance does not

karmic citrus
#

It's a huge headache that vanilla doesn't need. Plugins can just properly check stuff in executes

tiny storm
#

Maybe the one time I could see this being a problem could be something like this: ```java
Commands.literal("cmd")
.then(Commands.argument("for-op", word())
.requires(source -> source.getSender().isOp())
.executes(...))
.then(Commands.argument("for-non-op", word())
.requires(source -> !source.getSender().isOp())
.executes(...))

But that's also kinda oddly specific
#

I have never encountered a situation or heard of another person who encountered a situation that would require something like that

karmic citrus
tiny storm
#

But isn't it much more problematic if we assume that the /execute as will leak the predicates here entirely?

#

Even if we were to re-parse the command string each time, I doubt that the problem will be in the performance of the parsing logic

karmic citrus
#

If you just add revalidation of requires in execution that could already add tons of overhead to small servers that has something like incendium

tiny storm
#

Why would incendium be affected

#

I thought that's a world gen datapack

karmic citrus
karmic citrus
tiny storm
#

But do all of those commands contain /execute ... commands?

karmic citrus
#

Yeah

#

In a datapack almost every command is an execute one

#

Commands are ran by default with no context like an entity or world so they need to get that

tiny storm
#

Are you sure though that no parsing is done in runtime when a command is executed?

#

I don't know much about datapacks, but I know that the requirements are checked for console commands each time they are ran as well

#

I could very well see that datapacks commands have to go through the same fate as well, as predicates, even if only checking the sender, can change during server runtime

#

I mean, my "fixing" suggestions is just something like this:

execute at 25 0 25 as @e[limit=2] run tp ~ ~2 ~
│       │          │
│       │          ├ executor: sheep, loc: 25 0 25
│       │          └ executor: pig, loc: 25 0 25
│       │
│       └ executor: none, loc: 25 0 25
│
└ executor: none, loc: default

Whenever a fork, redirect, forward statement occurs, the next nodes are simply parsed with the new source stack objects, it's not like the information isn't already present.

This would also mean that for a command, which doesn't do any multi-target forking, the parsing speed stays exactly the same

#

And it's only the next nodes, which are forked, that get parsed multiple times, not the full thing

tiny storm
#

Yeah let's leave the discussion at that

#

I know you wanted to move on a while ago, I apologize for continuing

radiant steppe
#

Are there any recommended GUI libraries?

bright flame
radiant steppe
#

Gotcha. Figured I'd see what we already have available instead of rolling my own and missing edge cases. I'll take a look at those first though, thank you!

bright flame
hollow glen
#

i'm surprised y2kwastaken wasn't taken

radiant steppe
#

Oooh, you have support for Anvils

#

Well that makes the choice easy

karmic citrus
civic prawnBOT
radiant steppe
#

Oh yeah, that is a thing

#

I need my stuff to be Geyser compatible though, so I may or may not make that choice

radiant steppe
#

...it's time to reconsider a lot of choices I was going to make then

karmic citrus
urban vector
#

hi guys im a bedrock server developer and i wanna set up a paper server to learn to make plugins and such can anyone help me start?

#

ive never played java btw

white treeBOT
#

To create plugins, learning Java beforehand is like learning how to write before creating a novel - it's an essential part of the process.

There is no shortcut to learning programming, just as there is no single, definitive way to approach it. Everyone learns differently. One of the best ways to learn is by doing and actively applying what you're learning as you go.

Learning Resources:

bitter gale
#

is there no way of detecting player right clicks whilst theyre consuming an item??

#

like i have an item thats being consumed i want to know if theyre holding right click

last gazelle
#

What else would they be doing?

bitter gale
#

player interacts only actiavtes on the start of the right click hold

last gazelle
#

But then it wouldn't consume the item..? I'm confused about your use case.

bitter gale
#

the item is a watering can

#

im using the bow pull anim

#

but like i want to know when the player is holding so i can release a stream of water

last gazelle
bitter gale
#

thanks

bitter gale
#

it doesnt get right click no?

last gazelle
#

Ah right, I thought left and right were mouse inputs but they're left and right movement. My bad

bitter gale
#

all good

dim hatch
#

Hey all, I just got started with coding paper plugins recently and I am trying to make a really simple VoidGenerator for my Overworld and nether. I know how to extend the chunkgenerator class and make a VoidChunkGenerator Class, but how do I use it for my main world? :(

The only ways I have seen people make it work is making a new world with a new worldcreator object. But I want my existing "world" and "world_the_nether" to use this chunkgenerator, how do I do this?

If anyone could help me I would be very thankful

bitter gale
#

ahh thanks

#

also is there a way to see documentation in intellij for setData

#

i have no idea what to put for the args sometimes

#

item.setData(DataComponentTypes.ATTACK_RANGE, );

#

like i dont know if this is expecting a float or something

last gazelle
#

The DataComponentType is generically typed with the class that should be an argument

bitter gale
#

oh lovely okay

#

or would i use the builder

last gazelle
bitter gale
#

thanks

last gazelle
#

That'll set it without you having to create the world manually

dim hatch
#

like this?

#

can I do this before the world generates or just delete my current world?

last gazelle
#

Yeah you'll need to set it and then delete the existing world

dim hatch
#

ahh ok thank you so much

#

do i need to do something with the voidgenerator class in my on enable function too? or is having the class seperately enough

last gazelle
#

Probably do lol

#

Not sure what

dim hatch
#

haha ok

#

i think ill find that out theres another papermc voidgen where the code is on github

#

thanks tho

last gazelle
dim hatch
#

this is actually a great resource thanks

#

guess i have to do this in onenable

#

or outside perhaps

limber forge
#

BlockPistonExtendEvent and BlockPistonRetractEvent return List<Blocks>. How to get new locations of these blocks?

hollow glen
#

just, +1 in the direction the piston is facing?

#

+1 for extends, -1 for retract

true flint
#

what was the name of the thing that i can set some persistent data to the player itself?

grim fern
#

persistentdatacontainer?

true flint
#

does that support disconnect/restart ? 🤔

#

i usually use db stuff for that but i think i can use that now

grim lagoon
#

yeah as the name states, it is persistent data

true flint
#

PlayerQuitEvent doesnt fire when server shutdown right, i'll just use onDisable() i think

dim hatch
#

Anyone has an Idea how to spawn in SkyBlock islands under players? How do you even go about this? Is there like a structure spawning command and u can add ur custom structure to it?

grim fern
#

Can I register or remove commands during runtime?

turbid iron
cursive crypt
modest scaffold
#

How to make a CustomModelDataComponent Object and set it to the item meta of an item stack?

karmic citrus
granite latch
#

I tried making a few interactions where if a player right-clicks with a certain item, the item is removed from the player's inventory and does something, however, when I put the item in my off hand, the item is not removed and I can just keep doing it forever.
Also, how can I remove just one of an item from the player's inventory because I just realised the method I'm using removes all of that item from the inventory.

tiny storm
#

This is the method for removing just one of the item. If the item count is 1, the item just disappears

radiant steppe
#

Can Bukkit.getWorld be called on any thread? No operations are done on the world beyond using it for a Location constructor arg

modest scaffold
#

Ok i fixed it with Custom Model Data but idk why but my pivot (ItemDisplays) spawns not on the block above it spawns in the block

echo terrace
#

can you setup your environment so when you are debugging your plugin relocation is disabled, but enabled for production builds?

modest scaffold
#

wdym?

echo terrace
#

i am talking about shadowJar relocation for dependencies. it breaks hotswap

lament venture
#

what i've got inside the shadowJar task in my projects is

val disableRelocation = project.hasProperty("idea.debugger.dispatch.addr") || project.hasProperty("disableRelocation")

if (!disableRelocation) {
    <relocations here>
}

in theory it auto detects the debugger but i still start the server task with runServer -PdisableRelocation=true

echo terrace
#

project.hasProperty("idea.debugger.dispatch.addr")
does this also work?

#

oh i didnt read

tawny zodiac
visual prism
#

Can I make the narrator of Minecraft say something to the person? Like send voice messages

serene cosmos
#

That's client side, no

vast crater
#

Can you load configurations such as a Configurate config inside the plugin bootstrap?

grim lagoon
dawn kiln
#

How can you make custom biomes with sky, water, and plant colors with a plugin?

edgy plank
#

well, not with the API at least, unless you were to just embed a datapack in your plugin (which is what most people do)

civic prawnBOT
edgy plank
#

though main issue with it is that you have to override overworld gen for the biomes to show in your main world, and that is a lot of trouble

#

say you want to modify something about the biome, now you're stuck with the old gen

#

so, if you're gonna do it, you're going to have to do a lot of testing before putting it in prod

dawn kiln
#

Is there no way to just change sky color?

#

I feel like there is probably a way with NMS.

#

Would it be possible to send a packet to a client to trick it into changing the sky color?

open tendon
#

chunk packets refer to existing biomes for sky colors

bitter gale
#

how do i get for liquids when a player is right clickingliquid with player interacts?

open tendon
#

at the very least you can send biome data for a chunk to the client now without resending the chunk

#

You still have to register the biome on the configration phase of protocol, you can't just start adding new biomes while the player is playing the game

#

Right clicking liquid? What do you mean right clicking liquid, you can't right click liquid

#

the only time you can do that is with a lilypad

#

i don't recall if the player sends an interact when right clicking without targeting a block as it's changed per version before

stark gyro
#

would it be triggered as right clicking the air?

bitter gale
#

doesnt seem to be doing so

stark gyro
#

PlayerInputEvent could work then

#

wait no thats movement

bitter gale
#

is there an equivilant to Player#getTargetBlockExact

#

but for liquids

stark gyro
#

Player#getTargetBlockFace has a FluidCollisionMode parameter, that should do it

#

looks like that just runs a ray trace tho

#

getTargetBlock probably runs one too anyways

#

getTargetBlockExact also has that parameter too

#

this channel is for programming plugins, not finding them, sorry

midnight carbon
#

in my code when players join the server, the packet responsible for sending the player's own GameProfile and the GameProfiles of other players is changed to send a different GameProfile#name

this PR seems to have changed how Player command suggestions are provided.

not 100% sure if this PR was responsible for the change, but this is as far as I could trace it going back through the src and commits. Version 1.20.4 was able to provide actual server-side player name suggestions, while in 1.21.4, the client receives the perceived names, from the initial packets it got when the client first logged in. why is this?

stark gyro
#

Probably because player names are recieved from mojang servers and UUIDs are what actually identify a player

#

idk how it all works though, but that's my guess

midnight carbon
# stark gyro Probably because player names are recieved from mojang servers and UUIDs are wha...

right, and that is what one would expect, but that is not the behaviour I am seeing.

for example, consider Player1, and Player2.

Player1 logs in. A packet is sent to Player1, changing their GameProfile#name to Play1

Player2 logs in. A packet is sent to Player2, changing their GameProfile#name to Play2 and sending Player1's GameProfile name as Play1

If player 2 does /minecraft:tp {tab complete here} they will see Play1 and Play2, instead of Player1 and Player2, which makes no sense to me

#

vs. 1.20.4, player2 would see Player1 and Player2, the actual GameProfile names, as tab completions

stark gyro
#

Maybe its just a change to give the server more control over the name of players.

midnight carbon
#

which is exactly why the fake names shouldn't be showing up

stark gyro
#

wdym?

#

the packet's coming from the server, is it not?

midnight carbon
#

why would that then carry over to server-provided suggestions?

stark gyro
#

Why would the GameProfile suggestions not use the GameProfile names given by the server?

midnight carbon
#

the line in red is the raw NMS code for the method that returned getOnlinePlayerNames(). these values are clearly being generated independently of what the client may or may not know

#

now my question is, why does my client NOW see the fake names in suggestions?

stark gyro
#

maybe its not a server change, but it's instead a client change

#

Did the GameProfile packets change their contents in newer versions?

#

If not, then it's just a change mojang made to the client, which we don't have control over with just the paper api.

#

cause the pr you linked has to do with preventing hidden players from showing up in entity argument selectors

midnight carbon
stark gyro
#

wait yeah its not a client change bc the command suggestions are controlled by the server

#

I still think that this is normal. It's weird that the names were different.

#

Player names aren't saved by the server iirc.

midnight carbon
stark gyro
midnight carbon
#

a packet being sent to a player doesn't change any state on the server-side

stark gyro
edgy plank
#

the client has its own suggestions provider, my guess is that it is using that

#

and it just didn't before (or it didn't exist)

stark gyro
#

oh it does?

edgy plank
#

I am decompiling 1.20.4 right now just to check if it did

midnight carbon
edgy plank
#

guess I'll just give it a test myself to see if I can reproduce the behavior you're seeing

midnight carbon
#

thing that has changed (aside from Paper changes) was the change to the gameprofile/nameandid cache

between when did you spot the change?

edgy plank
#

https://minecraft.katana-project.org/ you can use this page to decompile minecraft versions before 1.21.11, though it is a bit wonky since the file explorer shows the obfuscated names, you can still use shift + shift to search the actual decompiled class names (of course, you have to know what they're called)

#

I'll try to repro the issue and get back to you if I can find what changed since then

midnight carbon
vast crater
#

What would be the best way to modify specific tile entities (such as sculk sensors) when a chunk is generated?

bitter gale
#

was this directed to me

bitter gale
#

tghank you tho

stark gyro
bitter gale
#

ah

stark gyro
#

The deprecation notice for getTargetBlock routes you to getTargetBlockExact

bitter gale
#

thanks

dawn kiln
edgy plank
open tendon
#

I don't know of any guides for packets. There's protocollib and packetevents, but it's simplest to work directly with net.minecraft.server code if you are targeting just one server version

edgy plank
#

I do wonder how it works now that it is all environmental attributes

bitter gale
#

how do i make items not stack

vocal ember
midnight carbon
#

@edgy plank i think i have discovered the root issue, this was an absolute mammoth to navigate and debug.

edgy plank
#

I was thinking it was the change in paper 1.21.4 #105

midnight carbon
#

im finding it to be something a little different

edgy plank
#

what did you end up finding

midnight carbon
#

it has to do with the client sending the DECLARE_COMMANDS packet, which I initially investigated through the TAB_COMPLETE packet.

i'm going to have AI summarise my findings and share them in just a sec

#

okay so @edgy plank i should preface this by saying:

on 1.21.4, if i do /tp {completions show up here}, i get the spoofed completions.

if i do /scoreboard players set {completions show up here} then i get the REAL player names. I thought this was extremely weird.

#

There are no differences between the ClientSuggestionProvider across the versions. they're basically the same

edgy plank
#

let me share what I found

midnight carbon
edgy plank
#

if you run ./gradlew runPreFix --console=plain you'll see that /tp (tab) shows both your profile name as it is on the server, and your profile name as it is on the client side (just the first 4 characters). However when running ./gradlew runPostFix --console=plain you'll see that only your client-side name is shown in the completions for /tp

midnight carbon
# edgy plank the change in #105 was this: <https://github.com/PaperMC/Paper/commit/5e23d28ad2...

i see. the patch sounds inconsistent with my findings though.

What that patch did was basically force commands to ask the server for suggestions all the time

if that is indeed the case, then ClientboundCommandSuggestionsPacket <—> ServerboundCommandSuggestionPacket pairs should always fire when typing /tp, but that isn't the behaviour i observed. on 1.20.4, the client would always ask the server for suggestions. but on 1.21.4, the client would not. at least not for the /tp command

#

i hope i am understanding this correctly, because it seems contradictory

austere niche
#
Bukkit.getOnlinePlayers().size();
Bukkit.getMaxPlayers();

Is it safe to receive from an asynchronous thread?

edgy plank
#

in the first part, running in 105, you can see that only Memb is shown in /tp and /stopsound, but in 104 (pre-fix), both Memb and Membrillo are shown in /tp, and in the other commands only Membrillo is shown

#

why does tp end up with both the client-side and the server-side name I don't exactly know

#

so in short, the fact that server-side names were shown in suggestions was a side-effect of that patch, after it was removed the vanilla behavior was restored which is to only show the client-side names

edgy plank
austere niche
edgy plank
#

but to answer the question, it is technically fine

#

not actually safe but chances of you deadlocking your server due to it are little, at most you'll get stale data when reading it

austere niche
edgy plank
#

in this specific case, the server will not yell at you for it, in other instances you might be caught by the async catcher and the server will print a very huge red warning in your console

#

or in other instances you might just deadlock the server when reading just in the right conditions to hold some lock indefinitely

austere niche
#

Thanks for your reply!

edgy plank
#

if you have querying enabled that is

#

gives you a lot of info if you haven't heavily modified the server ping response

austere niche
quartz nacelle
#

Anybody have any creative ideas on how I could replicate this behaviour? https://www.youtube.com/watch?v=Cgc3iLGcR1U

I'm working on a project that needs vertical movement but the default vines and ladders are way too slow. My first thought was to check if the player was inside a twisting vine block and increase player speed in onPlayerMoved() but this turned out to be super glitchy.

serene cosmos
#

I would try negative gravity

#

attributes are synced with the client, so that should be pretty smooth

quartz nacelle
#

I'll give that a try, thanks.

#

Oops 😅

winter anvil
#

that option should be disabled by default

void minnow
#

is there any way with plugins/texturepacks to go back to the old obsfucation text effect, the new 1 looks bad

brittle marten
rotund otter
#

part of e.g. the object component or item components for skulls

brittle marten
#

object component?

rotund otter
#

Object text component that can render player heads

#

Beyond that, think entity data for mannequins

brittle marten
#

oh like in chat?

rotund otter
#

Ye

brittle marten
#

alright I see

#

thanks for the response

winter anvil
#

aren't they are the same except they support unicodes now

void minnow
#

thin*

#

its got so much noise in it it just looks pixilated

#

the old 1 used to just cycle through characters really fast and looked way better

winter anvil
#

should be hardcoded in client code

twilit quiver
#

hey guys why do my recipes not work after a /reload? while i dont intend to support reloading but i do wanna know why that happens, i even tried removing and readding the recipe

void minnow
#

any way to make it so text displays stay static and dont change position based on the way the player looks at it?

void minnow
#

thanks

void minnow
#

i dont want it fully static

#

i just dont want it to look 1 block ahead if the player looks up

#

if i spawn somewthing in there body

twilit quiver
#

i have no idea what you mean tbh

void minnow
#

ill record a gyazo

twilit quiver
#

then use a different fixed billboard try both verticle and horizontal

#

i think vertical would fix it

void minnow
#

alr thanks

void minnow
#

i give up, if someone has code to make text displays function like regular name plates id appreciate if they could send it

hollow glen
#

I mean you can't see your own name tag to begin with

winter anvil
rancid apex
#

What's the best way to update plugins without requiring a server restart?

#

If you were to make it possible on plugin level (no disabling and enabling random plugins, but building a plugin that supports that)

#

For example plugman seems to work fine, but it has some issues with brigadier commands and paper plugins

rotund otter
#

you don't

void minnow
void minnow
rotund otter
#

The level that plugman gets to is presumably the best you can really get. I mean you could hack some more but

#

a lot of the server is not made for reloading / changing things

rancid apex
#

k ig I'll just need to deal w kicking all players when I want to make small changes

#

and prefer config options when possible

winter anvil
rotund otter
#

Yea I mean, if you have mini game servers you'd just slowly update things when they inevitably shutdown after a game

#

if you only run one server, create some lobby server, plug behind velocity and move them there for a bit
Could also spin up the "new version" of your server on a different port and move them there if e.g. your map and player data is static / storable in DB

void minnow
#

i want it to be like an armorstand 1 but with a text display since i can use passengers and transforms to make it stay perfectly in sync with a player

somber fable
#

Hello, I would like to know how to connect two plugins together. I can’t find any documentation about this

rotund otter
toxic wren
#

is there a reason why there's Block instead of Hopper tile passed there?

#

when available

winter anvil
rotund otter
#

General uh when passing block states to events is that they are very very mutable

toxic wren
# toxic wren when available

since there's no cheap way to get Tile / Block entity from block... but when HopperInventorySearchEvent is fired Tile / BlockEntity lookup was already done?

rotund otter
#

I mean, Block#getState(false) is probably cheap enough?

toxic wren
#

unless you want to implement custom hopper ticking and override hoppers on whole server and starting point is HopperInventorySearchEvent

rotund otter
#

That should do basically no copying of anything

#

The only thing you'll pay for is the BlockPos -> BlockEntity lookup

toxic wren
#

yep

#

which I'm already trying to bypass directly with paperweight plugin

#
                .getBlockEntity(craftBlock.getPosition(), BlockEntityType.HOPPER)
                .orElse(null);```
#
    public static HopperView getHopperView(Block block) {
        CraftBlock craftBlock = (CraftBlock) block;

        if(!craftBlock.getBlockState().is(Blocks.HOPPER)) {
            return null;
        }

        HopperBlockEntity hopperBlockEntity = craftBlock.getLevel()
                .getBlockEntity(craftBlock.getPosition(), BlockEntityType.HOPPER)
                .orElse(null);

        return hopperBlockEntity != null ? new HopperView(hopperBlockEntity) : null;
    }```
toxic wren
#

if only we had Hopper in HopperInventorySearchEvent

rotund otter
#

Yea but we cannot expose that

#

Like, plugin A goes ahead and modifies the state in the event and then plugin B reads something completely wrong

toxic wren
#

yea I guess that's a valid point 😕

rotund otter
#

Its been painful already with ItemStack and we has been moving to defensive copying most of ItemStacks everywhere

#

What you could check

#

nah, that is the wrong container 😭

toxic wren
#

yep

rotund otter
#

Yea idk, once we get our event to interface work done we might be able to like

toxic wren
rotund otter
#

Do some funny shenanigans if keeping that reference on the event and then paperweight userdev allows people to fast access it

toxic wren
#

that would be awesome

rotund otter
#

tho, that opens a whole new can of worm around "yea so, why does this one event prevent GC from collecting half these chunks, oh there is an invisible block entity yay"

toxic wren
#

or maybe there's another way

#

eh no, I'm using Container from Hopper etc

#

was thinking possibly just adding set cooldown not just cancelling for HopperInventorySearchEvent would work

#

ie allowing plugins to set custom cooldowns for hoppers in HopperInventorySearchEvent

placid fractal
#

What's an easy way to detect if my plugin is being reloaded by plugman or /reload?

tardy atlas
#

check if its disabled and enabled again with onEnable/onDisable?

lament venture
#

you can check Server#isStopping in onDisable

zealous dome
#

Is making oversized item stacks (for example diamond sword with quantity of 2) unsafe? Just curious because I'm making an ability system where item size indicates remaining uses

toxic wren
#

save yourself dupes, bugs, bypasses and painful migration once u understand PDC is the way

#

don't ask me how i know 🥹

zealous dome
toxic wren
#

like on inventory gui?

#

should work in theory if ur only concerned about paper compatibility and don't care about updates wiping data like they did for example with lvl 0 enchants

#

now if ur also using via, idk how that's handled there, if your using any plugins that "validate" itemstacks randomly here and there or relay on that data and assume harded max values... again same issue

#

there's probably some legacy code here and there related to this as in the past negative or overstacked itemstacks resulted in dupes

#

long time ago (i think? lol, we still wipe them 🤣 )

edgy plank
#

it is a component nowadays so you could just make swords stackable if you wanted

zealous dome
zealous dome
void minnow
#

if so its fine just if you look up or down it appears way ahead of you and idk how to fix that

mortal jungle
#

Does location#setBlock work on blocks in unloaded chunks? And if so, does it load the chunk async or sync?

void minnow
#

unlike with armorstands it will just tilt up etc

winter anvil
toxic wren
edgy plank
#

that methods does load the chunk synchronously iirc, let me check

hollow glen
#

i mean it kinda has to

edgy plank
#

yeah I was just checking if it just failed in unloaded chunks, though I guess that would make it annoying to use lol

rancid apex
#

Is is possible to unregister commands?

edgy plank
rancid apex
#

when using lifecycle manager*

edgy plank
#

it is possible but the API doesn't have a nice method to do it, so you have to manually mess with the brig dispatcher for it

cursive crypt
#

I think it'd be easier to set a permission/predicate (whatever it's called) that you just ensure fails for everyone when you want it 'disabled'.

edgy plank
#

proper way to "remove" commands would be to just permission-gate them yeah

edgy plank
rancid apex
#

so ig something like this should work?

public static boolean enabled = false;

// ...
  .requires((_) -> enabled)
edgy plank
#

I mean, just use permissions instead of a hardcoded boolean

#

but yes

rancid apex
#

wdym by permissions?

#

wouldn't that be player specific

edgy plank
#

that would be the idea

#

source.getSender().hasPermission("some.command")

rancid apex
#

yeah but if I want to completely disable the whole command if the module is disabled from config

#

for everyone

edgy plank
#

I mean, there's nothing wrong with that however I don't think it is necessary to do it via a config when the usual way server admins add/remove commands to players is via permissions

#

if you want to do it that way however, it is fine

mortal jungle
#

Thanks

rancid apex
#

Yeah that would be the normal way, but as I want to make the plugin modular (it will have 5+ modules), and I want all of them to be disabled / enabled from config on need so that not everything is always enabled.

#

including commands and listeners etc

edgy plank
#

how do you handle registering commands past the lifecycle event

#

do you just Server/Bukkit#reloadData?

#

because in that case, you could simply not register them based on what the config is

rancid apex
#

no I alr do that

#

but if for some reason the user wants to disable a module while server is running

edgy plank
#

in that case you should just do a Server#reloadData

#

that will trigger the lifecycle event again

#

of course, it may lag the server given it also reloads advancements and recipes

tender helm
#

Just tell them no

rancid apex
#

What would be the advantage of doing Server#reloadData()?

edgy plank
#

that it'd trigger the necessary lifecycle hooks again

rancid apex
#

over just making a bogus permission check with config coded boolean

#

wouldn't that require the plugin to remove the command from the lifecycle manager anyway

tender helm
#

If you leave the commands and event handlers registered and just if (disabled) return that's less awful

rancid apex
#

or is the permission check not dynamic

tender helm
#

Trying to dynamically register/unregister that stuff is where you get headaches

rancid apex
#

and just toggle it around when needed

tender helm
#

Of course that'd leave the command visible to users, at least until they rejoin

edgy plank
rancid apex
#

what if I do Main.instance.getServer().getOnlinePlayers().forEach(Player::updateCommands);

edgy plank
#

that should work fine

rancid apex
edgy plank
#

that could be a thing but given commands are namespaced, it'll just be annoying at best yeah

#

even then, one would usually just remove plugins which share commands like that

real idol
#

Can I replace sendMessage with sendRichMessage and work without replacing anything (legacy working too)

winter anvil
#

§don't work in that

real idol
rotund otter
#

|| no ||

real idol
#

Still better than no minimessage and too bored to parse it so ill take it

rotund otter
#

Yea I mean, there should be no method in our API that can work with legacy (§ or &) that isn't deprecated

true flint
#

If I have literally 100 plugins using SQLite (not the same file, one for each plugin), and I also have optimized requests, only read/write on entry/exit, should i change to a remote database?

#

I don't think it should really have a big impact

echo terrace
#

if you wrote good non blocking code you are not going to feel any difference

karmic citrus
granite latch
#

How do I get/set the actual chat format in an AsyncChatEvent instead of just the message part.

true flint
unborn mist
# true flint I don't think it should really have a big impact

maybe even has slightly worse performance on an external database as you get networking latency.
if everything is async, like you already said, probably wont have a noticable difference.
I personally like to use SQLite for my plugins as i think setting up a proper database server is only worth the effort if the database actually needs to be shared between different servers.
(Maybe its a bit different if your server is very very large though, i only know working on smaller servers)

true flint
#

The sparks just shows some plugins lagging randomly

unborn mist
#

if everything is truely async, then that probably does not come from the database and changing it wont make a difference

true flint
#

Yes, I thought it was some plugin from the previous developer they asked me to redo them

unborn mist
#

good thing spark can show you the exact method which consumes the most tick time so you can figure out what the server is hanging on.

tiny storm
#

Obviously that's part of the signed messages docs, but it showcases more complex formatting logic as well

fierce elm
#

hi i'm new to plugin dev, i just made a cool plugin in 26.1.2
but i wanted to know whether I can make it work on all versions from 1.21 to 26.1.2

#

i dont exactly know what to do here

#

to check whether my plugin is compatible with 1.21+

true flint
true flint
unborn mist
fierce elm
#

i dont see a paper-plugin.yml

true flint
fierce elm
#

oooh

true flint
fierce elm
#

okay what about build.gradle.kts

#

it has a different version too?

#

like

true flint
fierce elm
true flint
unborn mist
#

ig share them

true flint
#

Not all of them are mine, but that still happens

unborn mist
#

that does sound like a simple case of the hardware being too slow

true flint
#

We're not sure, we're looking into it, because it's very weird

unborn mist
#

please share a spark report

true flint
#

I already remade like 10 plugins to optimize the server

unborn mist
#

there is no point in focusing performance if you get errors

true flint
unborn mist
#

why wouldnt you be able to share one?
its not like they contain critical information

true flint
#

I know, but I'll ask anyway out of courtesy it's not my server anyway

unborn mist
#

alright

#

@true flint also i think we should move this topic to #paper-help, this doesnt seem like a plugin programming issue.

true flint
#

They were really trash

fierce elm
# true flint Not really

i'm getting errors when I runServer to test it on 1.21.1
i cant figure out why
can you help me? i'll send the logs

true flint
#

Just send them

fierce elm
true flint
#

Delete run folder before doing that

#

To do a clean test

fierce elm
#

I did delete the run folder, I left out ops.json and eula.txt cause i keep having to op myself and accept eula again after a clean test

#

should i try again with a fully clean test this time?

#

I created my project like this, if this helps

#

I'm sorry i'm just new to this

true flint
#

Not really

#

Newer saw those errors tho

#

Maybe is because of something new about the templates plugin

fierce elm
#

i'm pretty sure it's something to do with the build.gradle.kts file?

true flint
#

Sent it

fierce elm
tiny storm
#

Why are you running Paper for 1.21

fierce elm
#

hold on

#

lemme just upload it

true flint
tiny storm
#

Well, the problem is that the remapper does not support Java 25

fierce elm
civic prawnBOT
civic prawnBOT
tiny storm
#

That means his plugin will definitely not run on Paper 1.21

unborn mist
#

in the plugin world, you usually just support the newest version.
its not like in the mod world where people are expected to stick to older versions.
its very much a big issue to run outdated servers

tiny storm
#

If you want your plugin to run on 1.21, compile it against 1.21

true flint
#

Remmaper is something new on 26?

tiny storm
fierce elm
#

what if someone has an older paper server who wants to use my plugins because some of their plugins haven't been updated?

tiny storm
#

I don't even think 1.21.10 supports Java 25 classes. 1.21.11 has updated dependencies though to support it

unborn mist
fierce elm
#

I see

unborn mist
#

old versions contain big security problems

#

and even stuff like 1.21 is considered "old"

tiny storm
karmic citrus
tiny storm
#

Just do yourself a favor and build your plugin for 26.1.2

fierce elm
#

alright

#

what about 26.1? there's only 2 newer patch versions

tiny storm
#

Sure

#

Barely any server-side changes anyways

#

You just miss out on API updates

true flint
fierce elm
unborn mist
karmic citrus
fierce elm
#

i see so i'll just stick with 26.1.2 then

unborn mist
#

when developign for paper, you always target the newest paper version

tiny storm
# fierce elm wdym

Well, if you depend on 26.1.1 API, you will not have any API changes that were introduces in 26.1.2. They aren't backported after all

karmic citrus
#

You can just use 26.1.2 and say you support 26.1.x, nobody will use those versions

tender helm
#

26.1 and 26.1.1 basically didn't exist

fierce elm
#

thanks so much for lmk 😭

tiny storm
#

It was dropped in 26.1

true flint
#

I think I'm the only person who makes all his plugins (more than 100) for the 1.21.1 base and expects them to work in newer versions kekw

tiny storm
#

Probably not the only one, but a minority for sure

fierce elm
#

does anyone have a gitignore template 😅

tender helm
#

If you're careful about what features you use (and what newer MC functionality you care about) you can make a plugin work across many versions

fierce elm
#

that i can use

spring haven
tiny storm
tender helm
#

If you want to use the latest APIs, the latest MC features, or dig into MC internals you either support a single MC version or you bring yourself a world of pain

#

Latest meaning anything created after about 2016 😄

fierce elm
tiny storm
spring haven
fierce elm
#

i didnt think at the time of creating that i'd make this into a plugin i'd publish lol

echo terrace
#

thats what i use

fierce elm
#

tysm

#

is there any formatter in java? do people use it usually?
for example, there's black formatter in python,
you can run the cli or use an extension to automatically format your code into PEP 8 standards

#

a lot of people use it

tiny storm
#

IntelliJ has a built-in formatter

fierce elm
tiny storm
#

You can use it via CTRL + ALT + L

#

You definitely have it enabled, it's just behind a keybind

#

If you want your files to be formatted automatically, you can configure that

tender helm
#

It's also endlessly customizable

fierce elm
#

ooo
it only changed 1 line
do i write my code that well as a beginner 😭

tiny storm
#

You can configure auto format under Tools > Actions on Save

tender helm
#

iirc it also defaults to keeping a lot of whitespace

tiny storm
tender helm
#

So if you format things in a weird way it'll try to not blow away what you did assuming it was an intentional exception

tiny storm
#

It does get rid of the obvious misplaced whitespace stuff though

tender helm
#

If you put those all on separate lines it'd keep that though

tiny storm
#

But it keeps the general stuff the same

tiny storm
#

I honestly very much like it like that, since I can decide myself how stuff should look in code, whilst still having stuff formatted nicely

bitter gale
#

is there a way to force cancel the consuming animation?

fierce elm
#

since I come from python I usually let the formatter take control of how it wants to format the code lol so this seemed strange

bitter gale
#

not the actual consuming

#

like the animation

tiny storm
fierce elm
#

mhm

tiny storm
#

If you check out Editor > Code Style > Java in the settings screen, there are a ton of options you can set for the formatter

#

Though I would just recommend keeping it as it is and basically write code yourself in a way that you think looks natural and good

fierce elm
#

yep

#

What about all the rest here

tiny storm
#

Java devs are not super strict when it comes to code formatting

fierce elm
#

what do all of those do?

tiny storm
fierce elm
#

okay

#

gotcha

tiny storm
tiny storm
# fierce elm What about all the rest here

Rearrange code physically moves around your methods and fields. You can enable that one I guess, though it will mess with your method order, which can be disorienting