#help-development

1 messages · Page 1252 of 1

thorn isle
#

i did something similar in my custom item plugin, for tying events to items

red bolt
thorn isle
#

except my handleablehandler managed a event class -> event executor map

#

instead of manually listening to and forwarding every event in the game

blazing ocean
#

it's not every event-

red bolt
#

@sonic goblet Whats the skull for?

thorn isle
#

what is going on here

#

you are setting a player to spectate an entity and then hiding that entity from the player?

#

how is that supposed to work

red bolt
#

oh wait thats dumb actually yeah

thorn isle
#

hiding an entity from a player will send a destroy entity packet to the player to delete the entity on their end, and then suppress all position/metadata updates going to that player

red bolt
#

but I thought it was server side

#

oh man

thorn isle
#

well yes but spectating is both client and server side

red bolt
#

so then how do I keep the spectator from seeing the armorstand

thorn isle
#

you can't spectate an entity that doesn't exist

#

you can't see the armorstand anyway if you're spectating it

#

unless you're in third person with f5

thorn isle
#

i don't think you see the spectated entity

#

that'd be silly, no?

#

you're inside its head

#

if the entity were visible all you would be seeing is its head from the inside

red bolt
#

oop nvm your right

viral shell
#
Bukkit.getScheduler().runTaskAsynchronously(StaryEvents.getInstance(), () -> {
            countdown = 10;
            while (players.size() < playerlimit) {
                Bukkit.getLogger().info("Countdown: " + countdownInitCommand);

                if (countdownInitCommand) {
                    Bukkit.getScheduler().runTask(StaryEvents.getInstance(), () -> {
                        for (Player player : players) {
                            player.sendMessage(String.valueOf(countdown));
                            if (StaryEvents.getInstance().getConfig().getBoolean("messages.wmsgenabled")) {
                                player.sendMessage(StaryEvents.getInstance().getConfig().getString("messages." + "waitingmessage"));
                            }
                        }
                    });

Hi guys, I'm freaking out with this one, i've been working on a minigame events plugin and I was fixing some things in the countdown. I made so that countdownInitCommand is a boolean that's set to true when i do a certain command. When that boolean is on true, it prints the countdown in the chat. Now what's the problem here? See the Bukkit.getLogger().info("Countdown: " + countdownInitCommand);? If I remove this thing (the logger thing) it just does not work. I don't know why, but if i remove the logger, or I don't put a println that prints the countdownInitCommand it just does not work, it does not start the countdown neither sends anything in the chat.
Help

chrome beacon
#

Don't use a while loop like that

#

You're wasting a ton of resources for no reason

#

Use a ticking task

#

?scheduling

undone axleBOT
viral shell
viral shell
#

has sense

thorn isle
#

the easiest way to go about self-cancelling tasks (and indeed one of the very few reasons to use them) is BukkitRunnable

umbral ridge
#

you can use runTaskTimer which has cancel()

thorn isle
#

the bukkittasks returned by BukkitScheduler::runX can also be cancelled, but not easily from within the task itself

#

take for example

BukkitTask myTask = scheduler.runTaskTimer(() -> {
    //do something
    if (stopCondition) myTask.cancel(); //compile error; myTask has not yet been assigned
})
#

versus bukkitrunnable

new BukkitRunnable(){
    @Override public void run() {
        //do something
        if (stopCondition) this.cancel();
    }
}.runTaskTimer()
#

the tradeoff is that you get two levels of indentation, more boilerplate, and an ugly anonymous local class

umbral ridge
#

the best imo is if you create a BukkitRunnable class and use it like so

thorn isle
#

depends a bit on how lightweight the stuff you're putting in the task is, but yeah, this is the most "proper" way of going about it

hazy parrot
#

you can also do

schedluer.runTaskTimer(task -> {
    if(condition) {
        task.cancel();
    }
 }
thorn isle
#

oh yeah those exist as well

red bolt
#

I'm using this Bukkit.getScheduler().runTaskTimer(this, new Isometric_GM(this), 1, 1); with a run method in Isometric_GM

upper hazel
#

O(k * m * n)

k is the number of base packets to scan

m is the number of filters

n is the number of metadata (classes)

Is that a lot?

#

i try create package scan logic

thorn isle
#

a lot for what?

#

at startup?

#

for every packet the player sends?

sly topaz
#

that doesn't tell me anything about the numbers you're dealing with, time complexity depends on the scale you're working with

thorn isle
#

that said you probably can't get worse than k*n*m

thorn isle
#

mm yes

upper hazel
#

your biggest plugin

#

for example

thorn isle
#

during classloading? more than once?

#

it's acceptable for things to take a while at startup

sly topaz
#

I feel like we're not getting anywhere, what are you actually trying to do?

upper hazel
thorn isle
#

what are you scanning them for and what are you trying to find

upper hazel
#

so this is why i want to know how long this can be

sly topaz
#

annotations for what

upper hazel
#

i will creating di

sly topaz
#

is there any particular reason you aren't just using Guice or Dagger

upper hazel
#

yes

#

you will see

sly topaz
#

well, I won't be able to see anything if I have to keep digging details out of you lol

#

my suggestion is to just do it and worry about the speed later

upper hazel
#

your bigger plugin?

sly topaz
#

I need numbers to figure that out, not ideas

#

if your annotations are supposed to be in every class on every plugin you have, then sure, it is probably going to take time

#

if not, then maybe not

upper hazel
sly topaz
upper hazel
#

so we have thousand classes hmmm

jagged thicket
#

does spigot resolve order of hard depends?

sly topaz
#

if you put a plugin in your depend list, then it'll load after that plugin

jagged thicket
#

like if you give
depends = [p1,p2,p3]

does it actually load p1 first then p2 and p3
or does it just make sure the plugin loads b4 p1,p2,p3

sly topaz
#

it just makes sure teh plugin loads before any of these, but doesn't change the loading order for them

#

they'll still load alphanumerically I believe

jagged thicket
#

okay i might need a specific order of loading 💀

#

(not for spigot for smth else)

sly topaz
#

if you need a specific order of loading then you are probably doing something wrong

jagged thicket
#

yes

#

probably

thorn isle
blazing ocean
#

time to shade spigot

upper hazel
#

lolol

sly topaz
#

if you haven't done that at least once you aren't a true plugin developer

blazing ocean
#

that's so real

upper hazel
#

alr time to test

thorn isle
#

i selectively shade parts of spigot into my velocity plugin (yamlconfig) to keep my config management platform agnostic 🤡

blazing ocean
#

jeez

#

use configurate

sly topaz
#

configurate sucks balls

#

no comment support

peak shard
#

@sly topaz ok, was messing around with the datafixers, and even after i apply the datafixer it still doesnt remove the "levels" part

thorn isle
#

also snakeyaml and fastutil and a few others

#

total number of classes in the fat jar is like 20k

blazing ocean
#

there's a fork of configurate that supports it

peak shard
sly topaz
peak shard
#
    private String runDataFixer(String string) throws IllegalArgumentException {
        try {
            CompoundTag compoundTag = TagParser.parseCompoundFully(string);
            int oldDataVersion = getDataVersionOrDefault(compoundTag);
            if (oldDataVersion == DATA_VERSION) {
                return string;
            }
            setDataVersionToCurrent(compoundTag);
            Tag fixedTag = DataFixers.getDataFixer().update(
                    References.ENTITY,
                    new Dynamic<>(NbtOps.INSTANCE, compoundTag),
                    oldDataVersion,
                    DATA_VERSION
            ).getValue();
            return fixedTag.toString();
        } catch (CommandSyntaxException exception) {
            throw new IllegalArgumentException("Failed to run data fixer: " + string, exception);
        }
    }
thorn isle
#

i did look at configurate at one point

#

but honestly if i'm moving away from bukkit configs i'll probably just rawdog it with snakeyaml

sly topaz
#

you should be using References.VILLAGER_TRADE or whatever it is called

peak shard
sly topaz
#

well it probably doesn't exist in 1.20

peak shard
#

also i have like a ton of issues with nms and stuff that ill ask in a bit, but imma first try to get it working on 1.21.5 lol

sly topaz
#

since the data fixer is for upgrading from the 1.20 to 1.21 or whatever

thorn isle
#

out of curiosity, why are you running datafixer on mobs manually

sly topaz
#

and now facing issues upgrading items that come from old minecraft version to new mc version

thorn isle
#

paper iirc has builtin entity (de)serialization to bytes methods that take care of datafixers

#

i use those for shoving mobs into my items

sly topaz
#

sir, this is spigot

blazing ocean
#

you mean <unnamed fork that must not be named>

thorn isle
#

previously uh

#

i used the structure block api

#

i captured a structure with the entity in it, then saved it to file

#

then shoved the file bytes into the pdc

sly topaz
#

it'd have been easier if that Byte Serializable PR from Y2k was merged, but sadly that never got touched again

#

just like Choco's component PR

thorn isle
#

it was fucking ultra-clown but it did work

jagged thicket
sly topaz
thorn isle
#

nms handles it when the structure gets loaded

sly topaz
#

that's actually pretty neat tbh

#

I wouldn't have thought of it myself if anything

jagged thicket
#

that is why u don't use nbt,pdc and shit just store it into a sqlite data base 🧠

sly topaz
#

would just have used a data fixer manually like we were trying yesterday lol

thorn isle
#

the more you work with nms the more you realize the winning move is not to play

jagged thicket
#

actually would sqlite be any slower

sly topaz
#

eh, it might be the case for volatile things such as making custom entities but things like applying data fixers or dealing with nbt isn't that bad

peak shard
thorn isle
#

it's gotten pretty alright with mojmapped paper now, since the bytecode is stable

sly topaz
peak shard
thorn isle
#

my hacky item frame map image plugin using nms loads flawlessly on 1.21.4 despite being built against 1.21

sly topaz
thorn isle
#

never would've worked pre-mojmap

sly topaz
#

wherever that nbt was actually valid

jagged thicket
#

mojang mappings are goated

manic delta
#

is there any way to modify ai from tamed animals?

umbral ridge
#

yes

#

and good luck with that

#

XD

peak shard
manic delta
#

I want to make them walk in a specific way, do certain things and so on, I wanted to know if it's possible.

manic delta
jagged thicket
sly topaz
peak shard
#

i tried with 1.19 as the old data version, but still the same

sly topaz
#

in the meantime and in case it just doesn't work as we expect, you can try the other solution, which is just manually upgrading the format

thorn isle
#

paper and maybe spigot too have a mob goals api

thorn isle
#

though i don't remember if you can pass custom goals to it

umbral ridge
sly topaz
#

inb4 I get it to work but that solution ends up working and you just use that lol

thorn isle
#

the pathfinder api also goes a long way in making mobs do things

sly topaz
#

there is no pathfinder API

thorn isle
#

all ai really is is a bunch of logic telling the pathfinder to go to places and look at directions

#

there is on a certain fork

sly topaz
#

but we are not using certain fork here, are we

umbral ridge
#

we are

thorn isle
#

in the game its implemented as goals for muh modularity and oop, but just running your own tick loop on it and puppeteering it with the pathfinder achieves about the same thing

sly topaz
#

though being fair, there's a surprising amount of people that don't ask in the paper discord for whatever reason

sly topaz
#

there's fewer and fewer mobs with goals every update

thorn isle
#

yeeeah but the brain is basically goals with a bunch of extra nonsense on top

#

like memories

sly topaz
#

eh, the brain stuff is easier to hack around

#

if you want to make a custom memory or whatever it is just two methods or so

thorn isle
#

i'm not sure, i've never really tried working with either goals or brain

jagged thicket
#

there is no brain api either

sly topaz
#

it isn't an easy task, I think Choco tried at some point but couldn't come up with a good design to make everyone happy

thorn isle
#

personally

sly topaz
#

too simple and people would've found it limiting, too complex and people wouldn't use it

thorn isle
#

i think we expose a "kill brain" button

#

and then expose the pathfinder, navigation control, and jump control

#

and let plugins make calls to those as they like

#

let the plugin author decide what form of ai they want to use; be it decision trees or whatever else

jagged thicket
#

the unnamed fork also mentioned they wanna add a brain api

#

Is there any generic dependency resolver

blazing ocean
#

as in, plugin.yml libraries or something?

#

<redacted fork> uses eclipse aether

jagged thicket
#

yeah

#

leme check aether

peak shard
sly topaz
#

I do wonder how that doesn't happen with new ones tho

#

how are you spawning them?

peak shard
sly topaz
peak shard
#

i guess that explains it

#

Okk, this is a fix that works for now so

#

and the uuid issue is niche enough that its not a problem

#

and it gets fixed if u place down the villager and pick it up again

sly topaz
#

If you care about it being more elegant as far as nbt handling goes, you could use adventure-nbt to deal with transforming the nbt

peak shard
#

between 1.20 and 1.20.5

sly topaz
#

how, the nbt should use the minecraft names

peak shard
#

and since i compile with api version 1.20.5 to have EntitySnapshot, those throw an execption on <1.20.5

peak shard
#

just in other places in the plugin

sly topaz
#

have you set the api version in your plugin.yml?

peak shard
#

i mean i could access EntitySnapshot through Reflection but idk if thats the best idea

chrome beacon
#

You want a multimodule project

#

One module for the old version and one for the new version

sly topaz
#

to what, it should be the lowest version you support

peak shard
#

and compiled with 1.20.5

#

is that the problem or?

sly topaz
#

yes

peak shard
chrome beacon
#

Then reflection it is

sly topaz
#

I am honestly not sure why even support 1.20 at this point lol, do you happen to have bstats integration in your plugin?

slender elbow
#

reflection 💪 💪 💯 🤑 💰

peak shard
#

i mean, why not support it :p

sly topaz
#

I recommend it, helps one decide whether a version is worth maintaining as you can get information which server platform and version your users are using your plugin

slender elbow
sly topaz
#

well to be fair, upgrading the format is doing most of that, and that one couldn't be helped

#

barely anyone knows you have to care about data version or what even DFU is when dealing with these things

peak shard
#

was just wondering if theres another way

sly topaz
#

I honestly would just support 1.20.6 instead of trying to support all the way down to 1.20

#

nowadays, minecraft minor versions contain major internal changes, and so the API adjusts as it sees fit

thorn isle
#

i think most of the people who are outdated are under 1.20.6

#

that's when the datacomponent nonsense got added in, right

sly topaz
thorn isle
#

i mean the main reason why people don't update is plugin breakage

#

and the datacomponents are probably the biggest case of that in recent history

#

so anyone on any version past that is almost certainly on 1.21.1-4

#

so i don't think going down to 1.20.6 makes much sense; you'd want to go lower to capture additional servers

sly topaz
#

there are actually more 1.20.3 servers than 1.20.6, that's interesting

thorn isle
#

my point exactly

#

.6 is the breaking point

sly topaz
#

oh nevermind, I misread 1.21.3

thorn isle
#

people who got past it are liable to be on latest anyway

#

people who didn't, well, didn't

#

few if any would stick to .6

sly topaz
#

1.20.1 has more servers than 1.20.4 though you are right on that one

thorn isle
#

although i suppose slimefun specifically supported up to 1.20.6 and not any further for a long time

peak shard
#

i myself use 1.20.1 as the goto 1.20 version

thorn isle
#

but iirc that was because of some paper itemstack refactor

sly topaz
#

or 1.20.3 even

#

1.20.4 is where the major changes came so it is more or less understandable, 1.20.1 I do not get

peak shard
#

idk it just stuck

sly topaz
#

pie charts are so annoying

slender elbow
#

mmm pie

jagged thicket
#

weird that 1.20.1 is very popular

#

maybe people just stopped upgrading

sly topaz
#

a lot more clear

jagged thicket
#

when i ran servers i never upgrade unless i specifically run into an issue

sly topaz
jagged thicket
#

ok i actually ran 1.20 prod

#

leme see which version I last used (discord srv w)

sly topaz
#

3.1k servers vs 12.5k servers, it is a difference

thorn isle
#

no .5 on the chart?

ashen flicker
#

Hi people, someone have some method to show DisplayBlock to player using packets? I was using some method but it's not working on 1.21.5

java.lang.NoClassDefFoundError: net/minecraft/world/level/Level

jagged thicket
#

i was also contributing to that 1.20.1 pie piece

#

very sad

slender elbow
#

why would people be using .5

jagged thicket
#

1.20.5

#

not 21

slender elbow
#

yes

#

why would anyone be running that

jagged thicket
#

idk they run every other version

slender elbow
#

1.20.5 came with the component changes and 1.20.6 fixed some data loss issue

jagged thicket
#

nvm it would be classified under other

#

that is why not listed

blazing ocean
slender elbow
#

lol

jagged thicket
#

ok discord upload limit too small

#

this is the reason i stopped hosting servers 💀

ashen flicker
#

Guys can someone help-me, my plugin is getting error on java.lang.NoClassDefFoundError: net/minecraft/world/level/Level but i'm using latest spigot version

kind hatch
#

?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

kind hatch
#

?nocode

undone axleBOT
#

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

blazing ocean
manic delta
#

Can i make rare mobs tameable, and does Minecraft make them follow you? Something like frogs, goats, or something like that?

#

possibly not

chrome beacon
#

You can make the AI follow you with some nms

ashen flicker
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

ashen flicker
chrome beacon
#

You probably forgot to remap

#

?nms

chrome beacon
#

See ^^

manic delta
#

i just want to do that

#

custom tamable

chrome beacon
#

Take a look at the follow goal and add it to the entity you want

#

You will most likely have to tweak it slightly

manic delta
#

at this?

#

or do i need to create custom entity with nms

peak shard
#

@sly topaz finally uploaded the 1.21.5 version, thanks a lot for your help! (also looking forward to the EntitySnapshot data version bugfix)

manic delta
#

ill try

#

thank you

pliant yarrow
#

Hi, I have a question. I dev a plugin that places an image on a map. There are four zoom levels.
The basic level is 128x128, and level 4 is supposed to be able to display 2048x2048.
However, I don't think you can display images at that resolution, right (2048x2048) ?

ashen flicker
thorn isle
#

the actual graphic on the map is always 128 by 128 pixels

#

the zoom levels refer to how many blocks that represents

#

at the highest zoom level its pixel per block

#

zooming out means 2x2 and then 4x4 and so on blocks are represented by one pixel

#

so for rendering an image the zoom level is irrelevant

pliant yarrow
chrome beacon
#

?paste

undone axleBOT
thorn isle
#

are nms classes still relocated to a version specific package on spigot

ashen flicker
chrome beacon
#

And how are you building the plugin?

ashen flicker
#

Using eclipse

chrome beacon
#

That would be why

#

You need to use Maven

chrome beacon
umbral ridge
#

hey

#

if i turn off the AI on the Villager entity, would i still be able to use setAware(true)

#

or does setAware depend on AI

chrome beacon
#

Unclear

#

Time to try it and see

umbral ridge
#

so.. no movement at all im guessing

#

how the heck do i make the villager look at nearby players if they get closer than n blocks to him

chrome beacon
#

You want the villager to look around but not move?

umbral ridge
#

yes

#

im making custom villagers with custom trades

#

and once they're placed down i dont want them to move, only look around

chrome beacon
#

Could probably force them to look at a player yourself with a task

thorn isle
#

set their movement speed to zero maybe

#

they can still be pushed though

umbral ridge
#

oh

thorn isle
#

setting ai to none and manually updating their orientation is possible but iirc the head-body rotation gets fucked if you do that

#

unless you do it over protocollib

umbral ridge
#

yeah thats why im trying

#

no god not another dependency

thorn isle
#

having a lot of villagers with any sort of ai enabled is also bad news performance wise

umbral ridge
#

yeah

thorn isle
#

and by a lot i mean like dozens, not hundreds

#

they are extremely expensive

umbral ridge
#

would be a nice touch if villager looked at the nearest player within n blocks

#

instead of just standing there like dead XD

thorn isle
#

i've always used mythicmobs for my npcs

umbral ridge
#

and im talking about smooth look, not changing the head direction in an instant

thorn isle
#

spawn a zombie, add a look at nearby players goal, and disguise it as a villager

umbral ridge
#

they have an api?

thorn isle
#

if you want you can add a go to location goal to have it walk back to its post if a player pushes it

#

prooobably but get fucked trying to use it, it's closed source and their api-help channel is crickets

#

so you're down to decompiling their horrid codebase and trying to reverse engineer it with zero documentation

umbral ridge
#

fuck

#

ill have to leave ai on and cancel the movement

chrome beacon
#

You can use Citizens

umbral ridge
#

unless if i add some particles around them to make them look .. not so dead

eternal oxide
#

or, every tick teleport it to the location it was placed

thorn isle
#

mythicmobs is also the last plugin i'd want to require as a dependency for my plugin

#

shit comes with tons of baggage

#

the default configuration overrides the stats of a bunch of vanilla mobs

#

your reviews section will be 30% WHY DO CAVE SPIDERS HAVE 300 HEALTH

umbral ridge
#

to be performance friendly

#

and efficient

eternal oxide
#

it would be a single set position packet

thorn isle
#

if you're on paper, use the goals api to remove all ai goals, and then use the lookAt method on LivingEntity

thorn isle
#

it might exist on spigot too, dunno

umbral ridge
#

oh im on ||paper||

#

xD

thorn isle
#

iirc setting setAware to false will break lookAt because it stops the navigation controller or whatever being ticked

#

but you can also try doing that

#

i'm not 100%

topaz stirrup
#

sorry, I'll wait till you guys are done.

umbral ridge
#

ok ill try

topaz stirrup
#

ok, I'm stuck, how to you detect a left click on a falling sand block? I have tried to use the interact but it doesn't seem to have a getClickedEntity()

thorn isle
#

PlayerInteractEvent + raytrace, or PlayerInteractEntityEvent, or PlayerInteractAtEntityEvent

#

i think the latter two might be for right clicks only

#

i'm not sure if left clicking an entity without damaging it fires any event apart from interact

chrome beacon
#

What version are you on

valid burrow
#

in what instance would getItemMeta return null even

chrome beacon
#

air

valid burrow
#

ic

topaz stirrup
pliant topaz
#

not sure if it counts as real damage tho

topaz stirrup
pliant topaz
#

but could maybe be fired

#

What did you try alr?

topaz stirrup
#

it doesn't even broadcast a message.

blazing ocean
#

<redacted fork> has an event for this

topaz stirrup
blazing ocean
#

paper

topaz stirrup
#

oh, ok.

chrome beacon
blazing ocean
#

it's so over

#

PlayerAnimationEvent exists on spigot though

topaz stirrup
#

I am currently using purpur though.

blazing ocean
#

purpur is a fork of pufferfish which is a fork of paper

topaz stirrup
#

oh, I had no clue,

#

I've been using a spigot page though to code and it seems to work, why is that?

drowsy helm
#

it still inherits all the code from spigot

blazing ocean
#

paper was a spigot fork until december 2024 so it has everything spigot has had until then

topaz stirrup
#

ah ok.

umbral ridge
#

is there a list of minecraft:behavior..... - GoalKey ?

topaz stirrup
#

do you know which one does arclight use?

blazing ocean
ocean pecan
#

Hello, I'm on the 1.21.5 spigot build and I'm trying to play with the blocks_attacks component. I want to give any sword this component, but I can't get it working, I'm grabing the ItemMeta to do that, but it doesn't work, while changing the displayName works. My code does not cause any errors, but doesn't do anything. I tried to system.out.println to see how it looks, and it says the the meta is unspecific...

Is it fine to paste code here ? Is it the right place to ask for help ?

blazing ocean
#

hybrids are buggy messes of software you shouldn't be using

undone axleBOT
drowsy helm
#

chuck it in that

chrome beacon
#

Arclight is a bunch of Mixins based on Paper

drowsy helm
#

and send the link

topaz stirrup
chrome beacon
#

but it's not exactly a fork

ocean pecan
blazing ocean
#

for what we know, some mod could just be removing the entire logic

#

since mods can just do that

topaz stirrup
ocean pecan
drowsy helm
#

and also use tags

ocean pecan
#

yup, if you drop a sword

topaz stirrup
chrome beacon
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
drowsy helm
ocean pecan
topaz stirrup
#

oh wow, that may be useful, thank you!

#

I can't even join paper discord for help. That sucks.

chrome beacon
#

Did you get yourself banned

drowsy helm
#

try adding these


            blocksAttacks.setBlockDelaySeconds(0);
            blocksAttacks.setDisableCooldownScale(0);
            blocksAttacks.setBlockSound(Sound.ENTITY_PLAYER_HURT);

            blocksAttacks.setItemDamageThreshold(0);
            blocksAttacks.setItemDamageBase(0);
            blocksAttacks.setItemDamageFactor(0);

one by one and see if it fails at any point

#

or even just test with 1 and see if it applies at all

ocean pecan
drowsy helm
#

If you try and get the block component after a tick what does it give you?

umbral ridge
# thorn isle if you're on paper, use the goals api to remove all ai goals, and then use the l...

i removed all goals with Bukkit.getMobGoals().removeAllGoals() but that didn't do it and then i tried to be more specific with GoalKey.of(Villager.class, "minecraft:behavior.random_stroll") but that didn't help either. villager was walking around like nothing happened.. with bukkitrunnable now that works but .. it's meh.. no smooth looking transition.. and yeah if i set ai to false lookAt doesnt work ..

ocean pecan
drowsy helm
#

Runnables/bukkit scheudler

ocean pecan
#

ohhh

topaz stirrup
#

What is the things called when you have something like this:

unity nameHere {
  char,
  int,
  double,
  float,
}``` is should look soemthing like this
chrome beacon
#

You talking about enums?

thorn isle
#

or maybe records?

blazing ocean
#

enums probably

topaz stirrup
# chrome beacon You talking about enums?

no, if I am not mistaken enums are words reprisenting numbers while what I am talking about is saying this one variable type nameHere can be used like this:
nameHere name = 'c'
name = 5
name = 4.3
name = 5.3532244
and all the following would be valid.

#

I have seen it once in c++ but never seen it used.

thorn isle
#

these will all be valid if and only if the type of that variable is double

umbral ridge
# thorn isle these will all be valid if and only if the type of that variable is double

i guess i gotta go with NMS for villagers XD

found this on reddit:

/summon minecraft:villager ~ ~ ~ {Attributes:[{Name:"generic.movementSpeed", Base: 0d}]}

// Modify the villager's movement speed
double newMovementSpeed = 0.0; // Set this value to whatever you want (0.0 = no movement)
villager.getAttribute(Attribute.MOVEMENT_SPEED).setBaseValue(newMovementSpeed);

// Additional customizations
villager.setCustomName("InnKeeper");
villager.setCustomNameVisible(true);
thorn isle
#

if you're looking for inferred types, that's var

topaz stirrup
#

but when printing out it would print out as the respected variable type,

thorn isle
#

each variable has a fixed type determined at compile time

#

if you try assigning an int to a double variable, it will get cast, i.e. converted to, a double

#

so

double name = 'c'
name = 5
name = 4.3
name = 5.3532244

will compile and the values will be 67.0, 5.0, 4.3 and 5.3532244 respectively

#

but the type is always double

#

if you do var name = 'c' the type (at compile time) becomes char because 'c' is a char, and the subsequent assignments will not compile

ocean pecan
#

But when I use that meta object to change the displayName, it works. Only the BlocksAttackComponent doesn't work at all

drowsy helm
#

Could very well be that

ocean pecan
#

This server is running CraftBukkit version 4473-5pigot-e339edc-20401f1 (MC: 1.21.5) (Implementing API version 1.21.5-R0.1-SNAPSHOT)
Checking version, please wait...
You are running the latest version

drowsy helm
#

Also check the actual output of get blocking component not just the string value of meta

#

Jt might not show it in that

ocean pecan
#

Basically, from what I understand there's no way to create a BlocksAttacksComponent from 0, I use .getBlocksAttackComponent() on a Item Meta object because the javadocs says that .getBlocksAttackComponent() creates it if there's not

drowsy helm
#

Yeah im saying if you get it from meta again after a tick, then check whichever value you changed

thorn isle
#

no clue what is being done here but try setting the item stack back onto the dropped item

drowsy helm
#

If it’s default still, it means setting it in the meta isnt working correctly

thorn isle
#

whether itemstacks you get from places are views or clones is incredibly inconsistent

umbral ridge
#

man villagers are pain in the ass

thorn isle
#

so just getting one and editing it might not change the item in whatever place you got it from

umbral ridge
#

how do you assign a trade to a villager?

ocean pecan
sly topaz
#

it is checking whether the blocksAttacks component is null and if so, it sets it to null

#

probably meant to be the other way around

drowsy helm
#

But yeah try what vcs said

#

Might just be that

sly topaz
#

you can try and set it via reflection to see if i is just taht

ocean pecan
drowsy helm
#

Ide annotation means nothing

#

The logic is fundamentally flawed

sly topaz
ocean pecan
#

😐

#

I'm trying to understand what you guys tell me

sly topaz
ocean pecan
#

oh

#

do I have to report it somewhere ?

drowsy helm
#

On the jira

#

?jira

undone axleBOT
drowsy helm
#

But youll have to wait to get accepted. I cna make one once I get home

ocean pecan
#

If you can it'd be great, I'm not accustomed to the java ecosystem at all

sly topaz
#

in the meantime, you can use reflection to set it

#

it'll probably be fixed soon enough tho

ocean pecan
#

When I proposed to report it I was thinking about an issue on some github repository, jira is just an unknown land to me

umbral ridge
#

This doesn't work.

  • Villager is still walking around??
  • Villager profession is not updated

Villager villager = (Villager) player.getWorld().spawnEntity(player.getLocation(), EntityType.VILLAGER);
Bukkit.getMobGoals().removeAllGoals(villager, GoalType.MOVE);
villager.setProfession(Villager.Profession.ARMORER);
ocean pecan
thorn isle
#

villagers are fucked

umbral ridge
#

fuck villagers

#

ive spent the last 2 hours

#

adding and removing code for nothing

thorn isle
#

if its for personal use just get citizens/mythicmobs

ocean pecan
thorn isle
#

i quite like betonquest's original approach to npcs

#

where, while it did not implement any, it did provide command based hooks into them

umbral ridge
thorn isle
#

so you could create an npc with essentially any plugin that supports running commands

#

and then betonquest would take care of the not-npc side of things

#

best of both worlds in my view

#

get a good npc plugin for npcs, and then a good quest plugin for quests

#

or in your case shops, or whatever you were doing

umbral ridge
#

all i want is a simple villager with custom trades. I know you can create it easily with commandblock but.. with code .. its pain in the ass

#

yea im making shops

umbral ridge
#

none of the two functions work

#

but as soon as i set AI to false everything works

thorn isle
#

MerchantRecipe

umbral ridge
#

its this stupid AI that controls everything lol

thorn isle
#

they're apparently called recipes

#

Villager::getRecipes; the list is mutable iirc, but doublecheck

#

merchantrecipe is a public constructor bukkit class like itemstack, no factory involved

umbral ridge
#
Villager villager = (Villager) player.getWorld().spawnEntity(player.getLocation(), EntityType.VILLAGER);
Bukkit.getMobGoals().removeAllGoals(villager, GoalType.MOVE);
villager.setProfession(Villager.Profession.ARMORER);

ItemStack itemStack = new ItemStack(Material.IRON_INGOT, 1);
MerchantRecipe recipe = new MerchantRecipe(itemStack, 10);
recipe.addIngredient(itemStack);

villager.setRecipes(List.of(recipe));
#

ive tried this and it doesnt change it

thorn isle
#

for professions iirc you have to increase the level to 1

thorn isle
#

not sure what might be up with the recipes; does the gui still appear or does it refuse to trade altogether?

umbral ridge
#

it refuses to trade

#

ive increased the level to 1 and profession still hasnt changed

thorn isle
#

that'd be because of the profession or level, the trades themselves probably still work

#

does setting the profession work if you don't touch the goals?

umbral ridge
#
Villager villager = (Villager) player.getWorld().spawnEntity(player.getLocation(), EntityType.VILLAGER);
villager.getAttribute(Attribute.MOVEMENT_SPEED).setBaseValue(0);

villager.setVillagerLevel(1);
villager.setProfession(Villager.Profession.ARMORER);

ItemStack itemStack = new ItemStack(Material.IRON_INGOT, 1);
MerchantRecipe recipe = new MerchantRecipe(itemStack, 10);
recipe.addIngredient(itemStack);

villager.setRecipes(List.of(recipe));
#

no

#

now its not moving but profession and recipes dont work still

#

after disabling the AI again.. everything works.. its just not looking around

#

what is the point of remove functions if they don't even work Bukkit.getMobGoals().remove ....

solid cargo
#

is there way to play a completely specific sound (e.g. type of a cat ambient sound and not different (random) one every single time)?

manic delta
umbral ridge
#

no

slender elbow
#

getMobGoals 🤨 🧻

umbral ridge
slender elbow
#

no

#

you're welcome

umbral ridge
#

then eat that toilet paper

slender elbow
#

dw i'm in the paper team already

solid cargo
#

1.21.5 when?

blazing ocean
#

30th february 2048

sly topaz
#

if they don't, then you are either using it wrong or there's a bug in paper

#

I just noticed, the MobGoals class has no documentation on any of the methods lol, how did that get merged

#

martin, you've been writting for ages what's up

umbral ridge
#

idk.. ill figure it out

sly topaz
#

is there a reason you don't ask in the paper discord

umbral ridge
#

eh in paper they are less friendly xD they all roast and "how didnt you know that" "why didnt you do that"

sly topaz
#

I am honestly amazed the Spigot discord didn't become like that, it used to be the norm in the forums lol

mellow edge
#

Hello,
I saw a discussion about datafixers here today. May I ask what does datafixers library even do (from mojang I think)? I am confused from the name "data fixer". I saw some codecs Codec, MapCodec, and other classes used in the source code they use but what is it truly used for?

sly topaz
#

is that the message that took you so long to write

#

I thought you were writing the bible

mellow edge
#

I was waiting on the right time.

slender elbow
#

tbh dfu is two libraries together in a way

sly topaz
#

DFU is a library Mojang created to help with migrations between versions

smoky anchor
smoky anchor
#

Again, it's just the Codecs part of DFU

mellow edge
#

yes, I can see from the source code that it has many more classes

smoky anchor
fluid lion
#

Hello i am java developer curently working on project some minecraft server.. i am wonder is there any chance to use server icon more than 64x64?

mellow edge
#

Not sure, I think I also USED it in neoforge but I am really not sure whether the Codec there was the same thing

smoky anchor
#

Most likely yes

grim hound
#

how in the fu

#

does my plugin connect to a server

#

that's not running

#

not only that, it even fetches info from there and executes all queries

#

...and the actual server somehow doesn't log anything

#

even tho it has the exact connection params-

#

is it localhost being ambigious?

#

this, wtf is this

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

prime sonnet
#

has anyone used ItemMeta.setItemModel?
I can't get my own model.

My item properties:

  "model": {
    "type": "select",
    "property": "custom_model_data",
    "fallback": {
      "type": "model",
      "model": "item/mace"
    },
    "cases": [
      {
        "when": "hat",
        "model": {
          "type": "model",
          "model": "template:item/farmer_hat"
        }
      },
      {
        "when": "bighat",
        "model": {
          "type": "model",
          "model": "template:item/bighat"
        }
      },
      {
        "when": "stitch",
        "model": {
          "type": "model",
          "model": "template:item/stitch"
        }
      },
      {
        "when": "cakehat",
        "model": {
          "type": "model",
          "model": "template:item/cakehat"
        }
      },
      {    
    "when": "helmet",
        "model": {
          "type": "model",
          "model": "template:item/helmet"
        }
      }
    ]
  }
}```
chrome beacon
prime sonnet
#

meta.setItemModel(new NamespacedKey("template", "farmer_hat"));

#

I don't know what to put there

chrome beacon
#

I recommend you use the CustomModelDataComponent

#

instead and set the string to what you want

#

I'm not sure what setItemModel does internally

sullen marlin
#

But your model appears to be called item/farmer_hat

#

So wouldn't that be what you want to use

prime sonnet
#

vanilla mace is minecraft:item/mace to get this in setItemModel use "minecraft", "mace"

#

so my model is "template", farmer_hat"

#

@chrome beacon do you know how to use it?

chrome beacon
#

Get it from item meta

#

and then call set strings with a list of strings (probably only containing the value you want, but there can be multiple)

sullen marlin
#

Is your model farmer_hat or item/farmer_hat

#

You appear to have one thing in your json and another in your code

prime sonnet
#
    public void onJoin(PlayerJoinEvent event) {
        ItemStack farmerHat = new ItemStack(Material.MACE);
        ItemMeta meta = farmerHat.getItemMeta();
        assert meta != null;
        meta.setDisplayName("Farmer Hat");
        meta.setItemName("fsfsf");
        meta.setItemModel(new NamespacedKey("template", "farmer_hat"));
        farmerHat.setItemMeta(meta);


        event.getPlayer().getInventory().addItem(farmerHat);
    }```
#

if I use this meta.setItemModel(new NamespacedKey("minecraft", "cobblestone")); I will get this

sullen marlin
prime sonnet
#

i will get cobblestone in minecraft

#

how to create new CustomModelDataComponent

slender elbow
#

ItemMeta#getCustomModelDataComponent()

sly topaz
#

isn't one supposed to use item model nowadays

slender elbow
#

for most cases yeah

prime sonnet
sly topaz
chrome beacon
sly topaz
#

also you haven't answered md's question

fickle spindle
#

i need some tutorial on how to make textures

smoky anchor
#

iirc the ItemModel takes in models from items/ folder
you're replacing the mace (you can define custom btw, no need to replace)
So you'd set it to the mace model
To use it you add a string of either "hat", "bighat" or the others into the custom model data component
I believe this is how it works, I never actually used it

smoky anchor
chrome beacon
#

gimp

fickle spindle
smoky anchor
#

well that is a different question now

smoky anchor
fickle spindle
chrome beacon
#

Are you looking at a tutorial for the version you're on

#

because the resourcepack format has changed quite a bit recently

fickle spindle
#

there is none for the 1.21.4

smoky anchor
#

Well all the examples you have are either on wiki or in the vanilla resource pack

fickle spindle
smoky anchor
#

which one

#

wiki is just google
the RP is either in the jar or I can send you github link

fickle spindle
#

ye send me all the link u want i just want to make like a custom block like a pot

smoky anchor
prime sonnet
smoky anchor
#

Probably ?

fickle spindle
smoky anchor
fickle spindle
smoky anchor
#

you can't

chrome beacon
#

^^

smoky anchor
#

minecraft models have their own "special" format

fickle spindle
#

sorry not blender blockbench

smoky anchor
#

You can use Blockbench to make those models

fickle spindle
#

yeye i wanted to type blockbanch but i typed blender

prime sonnet
#

but when I add hat to custommodeldata it doesn't work anymore

smoky anchor
#

I really have to learn how to use the new model format lol

fickle spindle
#

{
"parent": "item/generated",
"textures": {
"layer0": "item/carved_pumpkin"
},
"overrides": [
{
"predicate": {
"custom_model_data": 1
},
"model": "block/custom/vaso1"
}
]
}

but if i do /give @p carved_pumpkin[minecraft:custom_data={carved_pumpkin:1}] i get a normal one

smoky anchor
#

version ?

#

But I do not think this would be correct in any

#

custom_data != custom_model_data

fickle spindle
smoky anchor
rough ibex
#

yeah custom data is not custom model data

young knoll
#

Isn’t this what item_model was added for

#

It’s much simpler than the new custom model data

smoky anchor
#

well yes, but you still have to create two files instead of only one (the model itself) if you want to use it
custom model data still has its uses if you want to use tints or other stuff btw

sly topaz
#

being completely honest, I have never made an item model or a resourcepack in my life, I just have helped people with their resource packs problem because 90% of the time it is just looking at the wiki

#

I should probably make one just so I can understand these issues better lol

young knoll
#

You need two files for item_model?

smoky anchor
#

I believe the value in that component refers to item model definition. If that is the case, then yes, you need two. I am not sure tho.

young knoll
#

You need the item model and the texture

#

And for custom_model_data you need… a model and a texture

#

And an entry in a third file

slender elbow
#

I love item_model

young knoll
#

Is it custom_model?

#

Idk

slender elbow
#

hm?

mortal hare
#

probs weird question but maybe we can discuss this here

#

do identifier method really belong in classes?

#

like identifier is being used for registering something somewhere usually

#

so shouldnt it belong in some other class which wraps the object it identifies

#

like RegistryEntry<Foo> which contains getId() and getValue() methods

#

instead of placing getId() inside Foo class

inner mulch
#

I'd just add it to the class

#

what's the issue with having it in a class?

mortal hare
#

nothing apart that the class implementation now is responsible for implementing proper identifiers for registries

#

which is... fine if things are simple

paper viper
#

Sometimes the id is useful within class

#

Maybe for hash code, or like if there is some utility method (trivial example to print and identify)

inner mulch
mortal hare
#

no, its just theoretical question. what i wanted to empasize that in that case your id for the object is global, its just that it feels like having local identifiers specified for the container it stores the values sound more cleaner

inner mulch
#

i think having 1 id for an object is better, how would you find the local ids for an object for each container?

sly topaz
mortal hare
wooden dove
#

I can't figure out how to set a blockstate

#

I need to set a block to a fence and have specific sides active

#

like the actual vanilla meaning of blockstate

manic delta
#

what event is fired when right clicking an entity (Sittable)

#

im using PlayerInteractAtEntityEvent and even if i cancel the event it doesnt work

sonic goblet
young knoll
#

Just use PlayerInteractEntityEvent

young knoll
manic delta
manic delta
manic delta
wooden dove
#

im trying to look at the heirachy and can only find Interfaces

slender elbow
#

Material.STONE.createBlockData

#

some blocks have a specific BlockData subclass, that is documented in the Material entry

wooden dove
#

hm ok, and is that just the same string as ingame?

#

"[axis=x]" for example

slender elbow
#

pretty sure yeah

#

if the string also contains the block like lever[powered=true] you can use Bukkit.createBlockData(string)

wooden dove
#

ah ok that might be easier

flat lark
ivory sleet
# mortal hare do identifier method really belong in classes?

I like this question.

No identification of instances of a type doesn’t necessarily belong to the specification of a type itself. Sometimes an identification lives inside a middleware layer, and then providing an isomorphic mapping may prove enough. (That is for some instance of type T, you can go from Id -> T but also T -> Id inversely).

If an identifier is universally unique or locally unique to some degree, it may prove useful to embed the id as a part of a type’s members, just look how often we use the UUIDs of players in Minecraft for all kinds of identifications as an example. Now I’d argue for that hashCode does not uniquely identify, seeing as two disjoint instances may yield the same return value, moreover two different hashcodes may turn out to be the same in a small-capacity hash-based data structure, it’s truly somewhat of a special case.

#

Even in databases its not always a case of having a clear id attribute embedded, although its usually the case seeing as it helps optimizing indexing, but also other kinds of identification. However, sometimes you may see these multi joined attributes that are used to identify tuples in some scheme. For example (a poor example) it may be the case phone number joined with full name is unique to a specific tuple.

short pilot
#

Hey! How can I add the EconomyGUIShop API to my gradle ?

It's not being recognized for some reason

My build.gradle

group = 'io.github.derec4'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    mavenLocal()
    maven {
        name = "spigotmc-repo"
        url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
    }
    maven {
        name = "sonatype"
        url = "https://oss.sonatype.org/content/groups/public/"
    }
    maven {
        name = "essentialsx-releases"
        url = "https://repo.essentialsx.net/releases/"
    }
    maven {
        name = "papermc"
        url = "https://papermc.io/repo/repository/maven-public/"
    }
    maven {
        name = "economyshopgui"
        url = 'https://jitpack.io'
    }
}

dependencies {
    compileOnly "org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT"
    compileOnly("org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT:remapped-mojang")
    compileOnly 'org.projectlombok:lombok:1.18.30'
    annotationProcessor 'org.projectlombok:lombok:1.18.30'
    compileOnly 'net.luckperms:api:5.4'
    compileOnly 'net.essentialsx:EssentialsX:2.20.1'
    compileOnly 'com.github.Gypopo:EconomyShopGUI-API:5.21.0'
}
thorn isle
#

lombokgroid detected

#

if it's supposed to come from jitpack, try passing it the commit hash or a release as the version

#

i've always found jitpack to be extremely finicky

short pilot
#

i aint atoning

short pilot
drowsy helm
thorn isle
#

a lot of noise about an alt+insert with extra steps

drowsy helm
#

it can save hundreds of lines of boilerplate

young knoll
#

But I like my boilerplate

ivory sleet
#

I mean one problem with lombok, just like with static singletons, dependencies become extremely hidden with for example the constructor generation. Some argue its boilerplate but id beg to differ.

#

Another issue is its consistency, as soon as u stray away from the canonical transparent constructors, you end up having to write out the constructor anyway in plain Java, now ur code is gonna be half-assed with some members being lombok generated, and similar members being manually written out. This complicates the source code-... remember code reads more times than it writes usually.

short pilot
#

fascinating arguments

ivory sleet
#

I can keep going

#

Another point people make is its generated non null checks

#

and yes, at first, that looks quite scrumptious, but it fails on a deeper level, for example its quite limited and don't support, generic type parameter nullability, more so afaik there is no proper support for, for example, initialization that regards monotonic null to non-null behavior or lazy initialization. Not sure how lombok handles components that initialize one another either...

Checkers-framework here is simply superior since it does it the proper way, or more proper I should say- for example it generates its own type system of the system and then performs checks etcetera...

#

I do admit it definitely gives the developer some other fancy hacks like extension methods or like annotations on annotations (higher ordered annotations?)- but its just a hack and at the end of the day, you still have your static method where it just make it looks like the first argument is the receiver, R apply(T this, U arg1, V arg2) is just static R apply(T obj, U arg1, V arg2) (T this is the receiver parameter, often times not written out)

#

And as I did mention before, many of its verbosity-reduction annotations fit for standard code, but as soon as u stray away from the "standard format" of things you start having to write it out manually and bye bye consistency...

ivory sleet
winter jungle
#

Anyone here knows a good npc api alternative to citizen? I don't want to work with nms itself

chrome beacon
#

Why not use Citizens

winter jungle
#

Citizens is simply "too much" for my use case, something smaller would do just as well

ivory sleet
#

have u checked fancynpcs? heard its supposed to be decent

winter jungle
#

Yeah I tried that, but seems to be a bit broken on 1.21.4, the set-turn-method doesn't change anything, if I disable the collidable they no longer spawn idk. just copied the stuff from their wiki

chrome beacon
#

Doesn't look like FancyNPCs is any smaller than Citizens

thorn isle
#

remove all the ai goals from the mob and then pilot it around with LivingEntity::lookAt + pathfinder api

chrome beacon
#

They did not want to use nms

thorn isle
#

i think there is api for all 3, at least on paper

chrome beacon
#

also player npcs

chrome beacon
thorn isle
#

players aren't doable via api i don't think

jagged thicket
#

can't u override or smth

thorn isle
#

imo the most robust solution in such a case would be to depend on libsdisguises to disguise something else as a player

#

libdsiguises has a decent api, is used by many servers, and is very robust in terms of what it can do

#

e.g. it can copy a player's skin and equipment, or arbitrarily set the disguise to be on fire, swimming, gliding, etc.

#

it even comes with a mineskin api which will allow you to load custom skins from a .png in just a few lines of code and apply them to your npcs

chrome beacon
#

While smaller than Citizens that just seems like a lot of unnecessary work

#

Citizens is also just more common for making NPCs

thorn isle
#

maybe there is some small player-npc library somewhere, but "small" plus "nms" usually equals "unmaintained"

#

so i think ideally you'd stick with citizens or libsdisguises

chrome beacon
#

Citizens >>

thorn isle
#

or mythicmobs if you already happen to have it or it's adjacent to what you're doing already

#

citizens is the industry standard pretty much

winter jungle
#

Well, thats interesting.

chrome beacon
#

Are you running Spigot

winter jungle
#

Paper, but I expected Citizens to have no problem with that.

sullen marlin
#

?whereami

chrome beacon
#

Time for a bug report for them

thorn isle
#

(protocollib works fine on paper 🐮 )

chrome beacon
#

That error just looks like Citizens failing to handle that Paper doesn't relocate Craftbukkit

thorn isle
#

not protocollib

#

libsdisguises

#

and yeah those field names are the obfuscated ones

#

seems like an oversight since there clearly is some sort of handling for the mojmapped server, based on the immediately preceding message

chrome beacon
#

Yeah

#

Make a bug report to Citizens

polar forge
#

hoi

rough drift
ivory sleet
#

?

rough drift
# ivory sleet ?

scala has a lot of nice sugar to address those issues without having all those pitfalls

#

and it is in my agenda to push scala

ivory sleet
#

scala isnt the only jvm languge that provide syntactic sugar for different semantics

ivory sleet
#

not sure how you can conclude scala from infix and prefix notation

rough drift
polar forge
#

how to check if a player is in a world?

rough drift
#

not particularly about infix and prefix

rough drift
polar forge
#

sorry i was being generical in a world called

#

'x'

rough drift
#

player.getWorld().getId().equals(otherWorldId)

sterile axle
#

my job is using lombok all over the place and i despise it, and we actually have a blackduck report screaming that our code is insecure because a @NonNull annotated member is not being assigned due to lombok's shitty constructor generation and I had to write a full ass report about why it's a false positive when we could have avoided it by just not using shitty ass lombok to begin with so im with conclube on this one

rough drift
#

I don't remember if it is .getId

chrome beacon
#

It's not

rough drift
chrome beacon
#

No

rough drift
#

then what was it

chrome beacon
#

You can just use equals on two worlds

rough drift
#

and use their IDs instead

polar forge
#

ID's are just their names right?

rough drift
#

you can use .getName

ivory sleet
# rough drift not particularly about infix and prefix

I mean okay, either way scala suffers from its own issues, like you get into this mix whether you’re writing functional or oo, like it is trying to do too much, you can write the same thing a billion different ways all which are considered the “convention”

polar forge
#

player.getWorld().getName() and then?

chrome beacon
#

Looks like it's getUID

#

for the uuid

rough drift
#

do not compare by name or world reference

polar forge
#

Sure thanks

ivory sleet
rough drift
#

A) a world "test" can be unloaded, a different one loaded with the same name, and your check will fail
B) do not store references to worlds because it can cause memory leaks

chrome beacon
polar forge
#

Im not

rough drift
#

then compare instances

sterile axle
polar forge
#

How do i check for the world id?

#

where do i find it?

rough drift
#

it's on the world instance

#

World#getUID()

sterile axle
#

This is a very large fintech company in the philippines btw

polar forge
#

yes but i need to compare it

rough drift
polar forge
#

(otherWorldId)

rough drift
#

as in, sorting?

polar forge
#

no u wrote it in the command u sent it

ivory sleet
rough drift
# polar forge (otherWorldId)

oh, the otherWorldId is just the same as player.getWorld().getUID() but replace player.getWorld() with another world variable

thorn isle
#

iirc worlds are either identity elements, or implement hashcode/equals correctly

#

i.e. safe for collections and .equals

#

not uncommon to see enabledWorlds.contains(player.getWorld())

rough drift
thorn isle
#

yes you do want to listen to world unload and world load to maintain the set

#

looks like they are identity elements

ivory sleet
#

i remember back in the days, iirc CraftWorld#equals used to use == comparison on its UUID objects

ivory sleet
#

💀

jagged thicket
#

do people still just use vault

#

or use smth else

#

iirc vault still uses usernames instead of uuids

eternal oxide
#

If I remember vault can use offline player

jagged thicket
#

yes it can

ivory sleet
#

it uses double still right?

jagged thicket
#

idk i didn't touch it since 2023

#

but i wanna make smth now

ivory sleet
#

idk last time I implemented an economy over its api I got a headache, but I do think many servers still use vault?

thorn isle
#

vault is "fine" as in it's the bare minimum of an economy interface with a bunch of largely useless features like per-world currencies on top

#

i've heard reserve is all the rage these days but from what i looked at it, it's the same deal except it has way more largely useless features on top

remote swallow
#

Insert that one xkcd image

#

(Use vault unlocked tho)

polar forge
#

Can't I just use player.getWorld().getName().equalsIgnoreCase("lobby")?

thorn isle
#

what i really miss in vault is the concept of transactions, going from one account to another; mostly for logging

#

vault by base only supports withdraw and deposit from an account, with zero awareness of where the money is going to or coming from

jagged thicket
#

its not hard to implement

#

the dev has not updated anything since 2020 🙏

thorn isle
#

it isn't hard to implement, no, but if you do, then your eco implementation is no longer directly compatible with vault

jagged thicket
#

yeah what i meant was

#

the dev is sleepin

thorn isle
#

currently 100% of eco accessors do transactions by first doing withdraw and then doing deposit on another account

ivory sleet
#

I mean I dislike that there's no async response type from the api, I mean realistically on a large network a transaction may need to synchronize over multiple nodes (ofc there's ways to deal w it, but like it sucks that u need a workaround for it)

thorn isle
#

but as an eco plugin, you have no way of knowing which withdraw is paired with which deposit

ocean pecan
remote swallow
jagged thicket
#

Yeah that is true

thorn isle
#

it's "feature complete" yes

jagged thicket
#

does it support name changes?

thorn isle
#

just their features are two thirds useless

#

it supports uuids in the form of offlineplayers, but only if the eco implementation actually handles those correctly

#

and i don't think any do

ivory sleet
#

it'd have been nice if they had segregated a separate interface for the account stuff and the per-world stuff icl

thorn isle
#

the per world stuff is the most inane nonsense ever imo

jagged thicket
#

ok so conclusion i should still use vault

#

right

ivory sleet
#

yea

thorn isle
#

if you want anyone to hook into whatever you're doing, yeah

ivory sleet
thorn isle
#

personally i'm honestly debating about getting rid of vault and using my eco plugin directly on my server

#

mostly because of the transaction issue

#

but this will involve forking and modifying all economy-interfacing plugins on the server to use the eco plugin directly

jagged thicket
#

That is fine for your own personal server but most people use vault because many plugins use the same

thorn isle
#

yeah, that is the issue

thorn isle
#

it's not an option if you expect your plugin to be used by others

jagged thicket
#

yeah

thorn isle
#

i think the only third party eco related plugin i have is towny

#

and i think that maybe allows for registrations of eco interfaces without having to fork it

thorn isle
#

you basically have to refactor every main thread eco call to futures or taskchain or something; commands, shop interactions, all manner of things

#

which is doable but 90% of plugins just don't, and then you end up blocking 25ms on mt because someone traded with a villager; it's not plug-and-play

#

so i think it makes sense for vault not to support it

jagged thicket
#

is syncying two server economy not a thing in vault really?

thorn isle
#

by the time you need and can make use of it you probably have rewritten all your eco related plugins yourself anyway, and vault becomes a pointless middleman

ivory sleet
#

I mean sure, its just a bit annoying since it does support offline players, lets say a consumer invokes ur economy for an offline player, ye well nice lets load that blockingly

#

ofc u can decide to just reject

thorn isle
#

i suppose the assumption is that all balances are loaded on startup

#

offlineplayers always have an uuid iirc so there wouldn't be a network call to mojang, just disk io, which you can do on startup

wet breach
#

depends on how that call to offlineplayers is done. If all you have is a name, then it will make a call to mojang servers to obtain the uuid to then look

ivory sleet
#

but yea ur probably right

thorn isle
#

i don't think an offlineplayer instance can exist without an uuid

ivory sleet
#

it cant

#

it will either use the local cache

#

or make a mojang call

thorn isle
#

one can exist without a name, and then getting its name will do blocking io again

ivory sleet
#

correct

thorn isle
#

which i suppose will make your eco backend shit bricks if its name based

ivory sleet
#

i mean if u have ur eco backend name based ur hardcore trolling already

thorn isle
#

i think mine is name based 🤡 offline mode server, you see

wet breach
#

lol

chrome beacon
#

💀

wet breach
#

instead of just relying on uuids coming from names lol

jagged thicket
#

Ok how do i correctly implement vault

thorn isle
#

yeah i'm probably going to switch to uuids anyway to support username changes

jagged thicket
#

im starting from scratch so leme do it properly

wet breach
#

I can't help you there, I have never bothered with vault and have found it quite pointless

thorn isle
#

iirc the reason why i did it name based is because towny didn't support uuids at the time

wet breach
#

I think I tried using vault once before and it was more of a pain then anything else

jagged thicket
wet breach
#

so I just tossed it away

jagged thicket
#

its not that bad for simple stuf

thorn isle
#

yeah it isn't really of any use beyond interoperability with other eco plugins

ivory sleet
chrome beacon
#

Vault2 when

thorn isle
#

a complete and thread-safe vault eco impl can be as a simple as a single class with a ConcurrentMap<UUID,AtomicDouble> with like 4-line impls of each vault api method

#

unless you have people calling the name based methods in which case you will be fucked

wet breach
#

these days, eco plugins have their own api's

jagged thicket
#

Not the popular ones 🤣

wet breach
#

which popular ones you referring to?

#

essentials has an api for their eco stuff

chrome beacon
jagged thicket
#

No one should use essentials

thorn isle
#

shore

jagged thicket
#

its brain damage

ivory sleet
#

Just take any Number, AtomicDouble and BigDecimal extend Number right?

wet breach
#

there was a time when vault was indeed handy and that was when all these eco plugins didn't have api's lol. But that was like over a decade ago

jagged thicket
#

how would all eco plugins work together if there isn't one single eco handler

#

💀

thorn isle
#

yeah, but atomicdouble becomes largely useless if treated as a regular number

#

since you will only have access to plain get/set

jagged thicket
#

we should make vault2

wet breach
ivory sleet
#

I mean tbf i could use the built in methods on ConcurrentMap

#

like replace, putIfAbsent, computeIfPresent etc

#

they are atomic

thorn isle
#

they are, but they perform a teeny tiny bit worse

ivory sleet
#

true

thorn isle
#

for one computeX is an exclusive lock on the bucket

jagged thicket
#

this seems cool

thorn isle
#

atomic double has low-level addAndGet and suchlike which are lockless on most if not all architectures, iirc in worst case implemented as a compare and exchange loop

#

but basically boil down to a single instruction unless you're on like fucking arm or something

ivory sleet
#

yep, which is the disadvantage if u opt w BigDecimal, u may have to write atomicity and synchronization on software level

thorn isle
#

that said i really don't think that's a hotspot you need to care about 🤡 using the concurrentmap compute methods is fine

polar forge
#

why can players still break blocks?

chrome beacon
#

Missing annotation

polar forge
#

oooh @EventHandler

thorn isle
#

i think the mcdev plugin should emit a warning about that

sly topaz
#

@ocean pecan it is fixed now

#

make sure to run BuildTools to get the patch

jagged thicket
#

@manic delta is the player login event firing multiple times bug fixed for you in latest spigot build?

manic delta
#

i did not tried

#

let me try

jagged thicket
manic delta
sly topaz
#

you can remove everything after # btw

jagged thicket
#

real thx