#help-development

1 messages · Page 1087 of 1

drifting bluff
#

i tried but stopped at like the 3rd sentence bc i dont understand and i neverheard of that kind of stuff

#

Why is it soooo hard to just use the config.yml

chrome beacon
#

huh why

#

Why do you want it to try and store an invalid address

dawn flower
#

i'm making /ipban, and i want it so if the address is invalid it ipbans the player

#

if that makes sense

#

so /ipban bob would ipban someone named bob, /ipban 127.0.0.1 would ipban 127.0.0.1

chrome beacon
#

Just match the username first

#

if no match try and match ip

dawn flower
#

ok

#

can you "join" a bukkit task? like a thread

#

nvm

#

is it possible to get all the ips a player joined with

#

or the last ip the player joined with

brittle geyser
slender elbow
#

technically there is no standard format for a textual IPv4 representation, so if you are expecting it to be in a certain format, just parse it yourself so you don't get any surprises

umbral ridge
#

Yes

#

EmilyParser

orchid trout
#

how to decompile jar in intellij

dawn flower
#

u dont

#

it's bad and u prob cant

chrome beacon
#

I mean you can

#

Intellij ships with a decompiler

#

Though I recommend just using Recaf

dawn flower
#

how do i check if an offline player has a permission (without vault)

rough drift
#

they get added on join

dawn flower
#

they technically do, they're stored somewhere

#

just like how you can get their statistics

rough drift
#

and add it on join

dawn flower
#

ah

rough drift
#

spigot has PermissionAttachments

#

which get removed on quit

#

and are not saved

dawn flower
#

doesnt lp use vault?

rough drift
#

not that I know of

#

I think it may have support, but I don't know

dawn flower
#

ok

tall dragon
#

yes it does

chrome beacon
#

Wrong channel

dull walrus
#

opps

#

what channel then?

quiet ice
#

If you're asking that question: Probably not.

dull walrus
#

ok thx

slate siren
#

guys

#

I encountered a problem while coding with Kotlin

blazing ocean
#

What problem?

slate siren
#

Armor stand, I set it so that right click does not work if there is no head on the head.

#

And I said this should only apply to armor stands with names starting with "enderchest"

river oracle
#

sounds like a skill issue

#

not a kotlin issue

rough drift
#

that is a quick and surefire way to let people abuse your plugin

slate siren
#

But all these armor stands prevent me from right clicking and I cannot equip a head.

river oracle
#

that isn't a kotlin issue though

slate siren
#

Ok I know there is something wrong with the code

river oracle
#

so why haven't you sent the code

slate siren
#

here

#

Check numbers 98 to 115

#

1 minute, since the explanations are in Turkish, it is difficult to understand, let me explain it in English for you

blazing ocean
#

And have you done some debugging?

#

There is no way for us to know if that config field exists

slate siren
#

I think there is a problem between 98 and 115, what I want to do is, if the armorstand starting with the name "enderchest" does not have a helmet on its head, right click should be blocked.

#

But this applied to all armor stands, and when I right click on other armor stands it blocks it.

#

I use the command to attach heads to armor stands starting with the name Enderchest.

#

/applyhead (name) I'm obsessed with writing, but I can't wear it because normal armor stands don't have names.

#

To briefly summarize, right-clicking is only valid on armor stands that start with "enderchest"

#

I couldn't find the problem

blazing ocean
#

And then what problem are you having??

slate siren
#

// Interaction blocking check
val interactionBlocked = config.getBoolean("armorstands.$worldName.$armorStandName.interaction_blocked", false)
if (interactionBlocked) {
event.isCancelled = true
}

#

I did this

#

Event.isCancelled = true

#

But it didn't work very well

blazing ocean
#

?notworking

undone axleBOT
#

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

slate siren
#

Wait 1m

glad prawn
#

setCancelled exist

blazing ocean
#

You've been explaining what you want it to do, not what isn't working

blazing ocean
#

Kotlin allows you to use property access syntax for getters and setters

shadow night
#

I call kotlin the diabetic language

blazing ocean
shadow night
brittle geyser
#

How can i use my plugin in github release in other gradle plugin like dependency?

blazing ocean
#

What?

slate siren
#

I'll send a video 1m

blazing ocean
#

You want to use your plugin as a dependency?

brittle geyser
#

yes, my plugin in github

#

how to use it as dependency in my another plugin

shadow night
#

Publish it to your maven local

#

Or, if you have one, a maven repo

brittle geyser
#

how to publish into maven repo

slate siren
#

Look video

shadow night
undone axleBOT
slate siren
#

Normally, if there is a head in the armor stand named enderchest, the command works.

#

But otherwise the command will not work

#

I blocked right click so that the command does not work when I am not wearing a helmet.

#

This prevents this when I right click on the normal armor stand with any armor or head.

river oracle
slate siren
#

Thats the problem

dense falcon
#
    @EventHandler
    public void onClick(PlayerInteractEvent event){
        Action action = event.getAction();
        Player player = event.getPlayer();

        if ((action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) && NeoWorldPlugin.playerIsInListInConfig(player, "cpsTest.players")){
            FileConfiguration config = NeoWorldPlugin.getConfig();
            int playerClicks = config.getInt("leftClicks." + player.getUniqueId().toString());
            playerClicks++;
            config.set("leftClicks." + player.getUniqueId().toString(), playerClicks);
            NeoWorldPlugin.saveConfig();
        } else if ((action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) && NeoWorldPlugin.playerIsInListInConfig(player, "cpsTest.players")) {
            System.out.println("Clic droit détecté pour " + player.getName());
            FileConfiguration config = NeoWorldPlugin.getConfig();
            int playerClicks = config.getInt("rightClicks." + player.getUniqueId().toString(), 0);
            playerClicks++;
            config.set("rightClicks." + player.getUniqueId().toString(), playerClicks);
            NeoWorldPlugin.saveConfig();
        }
    }
``` Why the right click is not detected 🤔 ?
dawn flower
#

where u clicking the air with nothing in hand

dense falcon
#

I was right clicking in the air.

#

With nothing.

blazing ocean
#

That doesn't fire the event

dense falcon
#

"RIGHT_CLICK_AIR".

#

Left click does.

blazing ocean
#

And left clicking is attacking

dense falcon
#

And right clicking without item?

#

There is an event 🤔 ?

dawn flower
#

if u right click while looking at nothing and holding nothing

#

it doesnt send a packet

blazing ocean
#

Yeah it doesn't trigger for right clicking with an empty slot

dawn flower
#

because mojang loves us

blazing ocean
#

Blame mojank

dawn flower
#

mojank

dense falcon
#

Lol but there is not event for this type 😭 ?

blazing ocean
#

No

#

The client doesn't send a packet

#

It's just not possible

dawn flower
#

it kinda is

dense falcon
#

😦

dawn flower
#

but u need a hacky way

dense falcon
#

😭

blazing ocean
#

Not without an item

dawn flower
#

u can make an armorstand follow the player's camera

#

(invisible one)

blazing ocean
#

💀

#

You could also just make a custom air model

dawn flower
#

that would need a tp

blazing ocean
#

tp?

dawn flower
#

texture pack

blazing ocean
#

No, a resource pack. It's not the same thing

slate siren
#

Problem solved.

dawn flower
#

i've been lied to my whole life

#

what's the difference

blazing ocean
#

Resource packs do much more than just textures

#
Minecraft Wiki

A texture pack was a collection of files that were used to change the in-game textures of blocks, items, mobs and the GUI. They were .zip files that had various PNG images in them and a text document named pack.txt. The native resolution of Minecraft's textures were 16×16 (measured pixels in block height and width). 32×32, 64×64, 128×128, 256×25...

#

"was a collection of files"

dawn flower
#

oh

#

am dumb

blazing ocean
#
Minecraft Wiki

A texture pack is the mechanism used to customize textures in Java Edition prior to 1.6.1 and in Xbox 360 Edition prior to TU13.
Texture pack may also refer to:

Resource pack, the current mechanism used to customize textures and other assets in Java Edition
Texture pack/DLC, downloadable replacement textures in Bedrock and Legacy Console editio...

safe furnace
#

anyone if knows :) thanks.

wise mesa
#
Minecraft Wiki

Interaction entities are a technical entity, useful for map or data pack creators to see who the last player to click on a certain spot is. They can only be created with the /summon or /execute summon commands.
Interaction entities are invisible, invincible and of a custom size. Their boundary box can be viewed via the F3 + B debug shortcut.

#

But yea you would have to do the same thing with it following where the player is looking

#

Probably

wise mesa
#

You can just assume at that point

blazing ocean
#

Well the term sucks since resource packs do a LOT more than just textures

wise mesa
#

It’s true

#

They even have some basic shaders now??

blazing ocean
#

Not basic

wise mesa
#

That’s wild to me haha

#

Well basic in their scope I mean

blazing ocean
#

You can do a lot of cool fuckery with them

#

Spheya made coloured lighting with just a resource pack.

wise mesa
#

I don’t think you can replace every shader in the game like you can with optifine/iris

#

That’s dope

blazing ocean
#

Well most

blazing ocean
wise mesa
#

That’s pretty cool

#

Do you know how they work?

blazing ocean
wise mesa
#

Like do you just write shader programs

blazing ocean
#

They get some custom info from the server

blazing ocean
wise mesa
#

Or does it use some kind of weird json format

#

Wow that’s pretty cool

#

Resource packs really are something nowadays

#

Especially combined with data packs

#

Mojang has done a really good job moving things out of code and into data

blazing ocean
wise mesa
#

That’s so interesting

#

I mean it makes sense but

#

I just never would’ve expected mojang to add that

blazing ocean
#

Shaders themselves are kind of simple but making cool shit with them is harder

wise mesa
#

For sure

#

I tried to make my way through that online shader book at one point but never finished

lost matrix
#

A Player is also an Entity, meaning this should def result in a Player being returned.

eternal oxide
#

If they are online

coarse parcel
#

i can raytrace entities to check for block displays, right?

#

the raytrace thing doesnt go based off of hitboxes, righttt?

slender elbow
#

:Clueless:

pseudo hazel
#

wdym

#

the worlds ray functions detect entities yeah

coarse parcel
#

it does not need a hitbox

#

World#rayTraceEntities does not check for hitboxes

slender elbow
#

is that a question or a statement

coarse parcel
#

its a question?

#

:P

slender elbow
#

it certainly didn't sound like one lol

coarse parcel
#

checking for entity "collisions" does not mean it needs a hitbox to work?

slender elbow
#

well, you can only collide with entities that have a hitbox

coarse parcel
#

how do i check for display entities then

#

nevermind

#

found it

#

sorry

#

forgot the raysize

slender elbow
#

hm, looking at it, it doesn't really need to have a hitbox

coarse parcel
#

Note: Due to display entities having a zero size hitbox, this method will not detect them. To detect display entities use rayTraceEntities(Location, Vector, double, double) with a positive raySize

#

i wasnt using the raysize param

pseudo hazel
#

i guess ray trace works in mysterious ways

umbral ridge
#

Yes

slender elbow
#

it literally just does a getNearbyEntities by max distance, expands their bounding boxes by the ray size, and checks if the ray intersects the bounding box

pseudo hazel
#

is bounding box not hitbox?

slender elbow
#

yeah

pseudo hazel
#

oh but it expands from a dot to ray size

slender elbow
#

yeah

pseudo hazel
#

that kinda makes sense I guess

slender elbow
#

it's less of ray tracing and more of, uh, that

echo basalt
#

wouldn't it make more sense to just uh

#

create a bounding box at each point with a diameter of raySize and see if any of the corners intersect any though

#

instead of expanding entity boxes

slender elbow
#

i mean it works either way, but also, what does "at each point" mean? what is your atom here?

torn shuttle
#

urgh

#

I've written the exact code illusion is talking about here

#

still part of my legacy code suite

#

you need a resolution

#

it's not great

slender elbow
#

yeah i mean ray-tracing and step-based is bound to not work with 100% accuracy

pseudo hazel
#

"each point" would be the position where it grows from anyways

torn shuttle
#

hmmmmmm....

#

not with that attitude

slender elbow
torn shuttle
#

there's two ways to do it either resolution or if you want to get fancy with it raymarching, never did the second one for this purpose but with some math I can imagine it could be a funky way to do it

#

pretty sure if you did a raymarch with a simple validation you'd have 100% accuracy

#

but also probably expensive to run, idk it's overkill for this application anyway

#

raymarching is great though, it can do a lot of interesting things

#

great for faking fluids too

#

if anyone wants to get megasweaty they could try to implement entity chunking and raymarching for a really accurate and efficient ray

worthy yarrow
#

I think you forgot we're spigoteers, not magmachads

slender elbow
#

yeah in here we ask basic java questions and refuse to learn any math beyond addition

worthy yarrow
#

I actually am a pro, I learned subtraction too

alpine urchin
#

no one in vc

#

:c

worthy yarrow
#

No vc today D:

ivory sleet
worthy yarrow
#

Hey do you guys have any tips for designing data structures?

pseudo hazel
#

like what?

worthy yarrow
#

Anything generally applicable?

ivory sleet
worthy yarrow
#

I'll be sure to have a chat with a couple of them

#

A little gathering if you will

ivory sleet
#

sounds good

#

well also

#

Don’t copy pasta from jdk source

#

Much of its code is not really up-to-date

worthy yarrow
#

Fair enough

ivory sleet
#

I mean its fair to read it, but yk, doing a goofy copy pasta copege

worthy yarrow
#

I tend to write things out and play around with them myself so

ivory sleet
#

yea that’s nice

ivory sleet
#

I wrote that!

blazing ocean
#

FAFO driven dev >>>>

ivory sleet
river oracle
#

Don't look at any sources unless it's sources to learn about the idea behind the structure itself

#

You won't learn copy pasting

#

Also avoid geeks for geeks

#

Their data structure implementations are god awful

ivory sleet
#

dont they just provide pseudo code anyway?

blazing ocean
river oracle
ivory sleet
#

oh right

river oracle
#

Java and C usually

#

But their code especially tree implementations are horrid

blazing ocean
ivory sleet
#

I remember talking to one of the devs of one of those guide sites, and he just wrote code, didnt even try it before publishing an article or something m_facepalm

river oracle
blazing ocean
#

fixed that for you

alpine urchin
#

i wanna send a gif

#

but no one is active in general

ivory sleet
#

tag fourteen

#

He likes em

river oracle
#

@worthy yarrow tho I'd reccomend finding a reputable data structures course at a local tech college or university from a processor with good ratings

blazing ocean
#

Oh god

river oracle
#

You actually stand to gain a lot from a datastructures course

ivory sleet
#

Google generally has good and well implemented data structures on their repos iirc

alpine urchin
#

erm

#

🤓

#

i was implored by staff

river oracle
ivory sleet
#

@alpine urchin

ivory sleet
blazing ocean
ivory sleet
#

Often times u don’t have the exact data structure u need so u cant find it anywhere regardless

river oracle
ivory sleet
#

yea idk tbh

worthy yarrow
#

Well yes

river oracle
#

If you need to make your own I'd reccomend looking at the theory and take a crack yourself

#

It'll be hard if it's a complex structure but you stand to gain a lot

worthy yarrow
#

^ this is exactly what I am doing right now actually

acoustic pendant
#

Is it normal that using adventure api in spigot (having it relocated) sending a message uses 0.04% server thread? Or is it too much

river oracle
#

I wouldn't over analyze that

#

Look if it becomes a problem

alpine urchin
#

just only send a message if the user is looking at their screen

#

and not sleeping

#

best optimization

acoustic pendant
#

I mean, this command is consuming 0.08% server thread

#

I think that's too much right?

alpine urchin
#

oh no!

river oracle
#

This is giving x y problem energy

ivory sleet
#

its probably a bit much, but like, there’s so many layers of abstraction there adri so like, it’s presumably not surprising

tardy delta
#

you bought the whole cpu, youre gonna use the whole cpu

alpine urchin
#

i /command you to send me your plugin source rn

river oracle
#

If you're concerned about performance use a proper profiler and use JMH

acoustic pendant
alpine urchin
#

or JProfiler

#

my sponsor

#

hey guys

#

this video is sponsored by jprofiler

ivory sleet
#

Shameless

alpine urchin
#

jk, they provide a free license to open source projects

#

if you regard that as a sponsor

#

then its a sponsor

#

they sponsor me a free license

ivory sleet
#

if not, then not an issue by any stretch of the imagination

acoustic pendant
acoustic pendant
#

Because I'm looping through the config which can be expanded

ivory sleet
#

u’re reading io?

#

Or looping through a cached config ?

acoustic pendant
#

cached i think

river oracle
#

👀 doing IO in the main thread be like

ivory sleet
acoustic pendant
#

or wdym about io?

#

Mb but just in case

ivory sleet
#

Io as in u reading the contents of that file from the disk

acoustic pendant
#

Oh no

#

cached

ivory sleet
#

As opposed to read it from memory ^

#

Alr well I wouldn’t worry too much then

#

I mean you can ask yourself if you really need the adventure api in that specific case, lets say you’re just sending a simple message

acoustic pendant
#

I do need it, for colors xd

ivory sleet
#

And minimessage isnt enough?

#

or yea fuck u using minimessage

#

Im dumb

acoustic pendant
#

yea

eternal night
ivory sleet
#

Lynx lurking

eternal night
#

per usual

acoustic pendant
#

The thing is I don't know if I can handle the message consum

#

0.03 is because of adventure code

ivory sleet
#

I mean maybe u could load up the message on start up or something ?

#

if you’re not doing that rn

acoustic pendant
#

Not doing that

#

but that actually doesn't do anything

ivory sleet
#

Well I havent seen ur entire spark so idk

alpine urchin
#

spark a fire

acoustic pendant
#

Use this better @ivory sleet

sleek island
#

i think im just stupid but how do i pathfind an nms entity to a location in 1.20?

acoustic pendant
ivory sleet
#

ah okay its because it calls gson, and has to serialize and everything

#

doing like AAA SHIT bunch of method calls under the hood

#

many layers of abstraction I suppose?

ivory sleet
river oracle
#

Adventure is super abstracted

#

But for a good reason

ivory sleet
#

every cool entity has a navigation object u can invoke

acoustic pendant
#

Then is it not my problem?

eternal night
#

I mean, it using gson to round trip to bungee component is kinda needed given you are using platform?

ivory sleet
#

🥲

sleek island
ivory sleet
#

U need to make sure that no goals/brain activities are interfering w it

#

yes its a pain, but doable

sleek island
#

ive cleared all the goals

ivory sleet
acoustic pendant
#

It doesn't have that much impact however

#

so yeah

ivory sleet
#

Could use this other fork if that satisfies u more, think adventure is better implemented there

eternal night
#

Well they are using it

#

but yea, you'd have to dip the platform/spigot support

ivory sleet
#

ye

eternal night
#

or come up with some abstraction over bukkit platform

ivory sleet
#

ah yea like LuckPerms

ivory sleet
#

but I mean in theory its just some method calls on the navigation

sleek island
#

i treid using the movetoblock goal
public class PathfindGOTOBLOCK extends MoveToBlockGoal {
private final BlockPos targetBlockPos;

public PathfindGOTOBLOCK(PathfinderMob pathfinderMob, double speedModifier, Location location) {
    super(pathfinderMob, speedModifier, 0);
    // Convert Bukkit Location to Minecraft BlockPos
    this.targetBlockPos = new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ());
}

@Override
protected boolean findNearestBlock() {
    // Set the block position to the target
    blockPos = targetBlockPos;
    return true;
}
@Override
public void tick() {
    blockPos = targetBlockPos;
    this.mob.getNavigation().moveTo((double)((float)blockPos.getX()) + 0.5, (double)blockPos.getY(), (double)((float)blockPos.getZ()) + 0.5, this.speedModifier);
    super.tick();
}
@Override
protected boolean isValidTarget(LevelReader levelReader, BlockPos blockPos) {
    // Check if the target block is valid (implement your logic here)
    // For demonstration purposes, we'll assume all blocks are valid.
    return true;
}

}

#

to make a custom goal

ivory sleet
#

Ah I almost forgot about the “legacy” goal system

#

but lets see

sterile breach
sleek island
#

the args List

#

if u need it to be a number u can parse the string with args[n], with n being the argument

ivory sleet
#

or u have to set the executes() for all arguments

#

that is both for the literals and arguments on the tree

ivory sleet
sterile breach
ivory sleet
#

Your only job is to filter out valid blocks

sleek island
#

yea but i cant implement that

#

how do i do so

#

i noticed the entity moves back to where it was spawned

ivory sleet
#

and u pass same execution logic to both executes() invocations

ivory sleet
ocean hollow
#

Any ideas on how to make these numbers and wheel rotate?

sterile breach
remote swallow
#

is the entire thing an image or are the numbers sperate displays

ocean hollow
#

numbers and wheel separately

#

numbers - text display

ivory sleet
#

but like

ocean hollow
remote swallow
#

transform them

ivory sleet
#

thought u were on about brigadier

remote swallow
#

spigot command system doesnt use brigadier

lament tree
#

Without breaking SpigotMC's rules, where do I find developers that would work for money?

chrome beacon
#

?services

undone axleBOT
lament tree
#

Thank you

ocean hollow
remote swallow
#

math

sterile breach
ivory sleet
#

yea

#

You just parse it

remote swallow
#

because spigot doesnt care what args there are, it just hands you them all

ivory sleet
#

you just check argument n + an extra m arguments w spigots command executor api

ocean hollow
# remote swallow math

and how is LeftRotation applied? does it rotate relative to the center? or just the visual itself?

ivory sleet
#

@sleek island if my memory isnt trolling me

#

You can override findNearestBlock

sleek island
#

you can?

ivory sleet
#

And that should be fine just

sleek island
#

lemme try it tysm

ivory sleet
#

Similarly to how u did

sterile breach
ivory sleet
#

no its not

#

but if u want a variable argument u probably need to use greedy argument type

#

w a string

#

I guess it could be possible to have a custom argument type

sterile breach
ivory sleet
#

yup

sterile breach
#

are you sure its possible? for brigaddier every space marke a new arg I think

ivory sleet
#

StringArgumentType.greedy()

sterile breach
#

just to be sure, if I want to accept 2 args, what should I do?

                .executes(context -> {
                    System.out.println("a");
                    CommandSource source = context.getSource();

                    Component message = Component.text("Hello World", NamedTextColor.AQUA);
                    source.sendMessage(message);

                    // Returning Command.SINGLE_SUCCESS means that the execution was successful
                    // Returning BrigadierCommand.FORWARD will send the command to the server
                    return Command.SINGLE_SUCCESS;
                })

ivory sleet
#

@sleek island anyway if u wna implement it urself, implement canUse() and canContinueToUse() properly, run moveTo() in start(), (u may wanna run it in tick() to recalculate path), dont forget to set goal flags

ivory sleet
sterile breach
# ivory sleet I mean if you KNOW you wanna accept two args, just arg1.then(arg2) and arg2.exe...

I find this example, where do you add you arg2 implmentation (I am note sure to understand that you said)?

    public static BrigadierCommand createBrigadierCommand(final ProxyServer proxy) {
        LiteralCommandNode<CommandSource> helloNode = BrigadierCommand.literalArgumentBuilder("test")
                .requires(source -> source.hasPermission("test.permission"))
                .executes(context -> {
                    CommandSource source = context.getSource();

                    Component message = Component.text("Hello World", NamedTextColor.AQUA);
                    source.sendMessage(message);
                    return Command.SINGLE_SUCCESS;
                })
                .then(BrigadierCommand.requiredArgumentBuilder("argument", StringArgumentType.word())
                        .suggests((ctx, builder) -> {
                            proxy.getAllPlayers().forEach(player -> builder.suggest(
                                    player.getUsername(),
                                    VelocityBrigadierMessage.tooltip(
                                            MiniMessage.miniMessage().deserialize("<rainbow>" + player.getUsername())
                                    )
                            ));
                            builder.suggest("all");
                            return builder.buildFuture();
                        })
                        .executes(context -> {
                            String argumentProvided = context.getArgument("argument", String.class);
                            proxy.getPlayer(argumentProvided).ifPresent(player ->
                                    player.sendMessage(Component.text("Hello!"))
                            );
                            return Command.SINGLE_SUCCESS;
                        })
                )
                .build();
        
        return new BrigadierCommand(helloNode);
    }

ivory sleet
#

how does ur command look?

#

like in terms of /cmd arg arg arg…

sterile breach
ivory sleet
#

Ah okay

#

I can send u some code

#

As example

sterile breach
#

with pleasure

eternal oxide
#

are you still messing with making a command for yoru click event?

#

nm

sterile breach
#

I don't remember doing this

ivory sleet
#

My discord is soon updated on my laptopie

#

with pleasure

ivory sleet
#

did u read DMs?

#

I sent some stuff there

alpine urchin
#

so kind

thin frost
#

Hey guys, how do I increase the number of enemies/mobs in total that should be spawnable on the server and also a specific mob e.g., iron golem?

thin frost
#

I've been looking, which settings exactly?

#

I have made a plugin that spawns a lot of monsters but it seems like I run in some max cap for certain enemies e.g., iron golem

lost matrix
#

something something spawn-limits

thin frost
#

@lost matrix can't seem to find it

lost matrix
#

Probably looking in the wrong config file

thin frost
#

I have already looked around and I can't find the config, hence why I am asking here.

#

In which config find would I find this?

lost matrix
thin frost
#

So I am asking for an alternative way.

#

If you know please help me figure out how to change it.

lost matrix
thin frost
#

What's the name of the config file?

lost matrix
#

bukkit.yml

thin frost
#

Ok so that groups all monsters under one bucket, how do I do it specifically for e.g., iron golem?

lost matrix
#

Programatically?

thin frost
#

Sure

lost matrix
#

What platform are you running?

thin frost
#

Spigot latest (1.21) windows

lost matrix
#

In that case there is no more granular way to increase the spawn limits

thin frost
#

Bummer, alright thanks.

#

I'll try bumping monster limit to ~5k

lost matrix
#

Sounds like a safe way towards 5TPS

#

What are you trying to do in the first place?

thin frost
#

Seems to run pretty smoothly with 2500

#

I'm increasing the number of enemies with the number of people online

#

Atm I'm just hooking into natural zombie spawns but it would be awesome to spread the spawns further to not make it all as grouped

#

Not sure how to achieve that though

lost matrix
#

What are you trying to do in the first place?

lost matrix
thin frost
#

Ah sweet

lean arrow
#
    @EventHandler
    fun BlockPlaceEvent.onBlockPlace() {
        val blockItem = CraftItemStack.asNMSCopy(ItemStack(blockPlaced.type))

        val tagsList = ListTag()
        tagsList.add(StringTag.valueOf("#dmcc:all"))
        val tag = blockItem.orCreateTag
        tag!!.put("CanPlaceOn", tagsList)

        blockItem.tag = tag
        val modifiedBlock = CraftItemStack.asBukkitCopy(blockItem)
        val itemMeta = modifiedBlock.itemMeta
        itemMeta.addItemFlags(ItemFlag.HIDE_PLACED_ON)
        modifiedBlock.itemMeta = itemMeta
        player.inventory.addItem(modifiedBlock)
    }

am i missing something, this doesnt seem to work for me, no errors, i just dont get an item

worthy yarrow
#

Not a kotlin expert but I'm not too sure that's how you define listeners

lean arrow
#

nah that part's fine, its a nice extension function feature

river oracle
#

Please don't

#

I use kotlin too blood but that isn't it

lean arrow
#

i enjoy it 🤷

river oracle
worthy yarrow
#

I always see rad do it like:

    fun onPlayerJoin(event: PlayerJoinEvent) {```
lean arrow
#

yeah you can absolutely do it like that

#

but it just saves me from having to write event all the time and im lazy

river oracle
lean arrow
#

man i was not looking for kotlin advice, im perfectly fine using it like that 😭

river oracle
#

Extension functions compile down to static util methods

#

Not guaranteed to play nice with the current event system

#

Come back with a properly registered and formatted event handler and I'll be haply to help

lean arrow
#
@EventHandler
    fun onBlockPlace(event: BlockPlaceEvent) {
        val blockItem = CraftItemStack.asNMSCopy(ItemStack(event.blockPlaced.type))

        val tagsList = ListTag()
        tagsList.add(StringTag.valueOf("#dmcc:all"))
        val tag = blockItem.orCreateTag
        tag!!.put("CanPlaceOn", tagsList)

        blockItem.tag = tag
        val modifiedBlock = CraftItemStack.asBukkitCopy(blockItem)
        val itemMeta = modifiedBlock.itemMeta
        itemMeta.addItemFlags(ItemFlag.HIDE_PLACED_ON)
        modifiedBlock.itemMeta = itemMeta
        event.player.inventory.addItem(modifiedBlock)
    }
``` there you go
river oracle
#

Have you used debug statements

#

Are you sure the event runs

lean arrow
#

yes and yes

river oracle
#

Are you sure

pseudo hazel
#

and what if you give yourself just a normal item?

lean arrow
river oracle
lean arrow
#

trying that now

river oracle
#

Ik the issue prob

#

Don't convert back to a Normal Bukkit stack stay using a CraftItemStack

#

Bukkit can't represent some of the data you're adding

#

It's probably lost in translation

#

Try using a mirror

#

asCraftMirror

#

This is prob old nms I'm guessing

lean arrow
#

using 1.20.4 remapped moj

river oracle
#

Try using a mirror instead of a bukkit copy

lean arrow
#

will do

worthy yarrow
#

So like what do we use nms for nowadays

#

I feel like a lot has been implemented in spigot hasn't it? At least since 20.5

river oracle
young knoll
#

? I don’t think a ton has changed in spigot since 1.20.5

worthy yarrow
#

prior to 20.5 I meant

river oracle
#

ItemMeta is so blegh imho

#

Especially after seeing components

worthy yarrow
#

Ig that's why I'm shading adventure for component support kek

river oracle
#

There is kinda it goes through ItemMeta still but it's far less powerful than actual components

young knoll
#

What is missing

river oracle
#

Well yeah that's the ItemMeta limitation

#

You have to do it to specific items that should have that type

young knoll
#

Technically that’s how the game is meant to be

#

But yea you can add the component to anything technically

river oracle
#

They have hard cap on values already

#

I think the argument for ItemMeta is fairly week. Doesn't mean it's horrid API it can be done better tho

young knoll
river oracle
#

I think components are much more ready to handle such a transition

young knoll
#

Well let’s cross that bridge when we come to it

river oracle
#

Not to mention having to clone ItemMeta to read is annoying

young knoll
#

Well then you should get to work

river oracle
#

I'll do so when my current inventory crusade comes to an end

#

I'm not just sitting here complaining I'm actually trying to do stuff to make improvements. It's easy to complain but I genuinely also want to change things

#

I honestly usually see that as a you won't comment but I will :P may not be soon I can only do so much at once

#

It's a clone automatically

#

It's a copy your editing

#

Why do you think you have to set it again

#

Feel free to contribute you have to sign a CLA but all contributions are welcome

#

It's always nice to have more people working on things

#

?contribute

river oracle
#

@blissful crow I'm always open to questions if you need help contributing

#

I'm #1 spigot shill

#

Wanna know how to understand nms :3

#

Contribute

#

Or spend a few weeks fucking around with specific things

#

I did the latter

#

Blegh that's just packets

young knoll
#

Plib can be kinda weird

#

You got write the right types to the right indexes

river oracle
#

@ retrooper plug

young knoll
#

Makes me wonder… can I send a raw byte[] to the client

#

If so you could make a very lightweight yet pretty advanced packet system

river oracle
#

I'm not really familiar with netty so I can't really answer that fully

floral drum
#

yes

#

in a way

young knoll
#

I haven’t actually looked deep enough

floral drum
#

The thing is with nms handling, it pre-processes your packet before it's sent, which essentially encodes it's id, the length, and all the data, as it seems to only take the Packet<?> class. But, there might be a way around it.

hard socket
#

can I destroy an Item using the Damagaeble interface?

river oracle
#

@young knoll what happened to ItemType changes

young knoll
#

Well recreating the preprocessing should be easy

#

It’s just an ID and length

young knoll
river oracle
#

Forge and Fabric are much less simple

#

lots of writing JSON files and such to add stuff

#

imho the APIs are much less user friendly to beginners. Fabric you are kinda expected to mostly be using mixins though you can also use their API though in scale its much smaller than spigot

floral drum
river oracle
#

I have minimal experience with both but those are simply my observations

young knoll
#

I don’t want a custom data packet

#

I just want to send packets by encoding them raw

young knoll
#

Fabric has some sort of datagen system you can use

river oracle
#

not a downside just an observation

floral drum
#

Right so you'd just simply have to use the PacketDataSerializer, or write directly to the "ByteBuf"

young knoll
#

I’ll have to look into PacketDataSerializer

floral drum
#

yeah luckily it's quite simple to understand

#

I use it sometimes to construct packets that don't have the necessary constructor

young knoll
#

Thankfully netty isn’t obfuscated so you can just depend on it and its ByteBuf directly

floral drum
#

or just for custom data like chunks

young knoll
#

I’m curious why they encode the packet length

#

Can’t they just read until the end of the data

floral drum
#

I'm pretty sure they do, and I'm pretty sure it's to ensure you receive the correct length of data.

young knoll
#

Fair enough

floral drum
#

Yeah they do

slender elbow
#

tcp networking 101: framing

#

there is no "end of data", it's just a continuous byte stream with no inherent framing, so you need to come up with your own

young knoll
#

I see

#

Does it just block if nothing is being sent at the moment

slender elbow
#

it will wait, yeah

#

the most basic and just reliable kind of framing is bytes length followed by bytes

#

you could do, like, a delimiter, like a null terminator, but 💀

young knoll
#

Then you can’t use the value elsewhere

#

Which is an oof

floral drum
#

Essentially it takes the current readable bytes of the Netty ByteBuf, and adds it to the PacketDataSerializer.a(readableBytes) (Not sure what this method does). To ensure the packet is writable for that length.
It then writes the length of the packet using - PacketDataSerializer#d (Writes a VarInt).
And then lastly it writes all the bytes from the ByteBuf to the PacketDataSerializer.

(This is what I get from the Prepender class)

slender elbow
#

spigot mappings 💀

young knoll
#

So it’s just packet id, data length, data

floral drum
#

Length - Id - data

young knoll
#

Ah length is first

#

Interesting

floral drum
#

Ah okay PacketDataSerializer#a is getVarIntSize

young knoll
#

Is that not just the length of the byte array

slender elbow
#

as a varint

#

it's just a way to encode a compressed int, instead of always sending an int as 4 bytes

floral drum
#

So step by step to construct a ByteBuf/PacketDataSerializer to send to the client

  • Write the (to be sent) bytebuf's length as a varInt (PacketDataSerializer#d)
  • Write the (to be sent) bytebuf's current data using writeBytes
  • Write the Packet ID as a varInt (PacketDataSerializer#d)
  • Write the Packet Data
dense falcon
#

How can I know if the player has an anti kb, I saw talk of the velocity but what value indicates that it is possible that the player has it or that he necessarily has it.

river oracle
#

that moment when the fix for SPIGOT-6833 causes SPIGOT-7856

young knoll
floral drum
#

That's what I can see from how nms is written

#

it's strange

torn shuttle
#

is there an event for potions that place blocks

floral drum
#

ima look at the client to see what it does

#

1 sec

#

Wait I see how it works now okay

slender elbow
#

i mean this is all documented in wiki.vg lol

floral drum
#

@young knoll
So yeah it essentially -

Packet encoding

  • Write the id of the packet as a varInt (into data)
  • Write the packet data (into data)

After, into the outbound ByteBuf

  • Writes the packet length as a varInt (data.length)
  • Then writes all the bytes for the whole of the packet (data)
torn shuttle
#

I would like to nominate Damageable as a strong contender for the worst part of the spigot api

young knoll
#

Which one

#

Kek

fiery wren
#
    public static void when(AtomicBoolean b, Runnable runnable) {
        Thread thread = new Thread(() -> {
            while (!b.get());
            runnable.run();
        });
        thread.start();
    }```
is there a better way to do this
river oracle
#

I'm going to need more context this seems possibly very scary

fiery wren
#

when "b" becomes true, is runs runnable

river oracle
#

why

fiery wren
#

why not

river oracle
#

why do you need to run a task when a certain random AtomicBoolean turns true

#

sounds very suspicious of bad design

fiery wren
#

my friend told me "why isn't there a when keyword like while and if" so i did that

#

for fun

#

and was wondering if u can do it better

river oracle
#

I think the best you can do is strive to never use this

fiery wren
#

ok

floral drum
young knoll
#

Damagable is an ItemMeta concept and an entity concept

river oracle
#

I'm so stupid I was so overcomplicating this plugin loading system never even thought of using a graph 😭

torn shuttle
slender elbow
#

CompletableFuture ✨

river oracle
slender elbow
#

if it works for you

river oracle
#

I just go raw on threads with AtomicBooleans

grave kayak
#

hello, does anyone know how i would cancel the crafting event for the autocrafters

haughty oak
#

anyone had this problem where intellij can't recognise bukkit classes and ends up looking like this

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

unique shuttle
#

Does anyone know if there is a way to get the number of lines in TextDisplay?

haughty oak
#

anyone had this problem where intellij can't recognise bukkit classes and ends up looking like this

#

the plugin builds just fine

worthy yarrow
haughty oak
worthy yarrow
wary oyster
#

whats the best way to move the player? my end goal is a parkour plugin that generates parkour that has an option to move the player automatically through it
i saw that you can apply velocity to the player but id rather not have to completely mimic the vanilla movement

hybrid spoke
wary oyster
#

wait spigot just has a pathfinder??

#

this is my first self project after doing youtube tutorials

hybrid spoke
hybrid spoke
wary oyster
#

nah ive made it before in python i know the coding concepts

#

but my python one only worked outside of the game

#

and just generated

hybrid spoke
#

to let the player jump the parkour automatically will be the hard part

wary oyster
#

yeah

#

i was thinking i would have to recreate the player movement with the vector methods

wooden zodiac
#

how to get black stained glass pane in 1.8 itemstack?

hybrid spoke
#

yeah but you would need a path or whatever which you can push along

hybrid spoke
wary oyster
#

i thought it was just a number

wooden zodiac
hybrid spoke
#

then screw it lol

wooden zodiac
#

its important

#

for client

wary oyster
#

are you perhaps doing something with hypixel skyblock

#

if not ignore

hybrid spoke
#

its this shit

#

where data is the color iirc

wooden zodiac
wary oyster
hybrid spoke
#

thats where the hard part begins

wary oyster
# hybrid spoke thats where the hard part begins

i would probably just look at how they implement player movement, and use only that then just hardcode jump paths for specific jumps given an end and start point, that way i dont have to do any complicated on the fly reasoning since all of whats upcoming is known behind the scenes in code

#

no need to overcomplicate with on the fly reasoning when im using disscrete known chunks

#

wait cant i just do a thing where when registering a new jump, i make a thing that is called every tick that gets the velocity and saves it to a list, then that list can be used to individually set the velocity

#

then i literally do not need to simulate anythin

#

then again, the jump of a minecraft player is a parabola of a specific max distance for a given velocity, and you can only gain a specific amount of momentum with a given number of space, and the parabola could be simulated, the vectors would be generated from the slope on that graph.

#

🤔

#

simulated seems very possible and kind of fun ngl

vague bolt
#

Hi Rob, good question. If you want to do this optimally, I recommend storing the usernames in-memory in a radix-tree. Feel free to take my implementation if you want (do bear in mind the LGPL license). The test show guide you on how to use it (basically you call .traverse with the prefix of the username): https://github.com/Jannyboy11/InvSee-plus-plus/blob/master/Utils/src/test/java/com/janboerman/invsee/utils/UsernameTrieTest.java#L47

GitHub

A bukkit plugin for manipulating player inventories - Jannyboy11/InvSee-plus-plus

GitHub

A bukkit plugin for manipulating player inventories - Jannyboy11/InvSee-plus-plus

echo basalt
#

bit more complex than a trie but does a fairly ok job

vague bolt
#

The reason this makes tabcompletion efficient for non-empty prefix strings, is you only have to search the descendents of the node that is found when traversing through the prefix.
It's also space-optimised; you won't have to store all the full username strings: common prefixes will be shared in memory.

foggy cave
#

Hey guys, I'm pretty new to Java and I have a background of C++, I have this snippet of code and not really sure how memory management really works on java, so I was wondering if I had to set the variables to null (I couldn't find a destructor)

@EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) {
        if (event.getEntity() == null)
            return;

        PlayerAccount victimAccount = AccountLoader.getPlayerAccount(event.getEntity());

        if (victimAccount != null)
            victimAccount.setDeaths(victimAccount.getDeaths() + 1);
        // else: add 2 queue

        if (event.getEntity().getKiller() == null)
            return;

        PlayerAccount killerAccount = AccountLoader.getPlayerAccount(event.getEntity());

        if (killerAccount != null)
            killerAccount.setKills(killerAccount.getKills() + 1);
        // else: add 2 queue

        victimAccount = null;
        killerAccount = null;
    }
hazy parrot
#

Gc will handle that for you

foggy cave
umbral ridge
#

Dont use deprecated methods

eternal oxide
#

(IF there is a replacement)

umbral ridge
#

there has to be a better way

#

☕🚬

foggy cave
umbral ridge
#

Did you use gorilla glue on your hair

eternal oxide
#

He was probably scrolled up and commenting on a previous post.

white root
#

what should I set the default: to for a permission node in my plugin if I want nobody (not even OP players) to have it unless they explicitly have that permission node?

#

I want to use permissions as a type of per-player settings thing for my plugin, so I have a plugin.ignoreme permission that makes the plugin just not interact with the player
But I dont want anybody (OP or not) to have the permission by default

eternal oxide
wary oyster
#

what is the smallest unit of vanilla minecraft hitboxes in units of block pixels?

#

found a list

echo basalt
wary oyster
#

it appears to be a lily pad

#

does anyone know of any block with a finer precisionn than that from newer versions?

echo basalt
#

at that point just use entities

karmic falcon
#

hi,i am trynna give a custom nbt tag to an item so it dont stack, i cant import those classes tho

echo basalt
#

Import spigot not spigot-api

#

might need to run buildtools for that

karmic falcon
#

this guy?

sterile breach
#

to get a player name from uuid if it never played on the server, I have to use mojang api?

eternal oxide
#

?bt

undone axleBOT
chrome beacon
sterile breach
chrome beacon
#

yes

#

It should call the Mojang API for you

drifting bluff
#

how do i make it so the get Cofnig and config woprks?

in the main file i got this

        this.saveDefaultConfig();
        this.getConfig().set("useWorldguard", true);```
chrome beacon
#

We've told you how multiple times now

drifting bluff
#

how was it

eternal oxide
#

you shoudl saveDefault before you touch the config

chrome beacon
#

There is no getConfig method in your commands class. You need to access it from your plugin instance

#

doing so with the help of di

#

?di

undone axleBOT
drifting bluff
#

this again

chrome beacon
#

Read through it

eternal oxide
#

read and learn then

#

I guess first you need to learn what an instance is

chrome beacon
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

drifting bluff
#

is this riught for the main file?

chrome beacon
#

That's not valid Java

lost matrix
#

Thats pretty much not even Java, yeah

karmic falcon
eternal oxide
#

SimpleCore plugin

karmic falcon
#

i already have my server built

drifting bluff
#

its like ehre

eternal oxide
#

and not pvp

karmic falcon
#

which external jar should i import in eclipse

chrome beacon
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

chrome beacon
#

I do recommend using maven

drifting bluff
lost matrix
chrome beacon
#

and hopefully not the Spigot jar

lost matrix
karmic falcon
karmic falcon
lost matrix
# karmic falcon 1.20.4

In that case you dont need craftbukkit or nms. Since 1.14, Spigot has an API for NBT tags.

#

?pdc

drifting bluff
#

what did i do wrong? bc i did it like in tut

    private final pvp plugin;

    public pvp(SimpleCore) {
        this.plugin = plugin;
    }
}```
karmic falcon
#

thnx but is there a way to work with NBT tags without using an api?

lost matrix
#

And if you are willing to update to 1.20.5:
Minecraft now supports setting the stack size of any ItemStack directly.

chrome beacon
eternal oxide
#

yoru field is wrong

chrome beacon
#

SimpleCore isn't a variable

#

just the start of one

eternal oxide
#

and yoru constructor is broken

drifting bluff
#
    private final pvp plugin;

    public pvp(SimpleCore plugin) {
        this.plugin = plugin;
    }
}```
lost matrix
#

Its not an external API. Its simply a part of Spigot.

near citrus
#

Hello guys, is it possible to register a new DataComponentType in nms?

karmic falcon
drifting bluff
drifting bluff
lost matrix
near citrus
# chrome beacon Try it and see

i tried but when i create a new item with the custom component it crashes the client (disconnecting), it looks like the client doesn't recognize the component but is there a way to prevent sending the component data to client?

lost matrix
blazing ocean
#

Sounds like you're registering custom components?

blazing ocean
#

At least not without that happening

#

Just use the custom_data component

near citrus
lost matrix
# karmic falcon ohh i just reread it and now i understand, thnx im still confused on why this is...

Making an Item unstackable:
1.20.5 and higher:

    ItemStack itemStack = new ItemStack(Material.DIAMOND);
    ItemMeta meta = itemStack.getItemMeta();
    meta.setMaxStackSize(1);
    itemStack.setItemMeta(meta);

1.20.4 back to 1.14:

    JavaPlugin plugin = ...;
    ItemStack itemStack = new ItemStack(Material.DIAMOND);
    ItemMeta meta = itemStack.getItemMeta();
    PersistentDataContainer dataContainer = meta.getPersistentDataContainer();
    NamespacedKey key = new NamespacedKey(plugin, "__random_id__");
    dataContainer.set(key, PersistentDataType.STRING, UUID.randomUUID().toString());
    itemStack.setItemMeta(meta);
near citrus
blazing ocean
#

Why can you not use the custom_data component?

near citrus
lost matrix
#

That would require reading the data each time

blazing ocean
#

Well, then just cache it

#

I don't get what would be hard to cache

near citrus
karmic falcon
near citrus
# blazing ocean What?

how do you expect me to cache the data? if it was entity it would be easy cause i could cache it using it's metadata, but for itemstacks there are no metadata for them

blazing ocean
#

Yes there is?

#

ItemMeta

lost matrix
drifting bluff
#

guys is there a easy alternative to the config.yml?

blazing ocean
chrome beacon
#

The config.yml is as easy as it gets

drifting bluff
#

😭

#

can someone step to step like help me with the di

#

?di

undone axleBOT
near citrus
near citrus
lost matrix
#

I personally cache the data in memory data structures and do all the detections via events

near citrus
#

with metadata you can store any objects, item meta is like bukkit version of components

blazing ocean
#

?pdc

lost matrix
#

Metadata is absolute rubbish tho.

eternal night
#

I mean, the performance killer isn't the PDC de/ser to your type.

#

it is ItemMeta cloning

near citrus
near citrus
lost matrix
blazing ocean
#

DFU 😉

lost matrix
eternal night
#

not that DFU has anything to do with it omegaroll

blazing ocean
#

You can just use it to (de)serialise NBT tags ig

eternal night
#

but having plugins insert their own class instances into nms is not smart so, you are kinda stuck with de/ser

#

(or you cache them, which is what I do for most of my shit)

#

Some 5 min evicting cache that you first try to hit with a single uuid parsed from the data, otherwise do the full read

#

writing becomes a bit more annoying but is fine usually

lost matrix
#

I currently use small identifiers in my PDC (just storing integers) and then using a registry to get the respective in-memory Objects.
Getting an int from the pdc is neglible in any event.

blazing ocean
eternal night
#

Yea, and with paper you can even read the pdc without ItemMeta cloning so

#

stonks speed

eternal night
keen charm
#

Hey

#

If I call PlayerList#initializeConnectionToPlayer() method, which calls PlayerList#onPlayerJoin(), it calls an event which uses the server thread a lot

#

And as far as I can see onPlayerJoin() calls PlayerJoinEvent

#

I am suspecting that another plugin might be listening to PlayerJoinEvent and do resource-extensive operations, but on other plugins the server thread usage is pretty low

lost matrix
#

Spark should catch invocations from other plugins. How many connections do you have to handle on average?

keen charm
#

Oh, I just saw another plugin lol

#

It had 18-19% usage

lost matrix
# keen charm It had 18-19% usage

Its 100% some garbage plugin which loads data from a File/Database and not using the AsyncPlayerPreLoginEvent but the PlayerJoinEvent for that.

keen charm
#

Not sure if it's a garbage plugin tho, but for data loading it is

grim ice
#

do blocks have PDCs?

tall dragon
#

some, TileEntities do

#

like a furnace

chrome beacon
#

?blockpdc

undone axleBOT
tall dragon
#

tho resources exist that allow for a pdc

#

^

grim ice
#

nice

wooden zodiac
#

What is persistent data container

lost matrix
#

It is a container which can store persistent data.
persistent means it wont vanish on restarts.

#

?pdc

lost matrix
#

You can store data on things like ItemStacks, Entities, Players, Chunks, Worlds, certain Blocks and some more.
All of them have a PersistentDataContainer.

lost matrix
#

Yes its one of the coolest api features and i use it a lot

upper hazel
#

inventory click event not detect item move with 1-9 numbers

#

what the event i need use?

lost matrix
#

InventoryClickEvent

upper hazel
upper hazel
chrome beacon
#

It is the event you need

upper hazel
#

oh wait

#

I didn't translate it correctly. When I move an item through the keyboard buttons (1-9) from inventory to my inventory, inventoryClick does not work.

chrome beacon
#

Show your code

lost matrix
#

That is a missconception. The InventoryClickEvent is fired when you move items into your hotbar from another Inventory using the number keys.

grim ice
#

btw

#

how'd I copy the direction of my character

#

to use in code

#

nvm, im kinda stupid, i can just print it out

lost matrix
lost matrix
grim ice
#

oh!

#

right

#

im trying to basically launch a snowball

upper hazel
grim ice
#

but i cant be bothered to do trial and error

#

to see what number values work best

upper hazel
#

but not work

#

not detect

lost matrix
#

?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.

lost matrix
#

Ah its in the video

grim ice
#

so uh, how do i get a vector from this again..

upper hazel
#

player.<getVectorMethod>

grim ice
#

no um

upper hazel
#

dont remeber

grim ice
#

I want to use my player's vector

#

but

#

not on it

#

like, I want to shoot a snowball from a block

#

but with this exact direction..etc

eternal oxide
#

player location.getDirection() gives the vector

#

just spawn teh snowball at the location you want, applying teh vector and velocity you want

lost matrix
#

*getEyeLocation()

grim ice
#

thank you guys

#

also uh

#

how do I change the vector so that the starting point is the dispenser block's face?

eternal oxide
#

no

#

a vector has no origin

#

a Location is a point defining a position

#

a Vector is just an indication of a direction

lost matrix
ivory sleet
wooden zodiac
#

why there's no splash potion in 1.8.8 spigot?

ivory sleet
#

there is?

languid briar
#

There is bro

eternal oxide
eternal oxide
#

using launchProjectile you can provide the projectile and a vector

lost matrix
#

What. I thought he wanted to fire a custom virtual projectile via particles...

#

But he just wants to fire a vanilla Projectile. oof. Good thing Elgarl got thatz

ivory sleet
grim ice
ivory sleet
#

in which there's no "material" for it

#

but yea

dapper flower
#

What is a good place to get support/guide on how to use protocol lib? I can't find a good place to ask questions

ivory sleet
#

I think the general deal is to use packet events instead, but there should be plenty resources online, like on forums etc

#

else just ask away here

river oracle
#

Today is finishing my plugin loader day

#

I realized far to late I could use a graph to detect circular dependencies

#

Perfect for constructing a load order

dapper flower
# ivory sleet else just ask away here

well i wanted to update the sign from he client side in an an area: here is what I came up with after searching a bit

PacketContainer packet = pm.createPacket(PacketType.Play.Server.TILE_ENTITY_DATA);

BlockPosition blockPosition = new BlockPosition(block.getX(), block.getY(), block.getZ());
packet.getBlockPositionModifier().write(0, blockPosition);
packet.getIntegers().write(1, 9); //read that 9 is to update sign (no way to check if it is true or not)

WrappedChatComponent[] chatComponents = new WrappedChatComponent[4];
for (int i = 0; i < 4; i++) {
    chatComponents[i] = WrappedChatComponent.fromText(entry.getKey()[i]);
}
packet.getChatComponentArrays().write(0, chatComponents);

for (var living : location.toBukkit(world).getNearbyLivingEntities(60)) {
    if (living instanceof Player player)
        pm.sendServerPacket(player, packet);
}
ivory sleet
#

yea, think that is the agreed upon way of doing it, gradle uses a graph and so does spigot/paper iirc

river oracle
ivory sleet
#

good luck :}

dapper flower
#

cuz writing 9 i am not sure if it is correct

river oracle
#

I always forget about them

sterile breach
#

is there a best libs to make http requests from a spigot plugin?

river oracle
#

I think javas built in is pretty good

#

Otherwise OKHttp

sterile breach
#

java have a default http lib?

wooden zodiac
#

public static final PotionEffectType HEAL = new PotionEffectTypeWrapper(6);
which effect this resembles?

river oracle
#

Yes you can make http requests without a library

sterile breach
#

ah good