#help-development

1 messages Β· Page 1330 of 1

echo basalt
#

and make it pull the contents from the item itself

#

so it'd look a bit like

{
  type: "PAPER"
  amount: 1
  components: {
    use_actions: [
      "open-embedded-contents"
    ],
    embedded_contents: {
      0: ...
      1: ...
    }
  }
}
#

wtv

vagrant stratus
#

Ah, so more or less the data-driven plugin I linked above lol

echo basalt
#

yeah data driven everything

#

but without any weird arg systems

vagrant stratus
#

(albeit probably better impl'd than ActionLib KEKW)

echo basalt
#

type shit

vagrant stratus
#

Eh, ActionLib only uses args cause I couldn't think of anything better for that thing & it's not like I have a large enough community to bug as there's no guarantee w/ this discord lmao

#

for the most part it's more or less how you're doing things though

// Creating actions

@ActionType(value = "name_of_action")
public class CustomAction extends AbstractAction {

    public CustomAction(JavaPlugin plugin) {
        super(plugin);
    }

   // Optional loadFromJson to load from the action's json object

    @Override
    public void execute(Player target, String[] args) {
        // Execution code is here
    }

}

// Registering actions
ActionRegistry.registerActionsFromPackage("com.example.package", javaPluginInstance);

// Using actions

ActionObjectManager manager = new ActionObjectManager();

JsonObject jsonObject = JsonParser.parseReader(new FileReader(file)).getAsJsonObject();

ActionObject newAction = new ActionObject(plugin, jsonObject);
manager.addActionObject(newAction);

ActionObject action = manager.getEnabledActionObjectByName(args[1]);
action.execute(target, Arrays.copyOfRange(args, 2, args.length));
#

ACTUALLY

echo basalt
#

bleh annotation driven

vagrant stratus
#

It works so πŸ€·β€β™‚οΈ

#

Not like any of my stuff has a large enough community behind it to care KEKW

echo basalt
#

joeshrug I dislike annotations in general

#

could be a nice way of auto-registering actions tho

#

hm

vagrant stratus
#

Yea, that's pretty much the only reason I use annotations lol

#

org.reflections & annotations

echo basalt
#

L

slender elbow
#

reflections lol, imagine not using service loading

vagrant stratus
#

This isn't a service though?

slender elbow
#

auto registration sounds a whole lot like service locating to me

#

and it solves that problem without whacky runtime reflection :D

vagrant stratus
#

They're not services though nor meant to be used that way.
In execution it's just ActionObject#run(Entity, String[]) calls

slender elbow
#

common interface too?

#

sounds like a perfect use for service location

vagrant stratus
#

Which service then? Definitely not for Spigot's

slender elbow
#

wdym which service

echo basalt
#

got a baeldung article I can read?

slender elbow
#

jdk service loading api

slender elbow
echo basalt
#

I'm still stuck in java 6

slender elbow
echo basalt
#

java 6 lol

vagrant stratus
#

what are the classes, exactly? Not finding anything

#

oh nvm

slender elbow
#

j.u.ServiceLoader I think

#

pretty extensive documentation

#
  • Google autoservice, compile time safe !
high vessel
#

how can i fix that, i use text displays and the shadow of the name is transparent. but i want it to be like the icon solid

slender elbow
#

I don't know

vagrant stratus
#

Only difference seems to be not having to use annotations in specific places, which is mostly irrelevant

#

also maintaining a services file? yikes

lilac dagger
#

I really like my approach to be honest

#

Only a class to handle it all

vagrant stratus
#

That wouldn't work w/ ActionLib lol

lilac dagger
#

What's an action lib?

vagrant stratus
#

^

lilac dagger
#

Oh

vagrant stratus
#

kekw

slender elbow
vagrant stratus
#

Eh not really worth the switch if it's just extra files in the end for the same thing reflections is doing

slender elbow
#

without the whole classpath scanning yuck

vagrant stratus
#

Eh it works so πŸ€·β€β™‚οΈ

slender elbow
#

it's also one whole bundled dependency less if you care about jar size and startup speed

vagrant stratus
#

Not really, this is relatively quick

#

[org.reflections.Reflections] Reflections took 368 ms to scan 1 urls, producing 13 keys and 140 values

#

5ms for a plugin which implements ActionLib & adds its own actions too

#

I could also get around the file size via libraries

#

(also I'm pretty sure I'm the only one really using it, so it's not like I have to take into account many other devs using it, in which case there's still no issue with the implementation itself)

#

I am debating on if I want to rewrite all of the plugins I have as a major version bump or scraping them entirely & rewriting them from the ground up under my server though πŸ€”
Maybe if I do the second one as it'd be a clean slate and git/update history lol

vagrant stratus
echo basalt
#

uhhh

#

it's pretty basic yeah

#

I'd probably add some sort of command and not hold any direct references to the impl themselves

#

like /customitem get <name>

#

applying ids to nbt is internal logic and shouldn't be public

vagrant stratus
#

Yea, just focused on the actual API implementation. Command is just QOL in this case lol

thorn isle
#

i detest annotation driven frameworks

#

the only two valid use cases i've seen so far for annotations are static flow analysis at compiletime or before, or marking members/classes for transforming at runtime by something like asm

vagrant stratus
#

eh they'll be annotation driven for the foreseeable future lol

#

Afaik I'm the only one using any of the libraries I do have posted, so I'm just making them for my own needs lmao

thorn isle
#

e.g. for discovering classes at runtime, instead of an annotation, it's better to use an interface to do it

vagrant stratus
#

Not unless interfaces can allow the equivalent @ActionType(value = "name_of_action")

#

although, I have different annotations w/ different info iirc

thorn isle
#

properties aren't required for discovery

tender shard
#

i dislike every framework that "discovers" classes

thorn isle
#

and interfaces can do properties through abstract methods instead

#

discovery has its place to reduce boilerplate a bit, but yeah, it can get iffy

vagrant stratus
# thorn isle properties aren't required for discovery

The provided info is needed, as it's used for various different things

@Retention(RetentionPolicy.RUNTIME)
public @interface Metadata {

    String name();

    boolean requiresMinimumVersion() default false;

    MinecraftVersion minimumVersion() default MinecraftVersion.v1_8_8;

}

This is also the most up-to-date version kekw

thorn isle
#

the only advantage an annotation has over an interface is that they aren't required to be present on the classpath at runtime

#

which isn't something you need for discovery either

#

at the end of the day an annotation is a very very boiled down interface

vagrant stratus
#

40 different classes

tender shard
thorn isle
#

like velocity plugins

#

god that shit makes me mad

tender shard
vagrant stratus
#

Really only way to go about it in my case. Directly or in-directly via something else lol

tender shard
#

I much prefer having a plugin.yml or a manifest or whatever

#

there are also some funny plugins that do not register their own listeners manually but instead scan their own classes and simply register everything that implements Listener

#

that's also very weird imho

thorn isle
#

the number of times i have had velocity plugins break because i refactor a listener or something out of my main class, and then get some obtuse error like "can't register x for null: null has no container"

vagrant stratus
#

unless again, I want to write 40 different lines, and a new line for every addition.
Easier to just automate it

thorn isle
#

and then spend an hour debugging it, and realize i'm no longer passing my main class instance to some listener registration method, but the listener itself

tender shard
#

also wtf is going on with velocity + floodgate

thorn isle
#

which of course fucking compiles because they didn't make plugin an interface, but an annotation

#

imagine using Object as the signature for plugin

vagrant stratus
thorn isle
#

what are you registering this many of, anyhow

tender shard
vagrant stratus
#

Data-Driven stuff 😎

thorn isle
#

often, though not always, when i face a similar situation, i find it's better to replace classes with objects and construct&register many objects of few classes instead of having many classes

vagrant stratus
#

Not possible in my case

#

Each class is a unique implementation

thorn isle
#

eyeballing the readme it sort of looks doable, but i'll take your word for it

vagrant stratus
#

A README i haven't bothered updating in ages kekw

thorn isle
#

i do something a bit similar in a mythicmobs integration

tender shard
#

this is why I hate spring boot - what even is happening, when, and where LMAO

vagrant stratus
#

I can grab example classes though rq

thorn isle
#

lord have mercy

vagrant stratus
lilac dagger
vagrant stratus
#

Those don't take into account extra config stuff either, like reqs and what not 😎

tender shard
#

e.g. if you are me, and you have to review code from someone else, you ofc usually start checking out the entry point. In this applicaiton, there literally is none

vagrant stratus
lilac dagger
#

i assume @SpringBootApplication is the entry point

tender shard
#

yes obv

lilac dagger
#

annotations are confusing tho which i agree

tender shard
#

but what does happen after that?

lilac dagger
#

that i don't know

tender shard
#

the main method only calls runApplication on itself

lilac dagger
#

i wanna practice spring boot

thorn isle
#

i could see this being decomposed to functions and typed config objects in place of jsonobjects, but that does have its own drawbacks; you can easily end up with a god class full of function bodies

vagrant stratus
#

Which is not worth it

thorn isle
#

yeah this is definitely a valid use case for discovery

vagrant stratus
#

^ told ya nerds

thorn isle
#

i've done the same in a custom enchantment plugin before

#

though i used an interface instead of an annotation

vagrant stratus
#

meh. annotation works well enough for a project I don't think anyone but me's using

thorn isle
#

yeah it's fine

vagrant stratus
#

~140 ms to read all the classes & only ~5 ms for the one plugin that i know uses it lol

thorn isle
#

my main issue with annotations is that since they have to support not being present at runtime, you can only use compile-time constant values for the properties

vagrant stratus
#

It's possible I could do the context object pattern instead in places instead of the current mess, but not really worth looking into

thorn isle
#

it's quite straight forward for configs at least

#

gson supports records out of the box

#

so instead of a JsonObject you can take your action specific config object, and gson will do its best to deserialize it from json

lilac dagger
#

i'm gonna finish updating databases and learn spring boot

vagrant stratus
#

Not worth it, as these are user defined configs

#

e.g.

{
    "name": "Adventure Mode",
    "enabled": true,
    "actions": [
        {
            "type": "set_gamemode",
            "gamemode": "ADVENTURE"
        }
    ]
}
thorn isle
#

this requires a type variable being present for the config type however, which isn't very easy with annotations but is trivial with interfaces

#

it's still worth it because it makes your own code cleaner

vagrant stratus
#

Hard-coding the actual actions & just calling them is better given the context of the entire library 😌

thorn isle
#

you'll get to use type-safe getters instead of manually parsing and asserting json properties

vagrant stratus
#

Ehhh debatable. Depends on how un-user friendly configuration becomes

#

especially given one config can have multiple wildly different actions within them

thorn isle
#

i did something very similar to this with the openai rest api

#

much like your actions array, the api returns and accepts an array of wildly different types, each with their own properties

vagrant stratus
#

That doesn't matter unless the user can configure things cleanly w/o having to learn & remember formatting which doesn't matter

thorn isle
#

i had a @Type(String type) annotation to populate and query the type property, to discover the concrete class to deserialize; then i left the deserialization completely up to gson

vagrant stratus
#

The configs are setup so even an idiot can make em

thorn isle
#

it would accept a construct basically the same as what you posted

#

and construct a List<Action> with one SetGamemodeAction with the gamemode enum property set to ADVENTURE

#

this is roughly what i assume you're doing as well, but it sounds like you're doing a good bit of it manually

#

specifically in your initConfig(JsonObject) method

vagrant stratus
#

I should really just push all of this to the repo, but going off how things normally are maintaining it isn't worth the time lmfao

thorn isle
#

e.g. I would do DropItemAction as

@Type("drop_item")
public record DropItemAction(int pickupDelay, DropItemAction.Hand hand) implements EntityAction {
   enum Hand { MAIN_HAND, OFF_HAND }
   
    @Override
    public void runAction(Entity entity, String[] args) {
        if (!(entity instanceof Player target)) {
            return;
        }
        PlayerInventory inventory = target.getInventory();
        ItemStack itemStack = hand == Hand.MAIN_HAND ? inventory.getItemInMainHand() : inventory.getItemInOffHand();
        if (itemStack == null || itemStack.getType() == Material.AIR) {
            return;
        }
        Item droppedItem = target.getWorld().dropItemNaturally(target.getLocation(), itemStack);
        droppedItem.setPickupDelay(pickupDelay);
        target.getInventory().remove(itemStack);
    }
}
#

notice how all the config parsing boilerplate disappears, and you're left with purely the implementation of what you want to do

#

also now you can do (supposing EntityAction extends Action) List<Action> actions = GSON.fromJson(...)

vagrant stratus
#

Which only matters if the json itself isn't terrible

tender shard
thorn isle
#

i mean it simplifies your code tons

#

the config remains the same and you can even load it in from yaml

vagrant stratus
#

Doesn't really need to support anything more than json πŸ€·β€β™‚οΈ

lilac dagger
tender shard
#

json is like all the disadvantages from bson with all the disadvantages from yaml

vagrant stratus
#

Eh. it's good enough lol

tender shard
#

yeah but it's a pain to edit

vagrant stratus
#

skill issue

thorn isle
#

it's not ideal for user facing things, but it's the de-facto data interchange format for stuff like this

tender shard
#

yeah I don't hate it, but it's really not very great

thorn isle
#

what you do is you have your yaml or toml or whatever the shit and you parse it into json, so your code only sees json

#

i definitely don't like yaml either though

#

i think the best spec i've seen to date is SimpleYaml, but that's a pythonoid-only concept

#

and we all know python people are not real programmers, so it doesn't count

vagrant stratus
#

Even if that were a slight improvement, it's not worth rewriting the entire plugin over lol

The code is already relatively fast, checked an older msg here and it was 368 ms to scan 1 url, producing 18 keys and 140 values for the main library

5 ms for the plugin implementing said library

vagrant stratus
thorn isle
#

i mean it wouldn't affect the parsing speed or performance or anything; i'm just saying it'd delegate that manual json parsing you're doing to the json parsing library, gson

#

making the code more concise and removing much of the boilerplate

vagrant stratus
#

eh still has to have user configuration ability somewhere, in which case I'm better off just parsing whatever that is. Which is exactly what I'm doing already

thorn isle
#

no no

#

the user configuration ability is the same and is unchanged

#

but instead of parsing the user config yourself, you give it to gson, and it gives you your typed ability objects

quaint basin
#

Does anyone know how to replace EntitiesLoadEvent in older versions?

thorn isle
#

ChunkLoadEvent and Chunk::getEntities

quaint basin
thorn isle
#

in older versions, chunk and entity data were in the same container and were loaded at the same time

#

in modern versions, entities are stored separately, so an event for loading an "entity chunk" was introduced

quaint basin
#

oh

thorn isle
#

ChunkLoadEvent is the functional equivalent in old versions

quaint basin
#

So, when the entitiesloadevent doesn't exist, does this method work well?

thorn isle
#

it should be 1:1

#

you can think of the old ChunkLoadEvent as a load event for block data + entities

#

in modern versions, it's only for blocks; and the EntitiesLoadEvent is only for entities

thorn isle
#

well blocks and block entities

#

and biomes and whatever

quaint basin
#

what is a block entity xd

#

like shulker?

thorn isle
#

a chest is a block entity

quaint basin
#

oh

thorn isle
#

meaning in modern versions, the ChunkLoadEvent doesn't guarantee that entities are loaded yet

#

only the EntitiesLoadedEvent does

quaint basin
#

What is only for blocks? u mean the chunkloadevent and getentities in the modern versions?

thorn isle
#

in modern versions, the ChunkLoadEvent guarantees that all block data and block entities are there, so you can do e.g. getBlock().getType() on a block in the chunk

quaint basin
#

oh alr

#

It helped me a lot, thanks

thorn isle
#

but calling Chunk::getEntities or Location::getNearbyEntities might return nothing, as the entities might not be loaded yet

vagrant stratus
#

Yea, checked the rest of the impl & it'd require a lot of rewriting if I wanted to go about that method.

I think the way things are handled in general would need an (almost) complete rewrite lmao

thorn isle
#

that's how it often is

#

maybe do take a look at it in your next project if you end up doing something similar

vagrant stratus
#

(not doing it)

vagrant stratus
tender shard
thorn isle
#

yeah

#

i did say "guarantees ... block entities are there"

quaint basin
#

what is a tile entity btw?

thorn isle
#

another word for block entity

tender shard
quaint basin
#

oh a block entity

tender shard
#

basically everything that's a block but has an inventory

#

yeah

quaint basin
#

different names to same thing

thorn isle
#

an inventory or any other state or data that doesn't fit in block properties

#

e.g. sign text

tender shard
#

yeah or beacons

vagrant stratus
#

Only real way it'd get rewritten is if i pushed code & someone sat down and rewrote everything to be better or i rewrote everything from the ground up under my server groupId and what not lol

thorn isle
#

tell chatgpt to do it

quaint basin
#

If I have a listener with 5 listeners, but one listener is not present on the server because it uses an unsupported version, will 0 or 4 listeners be loaded?

thorn isle
#

listener as in EventHandler?

quaint basin
#

yes

#

on the same class

vagrant stratus
quaint basin
#

the 5 listeners are on the same class

thorn isle
#

event handlers require the event type to be present in the method signature

vagrant stratus
#

I think I ever tried at one point actually kekw

tender shard
thorn isle
#

so if the event type is not found at runtime, loading that entire class will blow up with a ClassDefNotFoundException

tender shard
#

fail to load*

quaint basin
#

kk

quaint basin
#

The question was whether this affected the entire class or just the event in question

thorn isle
#

if your class defines a method, and that method takes a parameter of a type that is not present at runtime, the whole class will fail to load

quaint basin
thorn isle
#

post code

vagrant stratus
#

Most likely outcome is i get around to it when i finish w/ the server stuff and just rewrite everything from the ground up, confusing everyone in the process 😎

tender shard
#

although I do too remember the specific error you mentioned

#

anyway, the proper way is to simply split up your listener and then only instantiate the ones you're sure will load

vagrant stratus
#

also yea, ChatGPT still sucks for this kekw

thorn isle
#

depends

#

you'll want to use codex 5.2

vagrant stratus
#

i ain't throwing money at OpenAI 😎

thorn isle
#

you can throw money at copilot instead, they offer codex 5.2 through their platform

vagrant stratus
#

ew no

thorn isle
#

it's a bit sketch however; i prefer using my homebrew agent instead

#

deepseek is surprisingly good nowadays, but still quite slow

tender shard
thorn isle
#

glm5 also looks very very promising for its size

vagrant stratus
#

I did get something semi-competent from ChatGPT though. One moment lol

thorn isle
#

getting models to do code properly still takes some finesse and a good harness

quaint basin
vagrant stratus
tender shard
vagrant stratus
#

eh seems like it's just made things more complicated. nvm lmao

quaint basin
tender shard
quaint basin
tender shard
#

probably they're doing some funny classloader shenenigans that checks for org.bukkit in the class loader

#

because it definitely wouldn't work for third party events

thorn isle
#

i can only attribute it to some weird paper/spigot asm nonsense

tender shard
#

definitely spigot, not paper

#

paper likes to break stuff even inbetween versions

vagrant stratus
#

ChatGPT somehow made something worse than my current implementation KEKW

tender shard
#

e.g. on paper: plugin on 1.21.11 build 10 works fine, 1.21.11 build 20 -> NoSuchMethod lol

thorn isle
#

they do break stuff even between minor versions, but hey, they come back 2 weeks later adding a rename rule to their asm nonsense to unbreak it

tender shard
#

paper is a blessing and a curse, unfortunately their community is really toxic

vagrant stratus
#

Thankfully I can just fork & forget lmao

tender shard
#

we did maintain a paper fork inbetween 1.21.8 and 1.21.11 to add a tiny async catcher in Entity#addAttribute (which they did officially add in 1.21.9) and it was a pain

thorn isle
#

whatever happened with aikar

tender shard
#

aikar is a great dude

thorn isle
#

all i see him talking about on the paper discord now is steak

vagrant stratus
tender shard
#

is that some kind of idiom lol

vagrant stratus
#

No

thorn isle
#

steak is a kind of meat

vagrant stratus
#

^

tender shard
#

that I do know

vagrant stratus
#

All they talk about is food

thorn isle
#

is means aikar is talking about a particular type of meat

tender shard
#

oh you mean he's really talking aobut food lmao

vagrant stratus
#

Yes

thorn isle
#

myes

tender shard
#

I though "is steak" means sth like "is goated" or sth haha

vagrant stratus
#

No, is is quite literal lol

tender shard
#

haha I see

#

my only criticism about aikar is that ACF's documentation is shit

thorn isle
#

i suspect he has ptsd from his timingsv2 being thrown in the bin and being replaced by a half-baked async profiler ui in spark

vagrant stratus
thorn isle
#

they used to have this triage team

#

you could throw garbage pr's at them and they'd fix the pr up

#

now you have to wait in line for 4 months to be told you have a comma in the wrong spot and to fix it

#

and then wait another 4 months for a new review

tender shard
#

I remember when I once made a PR to spigot and then many paper fanboys showed up and claimed I stole everything from paper lol

#

it was some tiny thing about translation keys, I dont remember exactly

vagrant stratus
#

fork paper just to have faster response times /s

thorn isle
#

i too have an abandoned pr on paper

#

i think i've been waiting 6 months on it now

thorn isle
#

they told me the method names were bad so i changed them, currently i'm in the process of dying of old fucking age waiting for a re-review

tender shard
#

do you guys think this server could handle 675 players split up into 9 servers? e.g. 75 players each, 9 instances

thorn isle
#

depends on the gamemode and version

#

pvp/skyblock, sure

vagrant stratus
#

Really not difficult to fork /Paper either tbh

tender shard
#

what is it called again

#

it's an event with a like 1000x1000 blocks area

thorn isle
#

i do have a couple of local patches, but i hate redoing them with every game update

tender shard
#

about 400 mobs + 75 players per server

thorn isle
#

so i wish the paper guys would update them for me

vagrant stratus
#

kekw

#

keep wishing

tender shard
thorn isle
#

maaaaybe

#

mobs themselves are quite expensive

vagrant stratus
#

If I wasn't already working on a private fork, I'd make a public one just so I could go through their issues & PRs and deal with everything lmao

thorn isle
#

75 players is a bit high for modern versions, but it's doable for survival servers

tender shard
thorn isle
#

so perhaps for mob arena as well

young knoll
#

You could lobotomize most of the mob ai

tender shard
vagrant stratus
#

poor mobs

thorn isle
#

every instance will for sure almost completely eat up a thread

#

did this cpu have hyper threading?

tender shard
thorn isle
#

mythic will probably eat up 3 more threads per instance with how fucking shit their code is

young knoll
#

I remember there was a mob arena on minehut that had insanely laggy mobs

thorn isle
#

will you be using modelengine?

#

that shit eats cpu like crazy

young knoll
#

It’s pretty easy to survive when the mobs are moving once every 3 seconds

tender shard
vagrant stratus
#

one day mojang will give us better server-side customization πŸ˜”

thorn isle
#

i'd guesstimate you can get at least pretty close

#

you'll have 9 cores at almost 100% for sure plus 7 to spare for gc and async bullshit from mythic

#

if you have hyperthreading, there'll be more headroom

#

but you will definitely have to keep an eye on it and put some effort toward optimizing hotspots

tender shard
#

we'll just see. We're expecting 675 players (who can participate) and when it lags, well then we'll just turn down the mob spawning rate

young knoll
#

I mean there’s also the async stuff from minecraft

#

Actually most of that is worldgen so it doesn’t really apply

tender shard
thorn isle
#

mostly chunk loading in this case, the arena is fairly small, probably shouldn't have a big impact

#

if needed you can preload the entire world

tender shard
#

all chunks are preloaded with chunk tickets

young knoll
#

Netty and chat still have their own threads tho

thorn isle
#

just make sure they're loaded at some low ticket level so they don't try ticking mobs or blocks

quaint basin
#

https://imgur.com/a/TfnlVnv Regarding older versions that don't have world#getEntity(uuid): if I have a guarantee that the chunk is loaded, is this slower than simply iterating through all the entities in the world?

thorn isle
#

chat is negligible, netty does handle some heavy lifting occasionally

tender shard
young knoll
#

$5 says 1.8

#

Pay up

quaint basin
#

πŸ™‚

tender shard
#

1.8 does not have World#getEntity(UUID)?!

quaint basin
tender shard
#

wtf

vagrant stratus
#

lol

quaint basin
#

I can make my own in chunkloadevent/unload xd

vagrant stratus
#

this is why we stay modern 😎

thorn isle
#

for best results do location::getNearbyEntities with a radius of 1 if the location is accurate

quaint basin
thorn isle
#

this way you only iterate over one chunk section, rather than a whole chunk

tender shard
quaint basin
young knoll
#

I don’t think it had location.getNearbyEntities either

#

I remember it only being on entity back in the day

thorn isle
#

it's more efficient because you will only be looking at the entities in that chunk section, rather than the whole chunk

quaint basin
#

The method I described above works perfectly; however, I think it has more overhead if I have a guarantee that the chunk is loaded, and it's better to simply iterate through all the entities

thorn isle
#

i think it probably exists on World if not on Location even on 1.8

quaint basin
#

getnearbyentities exists yea

thorn isle
tender shard
#

Why are you using 1.8 in the first place

quaint basin
#

so i don't want change lol

#

i alr did the code too and this was made years ago

tender shard
#

are you using bStats or similar in your plugin?

thorn isle
#

chunk.getEntities will iterate over every entity in the entire chunk; location::getNearbyEntities will only iterate over every entity in the chunk section, which is far cheaper and more efficient

quaint basin
#

no

tender shard
#

you should add it, and then check how many people actually use 1.8 in your plugin

#

I bet it's less than 1 %

young knoll
#

Inb4 they didn’t even separate them into chunk sections in 1.8

thorn isle
#

i think that's been a thing since anvil

quaint basin
#

But I've already added the support; I find removing it, etc., more work than making that adjustment

tender shard
#

1.8 is dead

thorn isle
#

which god knows when the fuck that was but before 1.8 i think

quaint basin
#

and i never heard about chunk sections

vagrant stratus
#

Personally, I only support the latest version

thorn isle
#

skill issue

vagrant stratus
#

allows me to rip out anything i feel like 😎

quaint basin
#

So, does Chunk have a child now?

thorn isle
#

has had since like beta

tender shard
thorn isle
#

a chunk is split into 16x16x16 sections

tender shard
#

but you don't have to worry about that

thorn isle
#

entities are tracked on a per-section basis

quaint basin
vagrant stratus
#

every chunk is or was pregnant = confirmed

thorn isle
quaint basin
#

from what i understand is chunk and chunk section are the same thing

#

lol

thorn isle
#

no

#

chunks split the world horizontally across the X and Z axes; chunk sections split a chunk vertically across the Y axis

quaint basin
#

oh

thorn isle
#

chunks go from bedrock to the sky

#

chunk sections are slices of the chunk, 16 blocks tall

quaint basin
#

shouldn't be chunk section?

thorn isle
#

yes, a chunk is split to 16^3 chunk sections

quaint basin
#

oh

#

english skill issue

#

my bad

thorn isle
#

this is what allowed the anvil world format to double the world height while halving memory usage; sections full of air aren't even loaded

quaint basin
thorn isle
#

16x16x16

quaint basin
#

oh yes

vagrant stratus
#

now to unload chunks which don't have mobs. peak efficiency 😎

thorn isle
#

i want async pathfinding, ai, and collisions

#

someone has already done pathfinding

#

collisions should be trivial enough

vagrant stratus
#

no, the most you get is a single new block to play with

young knoll
#

Yeah that’s probably not super hard to do

quaint basin
young knoll
#

Just update the mobs movement target when you’re done calculating

#

As long as it doesn’t take too long it won’t be noticeable

thorn isle
#

the only part that requires any care or threading nonsense is ai goals like an enderman picking up a block, to make sure the block wasn't concurrently destroyed

young knoll
#

Yeah collision would be the same

thorn isle
#

beyond that i don't really care if the drowned ai goal for going for turtle eggs sees stale data and pathfinds to an egg that was broken the same tick

quaint basin
#

Do you guys use Spigot or Paper on production servers?

thorn isle
#

or woe is me the collision logic is 1 tick behind the actual world state

vagrant stratus
#

paper for prod, spigot for development

thorn isle
#

paper of course, nobody uses spigot these days

#

we're all here because the paper community is toxic

vagrant stratus
#

albeit my server uses my paper fork for development

young knoll
quaint basin
vagrant stratus
quaint basin
#

developers i mean ppl who ask on paper-dev

thorn isle
#

a little bit of both, mostly the not project manager developers

vagrant stratus
#

I only went recently cause i couldn't figure out paperweight, gave up, forked /Paper KEKW

thorn isle
#

cat is i think too busy having continuous mental breakdowns to have time to be toxic

ivory sleet
thorn isle
#

the main guys are alright

young knoll
#

Actually if collision was slightly delayed you could kill mobs by repeatedly building walls directly in front of them to make them take a tick of suffocation damage

#

Kek

thorn isle
#

it's the mid-tier devs that have their heads up their asses

thorn isle
ivory sleet
#

idk i feel like that's common to most communities in various degrees, whats that other fork called that combines everything?

#

i heard people still use that

ivory sleet
vagrant stratus
#

gotta make a plugin which combines every plugin, fr fr

young knoll
#

Don’t underestimate the speedrunners

ivory sleet
#

any%

thorn isle
#

iirc the palettedcontainer for holding block data for chunk sections even has synchronization

#

though the main thread only synchronizes over writes, not reads

#

so reading it async should be perfectly safe

ivory sleet
#

btw don't you already have async pf algorithms and coll checks with folia?

thorn isle
#

i have no clue what folia is doing honestly

vagrant stratus
#

Actually, that reminds me. I do have a project that only exists just to make a project that uses as many maven libraries as possible @ivory sleet

Don't think I got that far in it though, mayhaps I'll re-setup WSL2 and try and stream it on this terrible laptop & internet lol

thorn isle
#

i haven't paid any attention to it at all

young knoll
#

Doesn’t it only write to it from the main thread anyway

thorn isle
#

yeah, all writes are from the main thread

#

and well to some extent the chunk gen thread

ivory sleet
#

unsure but quite possible

quaint basin
#

Does anyone have benchmarks of running Paper 1.21 with 50 players or smth on a weak CPU?

vagrant stratus
#

ayo why the crying?!

thorn isle
#

but the sync does mean that any async readers will see any writes by the main thread immediately

ivory sleet
#

benchmarking 50 players on its own isnt helpful, it depends what the players are doing and where they are

quaint basin
#

and i'm using slime world manager

ivory sleet
#

ive no clue abt slime world

quaint basin
#

Therefore, chunk loading will be performed in memory and not from disk

quaint basin
#

Chunk loading is performed from memory, not from disk

#

on aswm

ivory sleet
#

i think finding exisiting benchmarks might be even harder then

quaint basin
#

I'd like to buy this. I don't know if it will be enough

vagrant stratus
#

more specs = more server instances if they don't take up much ram & cpu time

quaint basin
#

100 players would be great to start with. 2 instances of skyblock, 1 spawn instance (this spawn will have chunk loading because it will have an exploration world and will be normal paper), lobby and velocity

#

I don't know if this CPU will be capable of that xd

#

Heavy chunk loading/unloading will only occur in the spawn server

#

Then there are redstone systems, but I think that only affects TPS and not CPU usage, so the only concern would be the core frequency (and not the number of cores), but I don't think that's a problem

young knoll
#

TPS is based on CPU usage

quaint basin
young knoll
#

It’ll still affect the usage of whatever the main thread is on

quaint basin
# young knoll TPS is based on CPU usage

yes, but CPU usage during chunk loading affects CPU usage much more because it uses concurrent logic, unlike other Minecraft systems where everything is done on the main thread and therefore only affects the main thread, which I believe is the case with redstone

young knoll
#

I assume this is a modern version of paper

quaint basin
#

yes

young knoll
#

Otherwise I don’t think chunk loading is concurrent, only generation

quaint basin
#

I think in older versions the chunks were full sync

quaint basin
#

internals i mean bukkit, paper, spigot layer etc

young knoll
#

Those are paper only

thorn isle
#

The async in these methods refers to the chunk loading being done async, and the actual action e.g. teleportstion being deferred until the chunk loading is complete

#

The action itself and any access to the loaded chunk is still done sync

quaint basin
#

Because some methods have async in their name precisely because they only execute in a different thread

quaint basin
tender shard
thorn isle
#

was this on 1.8

quaint basin
#

I'm thinking of running 2 instances with every 50 players

#

no

#

1.21

thorn isle
#

i do see servers going up to 80ish

quaint basin
#

1.8 i can run 1000 players on a single instance on a shit cpu lol

thorn isle
#

but the margins are really low at that point

tender shard
quaint basin
thorn isle
#

don't know

quaint basin
#

but have redstone

thorn isle
#

how about folia

tender shard
#

should work unless people build lag machines / got a tons of entities etc

thorn isle
#

it's basically feature-made for skyblock

#

sort of instance-per-island

quaint basin
tender shard
#

we're currently using an AMD EPYC 4464P for each citybuild and TPS only goes below 20 if there's > 70 players on one instance

quaint basin
tender shard
#

performance heavily depends on simulation-distance, and ram-usage heavily depends on view-distance

quaint basin
#

to ppl can mining etc

quaint basin
#

And how much are you paying for that CPU?

tender shard
#

the ryzen 9 cost about 230€/month with 128gb ram

#

I'd much rather have 256GB each but they don't offer that in the datacenter where we need them D:

tender shard
quaint basin
#

I created the box smp precisely because it's easier to create a cheap multi-server setup with an infrastructure that separates the boxes into different servers (unlike the donut smp where different processes operate within a single world, which implies higher processor usage)

tender shard
thorn isle
#

no clue, i've never used it

#

my only interaction with it is noticing towny switching to some nonsensical scheduler abstraction to support it

#

always sounded like snake oil to me honestly

tender shard
#

the idea of folia is great though

slender elbow
#

I mean, it works, but it has some drawbacks

thorn isle
#

what kind of bugs are we talking about anyway

#

is it like plugin bugs or platform bugs

tender shard
thorn isle
#

i suspect most plugins that "support" folia just switch up their schedulers and don't bother to actually think about the threading model, and so end up buggy

tender shard
round finch
#

du bist klog ja ja kek

thorn isle
#

ja ja

#

jeg heter eirik

round finch
#

ich bin jones

round finch
#

im not germany btw

thorn isle
#

i'm not swedish either

slender elbow
# tender shard you seem to know sth about it, could you please elaborate the drawbacks?

well, the api breakages for one, a handful of events are not fired because of missing proper asynchronous event bus, so plugins have to be very specifically tailored for folia and with thread safety in mind as a first, outside the api it also has to break some vanilla behaviours, many commands are disabled and other vanilla mechanisms like scoreboards, world border I believe, datapack functions etc etc etc

round finch
#

i can understand swedish
im actually danish

slender elbow
#

all of which is documented by the way

quaint basin
round finch
#

NEIN NEIN

tender shard
#

imho the biggest issue with folia is that it doesn't take into account real usecases, e.g. it should in theory be great for citybuild servers, where everyone is spread out on the map so each plot, in theory, could be ticked independently. But what if there's some event at the spawn? ofc then everyone goes to spawn and then there's much more overhead. Take that into account including all the other stuff like "no docs", and it's just not worth it. We'd rather have 5 independent servers; spawn, north, east, south, west.

#

maybe in 5 years, folia will be great for our usecase. But today, it isn't (yet?)

slender elbow
#

what do you mean by "no docs" anyway

#

what is lacking in documentation

thorn isle
#

i've always been of the mind that we should look into threading the server components rather than trying to do regionized ticking like folia

quaint basin
#

so maybe is useful

round finch
slender elbow
#

and it serves for real servers just fine

thorn isle
#

regionized ticking is the first thing that comes to mind, the endpoint of the "split it into many servers" via going back to the origin by "merge the servers into one", and i find the starting point to be folly to begin with

thorn isle
#

without knowing anything about the impl i'll concede that folia might be achievable with smaller diffs than threading the individual components, but i'm not sure if that's the case

thorn isle
quaint basin
tender shard
# slender elbow what is lacking in documentation

tbh I haven't checked the docs since like 2 years ago, maybe that has improved. But what lacked back then was

  1. javadocs (which exist meanwhile)
  2. a proper explanation about what are the main differences, and what to keep in mind when switching from paper to folia
#

so yeah probably my info about folia are pretty outdated

quaint basin
thorn isle
#

i vaguely remember reading some folia doc on the paper website and it was an alright entry point into the concept

slender elbow
#

the api is no different than that of paper, so javadocs are not exclusively necessary, outside of, like.. deprecating the BukkitScheduler? which lmao

tender shard
#

last time I checked the folia docs every second link led to a 404

#

but as said, that was 2 years ago

quaint basin
thorn isle
#

all that said i would much rather figure out threading e.g. the entity tick loop rather than trying to figure out regionized ticking

#

it would scale better i think and be more compatible with plugin expectations

tender shard
#

hypixel is total shit anyway, unless you wanna stick to 1.8 blocks and wanna get messages about scam buying ingame currency

young knoll
#

Umm aktually

tender shard
young knoll
#

They are moving skyblock to run on 1.21 soonβ„’

quaint basin
#

And I lost my Minecraft Premium account because of scams on donutsmp btw

young knoll
#

(Parts of it already do)

thorn isle
#

omegalul

tender shard
#

lmao

thorn isle
#

hey at least it seems more popular than uh

#

what was that other minecraft reinvention

quaint basin
slender elbow
young knoll
#

Hytale is a new game?

thorn isle
#

i'm having an aneurysm

#

vintage story

slender elbow
#

like at that point it'd be cheaper to diy a server from scratch

young knoll
#

Hey don’t forget Yogventures

thorn isle
#

i don't know, maybe i'm just uninformed, but the entity tick loop seems fairly readily threadable

tender shard
slender elbow
#

ehhh

slender elbow
#

if it was without absolutely shitting the bed on vanilla compat, it would've been done already

mortal vortex
thorn isle
#

i mean the world state is fairly safe to access async, and that's what 99% of entity ai is

tender shard
thorn isle
#

only places i think might be complicated is stuff like endermen picking up blocks, which would change the world rather than reading it

slender elbow
#

you might be able to parallelize it however, but keep it in sync with the world ticking

quaint basin
slender elbow
#

a la parallelstream

tender shard
thorn isle
#

i mean

quaint basin
#

only if u have another bad things

tender shard
thorn isle
#

does the drowned really need to synchronously look at every block within a 20 block radius to see if there are any turtle eggs nearby?

quaint basin
tender shard
#

oh and also it took them over 10 years to produce a game that has literally 0 content

#

hytale = noman's sky

thorn isle
#

i figure doing sorta sketchy async reads of the world would suffice just fine for that

tender shard
#

hytale = KSP2

quaint basin
#

I'd like an opinion from a paper developer

tender shard
#

hytale = Cities Skylines 2

slender elbow
tender shard
#

it's one of those games that took forever to deliver NOTHING

thorn isle
#

kerbal space program 2 🀑

#

no this is vanilla minecraft

#

the only saving grace is that it only does it once every few seconds

#

they learned their lesson from villagers searching 100000 blocks for job stations every tick

quaint basin
#

lol

young knoll
#

It’s a very important feature

thorn isle
#

that still pisses me off

young knoll
#

Someone has to stomp those turtle eggs

thorn isle
#

1.15 the "performance update"

#

all they did was put a throttle on the villager ai goals

young knoll
#

Tbf zombies looking for turtle eggs is probably the bigger issue

#

There are generally more zombies than drowned

thorn isle
#

do they? i thought only drowned look for them

young knoll
#

Nope

#

All zombie variants

quaint basin
thorn isle
#

good shit

#

well no, they can't really, not without changing how the game plays

#

zombies just want to smash the eggs

#

how do you find eggs without looking for them?

#

something something POI octree nonsense

tender shard
quaint basin
young knoll
#

I mean yeah the poi system already exists

tender shard
#

unfortunately not even paper wants to fix all those shitty AI shenengigans

thorn isle
#

iirc the poi system is very rarely proactive, that is, some entity has to do the search once and then mark things as poi's; they won't be marked as poi's on block place or such

#

which means entities without a valid poi nearby will just continue re-searching the same area forever

tender shard
thorn isle
#

something something too much memory

#

copper golems remember up to 10 invalid chests and then forget them all

young knoll
#

Could just store a few numbers

#

Ie store the x y and z of the last checked block and then start from there

thorn isle
#

the easiest and probably a sufficient optimization here, which iirc i suggested at paper, is to check the chunk section containsMaybeAny or whatever the fuck the method was called, which checks the palette

#

if the palette doesn't contain the turtle egg, no need to search the chunk section

#

if it does contain the egg, it gets poi'd and the search doesn't rerun any time soon

#

don't know if it ever got implemented; probably not

young knoll
#

Ah yeah that’s smart

#

I’d be surprised if it doesn’t use a palette check already

thorn isle
#

they're too busy deprecating string color codes to do anything useful like this

quaint basin
#

In older versions of Bukkit, world#getEntity(uuid) is basically to create a map with chunkloadevent/unload and iterate through chunk #getEntities. Is this worthwhile?

#

Please don't judge me 😭

slender elbow
#

what

sly topaz
#

your question doesn't make much sense

quaint basin
thorn isle
#

depends on how often you're calling it

#

like i said, getnearbyentities is pretty cheap if you already know where the entity is

#

and since you're on 1.8, you could just nms it and call the internal uuid -> entity map; not like it's going to break from updates

keen wedge
#

Can anyone take a look at my plugin

mortal vortex
#

Drop the source code.

fossil yoke
#

Why is it that on my server auto crafters just don’t work. Everytime I click a square to block it, it doesn’t work.

#

It goes back to all the squares being unblocked.

mortal vortex
#

Are you asking here because you did something in your plugin to change autocrafters or UIs?

fossil yoke
mortal vortex
#

And shouldn't you provide maybe a list of plugins, from /pl

fossil yoke
mortal vortex
#

You can just copy and paste the output of /pl, a screenshot of it isnt needed.

#

And if you really want to upload media, verify

#

?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

fossil yoke
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

fossil yoke
mortal vortex
#

put it in a paste then?

radiant olive
#

Hlo any one help me to make Minecraft plugin I don't have money πŸ₯ΊπŸ˜­

#

This plugin blue print

lilac dagger
#

!services

#

!service

chrome beacon
#

?services

undone axleBOT
lilac dagger
#

ah there you go

tender shard
#

just ?learnjava

#

or even better, learn kotlin

shadow night
#

you probably shouldn't learn kotlin before learning java

lilac dagger
#

is there a reason why?

#

i guess it's because he has to work with java api

shadow night
#

kotlin has a lot of syntatic sugar and simplifications that you will understand much better and easier if you have worked with java before, and also, the java stdlib lol

sullen marlin
#

Plus if you learn java first you’ll see that it’s the one true language

#

And youll never want to learn anything else

remote swallow
lilac dagger
#

what about c πŸ˜„

vagrant stratus
#

Assembly or nothing 😎

umbral ridge
#

nothing sounds better

jagged thicket
#

jhon programming lang

cloud perch
#

lua πŸ˜‹

tender shard
kind hatch
chrome beacon
#

Spigot does have some code rewriting abilities with ASM to fix compat issues

#

Could probably PR a fix and then write a method renamer to keep compat with plugins using the old name

sullen marlin
chrome beacon
#

I mean yeah that works too

scenic zodiac
#

does anyone know a way to remove a specific use from an area? Like the use of arrows, I want to remove arrows from a certain area, or at least the effect of a specific effect, like slow falling

orchid brook
#

does someone have an idear how can i optimize this part ?
https://imgur.com/a/rSsow35

 public ItemKeyLite(ItemStack item) {
        this.type = item.getType();
        int cmd = 0;
        ItemMeta meta = item.getItemMeta();
        if (meta != null && meta.hasCustomModelData()) {
            cmd = meta.getCustomModelData();
        }
        this.customModelData = cmd;

        this.key = item.getType().name() + ":" + cmd + ":" + Internals.nbt().get(item, "sell-price", PersistentDataType.STRING);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ItemKeyLite other)) return false;
        return this.type == other.type && this.customModelData == other.customModelData && this.key.equals(other.key);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(type, customModelData, key);
    }

Im using this to store my item for a virtual backpack in a map<ItemKeyLite, Long> but this is for a tycoon gamemode and everytime an item is added to the backpack this init a new ItemKeyLite obj

drowsy helm
#

your code doesn't seem particularly inefficient though

#

just weird

nocturne rune
#

I want minecraft server developer

young knoll
#

I want $1,000,000

slender elbow
#

i want $1,000,001

#

@young knoll get fucked

young knoll
#

Now that’s just greedy

slender elbow
#

sorry that was mean

#

🫢

mortal vortex
#

now kiss.

lilac dagger
mortal vortex
#

(-1)/12

#

or -(1/12)

lilac dagger
#

It's the same thing

#

(-1)/12 = 1/(-12) = - (1/12)

mortal vortex
#

WHAT

#

u just taught me math

lilac dagger
#

Yup

#

Haha

umbral ridge
#

team's display name is not visible in the actual nametag right?

#

it's just a name of a team

#

prefix and suffix are visible only?

thorn isle
#

do you know of any packet-level equipment filtering library/plugin? i need to add some item components to worn player equipment on a per-viewer basis, and would rather not roll my own solution for it

umbral ridge
#

LibsDisguises api maybe

#

or pure protocollib

thorn isle
#

libsdisguises perhaps, it does have a mode to copy the player's skin and such and i'd only have to filter the armor manually

#

i did see someone posting about a library that did something like this, just for item lore in inventories instead

#

can't remember what it was called

umbral ridge
#

hey

#

can you modify the nametag completely?

#

the player name too

quaint basin
#

I'm developing the Hypixel minion plugin, but I'm having a problem. The issue is that if I have two minions placed in the same chunk, and the time between actions is different for each, then if, for example, I move away from the chunk, the chunk will be unloaded, but since the time between actions is different, this might happen:

1: The chunk is unloaded and saved in memory that the cobblestone minion has cobblestone blocks to place on the ground;

2: The minion places the necessary blocks and therefore performs getBlock#setType, consequently loading the chunk;

3: The other combat minion performs its action and kills the mobs (the chunk is loaded at this point due to the loading at point 2);

4: The cobblestone minion sees that the chunk is loaded, so it performs getBlock lookups, etc. (and perhaps increases the time the chunk remains loaded; I don't know how the behavior of how long the chunk remains loaded works);

And it gets stuck in this loop where the chunk remains loaded even when no one is nearby. I believe that's what happens; correct me if I'm wrong about how chunk loading and unloading behavior works

#

Does anyone know how to solve this? I'd like the chunks to be unloaded as soon as the player moves away

thorn isle
#

check if the minion Entity::isValid before making it perform any action

#

if the chunk is unloaded, it will be invalid

quaint basin
#

I force chunk loading until the minion places all the blocks

thorn isle
#

then check if World::isChunkLoaded

#

and have it abort the action or something if it isn't

#

this is why minecraft chunk loading has separate load levels for block and entity ticking

quaint basin
#

I've thought of a solution now based on what you said

#

Instead of repeatedly using getBlock to place the block even after the chunk is unloaded, until all the blocks are filled, I simply increment the value in memory to indicate how many cobblestone blocks have been placed. Then, once the chunk is loaded, the blocks are placed where needed

lilac dagger
#

did you guys use pragma before?

    try (ResultSet result = sendQuerySync("SELECT * FROM pragma_table_info(\"" + table + "\") WHERE name = '" + column + "';")) {
        return result != null && result.next();
    } catch (SQLException exception) {
        return false;
    }
#

i tried everything and it queries nothing

#

this is another test

#

[15:14:04] [Server thread/INFO]: Running pragma:
[15:14:04] [Server thread/INFO]: Ending pragma:

quaint basin
# lilac dagger

first thing you shouldn't perform queries on the main thread

#

and maybe ; on SQL query prob is not needed

lilac dagger
#

i'm trying to upgrade a database

#

hence the sync

#

i need pragma to get if it has a specific table and column name

#

but it's just empty

#

the file has names for both so it's very annoying

#

i could use select

wary harness
#

Any one has any clue why windows termianl when you start 1.21 server wont accept commands
when you try to type in termianl some times accept keys some times not
on older version like 1.8.8 was that fine and I never had problems but this bug is present from like 1.16

thorn isle
#

haven't encountered this issue

lilac dagger
#

the terminal works for me

#

however pragma query does not

vagrant stratus
#

skill issue

lilac dagger
#

πŸ™

#

why do i have the feeling it's something stupid

vagrant stratus
#

Remembered this.

Ended up implementing it privately as boolean LivingEntity#teleportToRandomLocationInBox(Location, int, int, int, bool)

& ignored the rest lol

vagrant stratus
#

bruh checking NMS to grab things to make public, EnderMan has a teleportTowards function but it's not implemented in a way I can just move it down to LivingEntity 😠

thorn isle
#

entity movement and ai are a shitshow

#

i can see why they've wanted to migrate into the "new" brain system for a long time

#

but honestly the impls in that system aren't much better

vagrant stratus
#

oh no, the only issue is teleportTowards is just

    public boolean teleportTowards(Entity target) {
        // Vec3 stuff here
        return this.teleport(d1, d2, d3);
    }

I can't do shit with this to move it up a class lmfao

#

Well, there are ways but they're not clean 😠

pliant topaz
#

i think for a function like this reimplementing it would probably be better than trying to fix it inflatable

vagrant stratus
#

yes but i'm trying to keep as little code duplicated as possible, especially when it's literally just a single class up from LivingEntity lol

weak wasp
#

Β―_(ツ)_/Β―

noble isle
#

can anyone help me with something

#

i'm new to plugin dev and i'm trying stuff out but there's something i don't understand

chrome beacon
#

What do you need help with

noble isle
#

i'm trying to make a plugin where beds explode in the overworld aswell but for some reason the explosion i create doesn't deal any damage

#

this is the code

#

wait i can't send piczs

#

uuuh

#

hold on

#

`package sleaky.pluginTries;

import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class PluginTries extends JavaPlugin implements Listener {

@Override
public void onEnable() {
    getServer().getPluginManager().registerEvents(this, this);

}

@EventHandler
public void onBedClick(PlayerBedEnterEvent event) {
    Player player = event.getPlayer();
    Block bed = event.getBed();
    Location loc = bed.getLocation();
    loc.getWorld().createExplosion(loc, 14, true, true);
}

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

}`

vagrant stratus
#

lol i'll just look at how vanilla does it rq

noble isle
#

i don't get what is wrong

lilac dagger
#

so result set was always empty

vagrant stratus
#

kekw

#

skill issue

thorn isle
#

the flip side of implicit execution of code

lilac dagger
#

i also wish ResultSet#next would throw an exception when the underlying statement has been closed

#

but glad it's fixed now

worldly ingot
#

fwiw, those result sets aren't really meant to be passed around

#

Ideally you process the result and shove the output into some record or something

slender elbow
#

a resultset lives within the scope of a statement, and a statement lives within the scope of a connection
which is why it all should be within a twr without escaping it and passing stuff around or returning etc, a sql query should be pretty much self-contained :d

lilac dagger
#

it was just one abstraction away

#

i did fix it now

umbral ridge
#

wasnt there an option to fly while being crouched?

#

now if you try to crouch while mid air, your nametag shifts down, hence why it loses opacity, but player pose doesnt update

worldly ingot
lilac dagger
#

yay πŸ˜„

#

now my upgrader works

slender elbow
# lilac dagger i also wish ResultSet#next would throw an exception when the underlying statemen...

per the resultset specification, it should, if it really isn't that sounds like a bug in the driver you're using :d

https://docs.oracle.com/en/java/javase/25/docs/api/java.sql/java/sql/ResultSet.html

A ResultSet object is automatically closed when the Statement object that generated it is closed

https://docs.oracle.com/en/java/javase/25/docs/api/java.sql/java/sql/ResultSet.html#next()

Throws:
SQLException - if […] this method is called on a closed result set

lilac dagger
#

strange

#

i'm on the driver spigot 1.21.11 uses

wary harness
#

anyone can tell me how to add itemcomponents with spigt api ?

#

for example I want to add Glid component to chestplate?

mortal vortex
#

Oh wtf that’s sick

rich solar
#

Hi ^^. I get a question about uploading my plugin as premium resource. It is called "XTroll". Like its name says, it contains a certain methods to make jokes to players.

But in the "creating resource" screen it says "Malicious plugins of any description, including "pranks", "testing", "troll", "joke", and plugins that crash the client will get your account banned."

My plugin applies to that warning?

drowsy helm
#

but I would reconsider whether you even want that plugin to be premium. Why would someone want to pay money for this?

cloud perch
#

It's pretty common

#

There's free ones too with tons of features

vagrant stratus
#

^ people pay for all kinds of things

sullen marlin
umbral ridge
#

cool stuff

mortal vortex
#

skeppy

young knoll
#

Doesn’t say I can’t make it crash the server

#

The ultimate troll

mortal hare
#

duplication with primitive composable abstractions leads to cleaner code in the end. prove me wrong

thorn isle
#

nonsense

cloud perch
#

DRY Exists for a Reason

mortal hare
#

you're not WinRAR or 7zip, you're not compressing things. just because something can be written in less code doesnt mean that it shouldnt be just composed out of different elements and duplicated across codebase

#

its better to do duplication with composition than making various different helper function variants all across the codebase

#

if it cannot be composed, only then it means that DRY should be applied

thorn isle
#

fad of the day

mortal hare
#

its better to duplicate this all over the codebase:
logInfo(createEvent(id, EventStatus.SUCCESS, EventType.AUTHENTICATION, details, Instant.now())
than writing:
logSuccessAuthEvent(id, details)
sure it saves a lot of writing, but its brittle and just pollutes your codebase with combinatorial variants of specific helper functions. Not only the first version is easier to change in case of change of the requirements but also requires less code to maintain at the cost of duplication. You can also easily search for such calls inside codebase way easier than searching specific variants of the helper functions all over codebase

ideally you would mix it with SRP
logSuccessEvent(createSuccessEvent(id, EventType.AUTHENTICATION, details))

DRY principle should not stand for do not repeat yourself, but for do not repeat knowledge. In my example there's knowledge that success events log in info level, failure in error level, that means you use abstractions with compositions for knowledge not for making your code shorter.

echo basalt
#

clean, simple readable code > by the books

slender elbow
#

who cares about practices and paradigms and following rules

#

just write code that works ez

cloud perch
dry hazel
#

PaperMC is that way

ivory sleet
cloud perch
#

was that against the rules

cloud perch
pliant topaz
#

even as a paper dev, spigot was an essential part of the plugin ecosystem and i love it

vagrant stratus
thorn isle
#

is it web scale though?

onyx fjord
#

its trusted, suuper rare breaking changes

#

spigot api is still my go-to

vagrant stratus
#

^ I develop all my public plugins on the spigot api. The only plugins which use paper's api are my own server's since I'm forking paper so I can easily deal with their dumb choices

pliant topaz
pliant topaz
vagrant stratus
#

Nah, they make some dumb choices sometimes

pliant topaz
#

Also true

vagrant stratus
#

Forked /Paper directly too so I can just remove patches as needed 😎

pliant topaz
#

best of both worlds

vagrant stratus
#

Haven't made any serious changes yet though. However, I did add public API for LivingEntity#randomTeleport since that should honestly be in spigot's api 😌

pliant topaz
#

i think i actually remember that conversation of yours haha, and yes, absolutely should :)

vagrant stratus
#

Yea, 2024 lol

I'd PR it myself, but spigot's JIRA sucks cause of the info I have to hand over

#

and paper is just slow as hell

pliant topaz
#

yep πŸ₯²

#

and 2024 is definitely too long ago .-. mustve been someone different

vagrant stratus
#

randomTeleport is only used for enderman & the cat lol

#

and it was me kekw

pliant topaz
#

how do i remember this and not even remember what i did 5min ago 😭

vagrant stratus
#

It'd be nice for magic & stuff though πŸ˜”

pliant topaz
#

absolutely πŸ₯²

vagrant stratus
#

I mean, it can be done w/o the method BUT IT'S RIGHT THERE

pliant topaz
#

doesnt the chorus fruit do basically the same? so its just three different implementations of nearly identical code?

vagrant stratus
#

Nope, that does something different lol

pliant topaz
#

ah, well

vagrant stratus
#

Enderman & the cat calls LivingEntity#randomTeleport directly

#

Enderman for its teleportation & the cat when getting a gift

young knoll
#

What

vagrant stratus
#

?

young knoll
#

Cats teleport randomly to get a gift?

vagrant stratus
#

Yea, one moment lol

pliant topaz
#

i wonder why the chorus fruit doesnt do the same tbh, maybe theres some random mechanic i dont remember but for me logically calling it on the player would make sense

vagrant stratus
#

I mean, it might. I'll double check lol

#

iirc there was a chorus class which called a different class entirely

pliant topaz
#

.-.

vagrant stratus
# young knoll Cats teleport randomly to get a gift?
        private void giveMorningGift() {
            RandomSource random = this.cat.getRandom();
            BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
            mutableBlockPos.set(this.cat.isLeashed() ? this.cat.getLeashHolder().blockPosition() : this.cat.blockPosition());
            this.cat
                .randomTeleport(
                    mutableBlockPos.getX() + random.nextInt(11) - 5,
                    mutableBlockPos.getY() + random.nextInt(5) - 2,
                    mutableBlockPos.getZ() + random.nextInt(11) - 5,
                    false
                );
            mutableBlockPos.set(this.cat.blockPosition());

            // Dropping gift code
        }
young knoll
#

So the cat randomly teleports and then coughs up a gift

vagrant stratus
#

seems like it, yea

wet phoenix
#

Hi, I’m young and I’m making a Paper SMP server.
I want a plugin where players choose a potion effect, and when someone kills them, the killer steals their effect.
I can’t pay, but can someone help me or tell me how to make it?
Minecraft version: (1.21.11)

chrome beacon
#

We can help you make it by pointing you in the right direction

#

but we won't make it for you

#

if that's what you want checkout the services forum

#

?services

undone axleBOT
wet phoenix
#

oh

chrome beacon
#

Sidenote; This is the Spigot discord, not the Paper one. So future Paper questions should be asked in the paper discord

wet phoenix
#

ok

vagrant stratus
#

I would actually, but I'm busy double checking stuff lol

wet phoenix
#

ok

#

dm me when you can

vagrant stratus
pliant topaz
#

interesting..

vagrant stratus
#
                if (entity instanceof Fox) {
                    soundEvent = SoundEvents.FOX_TELEPORT;
                    soundSource = SoundSource.NEUTRAL;
                } else {
                    soundEvent = SoundEvents.CHORUS_FRUIT_TELEPORT;
                    soundSource = SoundSource.PLAYERS;
                }

No idea when the fox is ever used though πŸ€”

#

I guess if it consumes a chorus fruit?

pliant topaz
#

when they pick a food item up and are hurt, they can eat it, if its a chorus theyll teleport afaik

vagrant stratus
#

ah

young knoll
#

They have their own sound for that?

#

Magic

vagrant stratus
umbral ridge
#

how do you add a secondary line to nametag?

#

with teams

worldly ingot
#

You would need to add a scoreboard with the display slot being under name

#

Though I don't think that can display arbitrary text, at least not that I can recall

thorn isle
#

i think it can now with the score renderers or whatever they were called

#

basically each score entry now has a name, an integer value, and an arbitrary text component

#

so you can e.g. have "playername 20 β™₯️" in the scoreboard

#

iirc you can completely get rid of the number so it just shows the arbitrary text component

worldly ingot
#

Ah, yeah, forgot about number formats

ivory sleet
#

this might be a bit irrelevant but iirc there are a lot of plugins that utilize passenger text displays and just hide the vanilla nametag, not sure if its a useful solution for u spexx but ye

thorn isle
#

that's i think the "standard" way of doing it

#

it's not as clean as the score, but using the score runs into compatibility issues with e.g. mcmmo that display custom scoreboards to players

young knoll
#

Using passengers runs into compatability issues with teleporting

#

:c

thorn isle
#

not on paper since they now use the "carry passengers" or whatever the teleport flag is called, by default

#

on spigot you can still get around it by doing protocol fucknuggetry so the entity only exists on the client

buoyant viper
#

be me, just constantly teleport display entity above player every tick LOL

#

could maybe set up to only tp on move event but it works

thorn isle
#

i think that works if you also copy the velocity so the client predicts its movement the same as the player's

#

but iirc i told someone to do that for this earlier, and they said it still lags behind a bit

#

could be user error however

worldly ingot
thorn isle
#

i'm not sure, it could be, but iirc the server refusing to teleport players with passengers was originally a spigot thing

worldly ingot
#

Oh, well, get fuk'd idiot

buoyant viper
#

it looks fine honestly

buoyant viper
#

if anything, extrapolating player movement should make it overshoot its new pos at worst, rather than under

#

unless theyre not even getting the movement vector correctly lol

dry forum
#

is there a way to check if a block like a sign is being powered by redstone as if it were a redstone lamp or sm

mortal vortex
#

A non-"redstone interfacable block" cannot have powered tag because its not apart of the data for that block. However isBlockIndirectlyPowered might return something?

calm dust
#

hey is paper remapped can cause plugin error?

thorn isle
#

maybe

orchid brook
#

Hi, I’m trying to cancel all interactions with a specific item.
However, if the item is an experience bottle and I right-click in the air, my code doesn’t cancel it. What should I do?

@EventHandler
public void onCrystalItemInteract(PlayerInteractEvent event) {
    if (!event.hasItem()) return;
    ItemStack item = event.getItem();
    if(item == null) return;
    if(!Internals.nbt().has(item, "CRYSTAL_ITEM", PersistentDataType.STRING)) return;
    event.setCancelled(true);
}
thorn isle
#

does it get called?

orchid brook
#

nop

#

it get called only when im aiming a block

thorn isle
#

i guess throwing it isn't interacting with the world technically, so it doesn't fire the event

#

listen to projectilethrowevent or whatever the specific event for that is