#help-development

1 messages · Page 736 of 1

upper hazel
#

ooooh

#

dem

#

i was create 2 plugins in 1 pacage

#

but i was can do this...

#

what the bukkit derictory? i mean it doesn't look like the icons below

quaint mantle
#

I have not tested code yet I’m just implementing a system’s packet listeners for preventing block breaks and stuff in regions and I don’t want to use the bukkit api

ripe moat
#

didn't work

#

the version under /ver?

young knoll
#

Idk why you don’t want to use the api but okay

quaint mantle
young knoll
#

That’s what event priorities are mainly for

quaint mantle
#

I’d like to prep for those cases if they exist

young knoll
#

Well then they are probably protection plugins too

#

Or they could just be dumb and using the wrong priority

#

Anyway idk if cancelling events will inform the client, probably not for most cases

undone pebble
ripe moat
#

yes sure

undone pebble
#

Be sure to @ me too otherwise I might miss it

ripe moat
#

👍🏼

#

@undone pebble

undone pebble
# ripe moat <@470088969728557067>

See, now that's a pretty insightful error message. Check out this stack overflow thread: https://stackoverflow.com/questions/50505042/mysqlnontransientconnectionexception-client-does-not-support-authentication-pro

devout kite
#

i am working on a skin maker with Graphics2D, but i have some problems with drawing the hair. the hair is not geting drawed on to the skin that is chosen at Graphics2D g2d = imageskin.createGraphics(); it also does not work when i change it to this g2d.drawImage(imagehair, 64, 64, null); hope you can help me.

 switch (sex) { //sex
            case "Junge":
                 pathsex = "./char/vorlagen/boy";
                 break;
            case "Frau":
                 pathsex = "./char/vorlagen/girl";
                 break;
        }

        switch (bodycolor) { //skincolore
            case "white":
                imageskin = ImageIO.read(new File(pathsex,"skin_white.png"));
                break;
            case "black":
                imageskin = ImageIO.read(new File(pathsex,"skin_black.png"));
                break;
        }
        Graphics2D g2d = imageskin.createGraphics();

        switch (hairart) { //hairtype
            case  "long":
                pathhair = "./char/vorlagen/hair/long";
                break;
            case "short":
                pathhair = "./char/vorlagen/hair/short";
                break;
            case "dreadlocks":
                pathhair = "./char/vorlagen/dreadlocks";
        }

        switch (haircolor) {//Haarfarbe
            case "blau":
                imagehair = ImageIO.read(new File(pathhair,"hair_blue.png"));
                break;
            case "braun":
                imagehair = ImageIO.read(new File(pathhair,"hair_braun.png"));
                break;
            case "schwarz":
                imagehair = ImageIO.read(new File(pathhair,"hair_black.png"));
                break;
            case "red":
                imagehair = ImageIO.read(new File(pathhair,"hair_red.png"));
                break;
            case "violet":
                imagehair = ImageIO.read(new File(pathhair,"hair_violet.png"));
                break;
            case "green":
                imagehair = ImageIO.read(new File(pathhair,"hair_green.png"));
                break;
        }
        g2d.drawImage(imagehair, 0, 0, null);```
#

no error in the console

halcyon hemlock
young knoll
#

It’s not official

#

Nor is it a guide on NMS

halcyon hemlock
#

It's for mc protocol

#

Nms is packets basically and it has data on it

young knoll
#

NMS is a lot more than packets

trim lake
#

anyone some idea? I need to change block hardness or just breaking time for block. Best way would be probably get custom block hardness every time when player will start destroying and than calculate the breaking process. Maybe there is some better way to do that? I just used minecraft wiki to calculate that but seems to be wrong or I just made mistakes somewhere. Idk Im geting kinda weird output. I just assume canHarvest means if its a crop but that does not make sense... if its like that, because the efficiency enchant would never be applied. Probably it means something else. Code: https://paste.md-5.net/tasizofizo.java and my output:

devout kite
river oracle
#

you can probably just fuck with the BlockDamageEvent iirc its called

#

and send the damage packet to the player

#

^ is build into spigot so no need for nms

trim lake
#

If I edit block breking process with NMS I think I can, but I would like to keep the tool mechanics.

river oracle
#

could be wrong but iirc hte only way is spoofing it

#

then you need to readd efficency and haste manually by runnign the calculations yourself

trim lake
#

I just need to get correct calculation idk how thats why Im here xD

#

googling allready for some time

#

Or maybe I will just need to set breaking duration on every block for every tool... that sounds like pain xD

young knoll
#

If you modify the block hardness server side it won’t change for the client

thin iris
#

how do i make a triangle

worldly ingot
#

You should probably start with three sides

#

How so? How do you want to make a triangle? What type of triangle?

river oracle
#

make sure all angles add up to 180 degrees

#

or pi

thin iris
#

a location, 2 days ago, bc 🐺

#

jk i’m trying to cut his face and put it onbthe ground

#

only rhing i can think of is 5 triangles

#

like a venus fly trap for players

#

json

trim lake
umbral marsh
#

How do I see if a falling block and player collide?

trim lake
short pilot
#

ah! Of course!

#

not really a problem yet but just an idea

#

i want to be able to sync faction like groups to a database back and forth and when the server starts it'll load those factions back into the manager

#

and when events happen like new creations or a name change, the database will update to reflect that

mighty mason
#

Hi, sorry to repeat myself

#

But is there any a good way to cancel a Cow milking?

#

Im currently removing the milk from the player after the PlayerInteractEntity event

#

But i dont think thats the best way

#

This is my current code:

if(this.CurrentMilkingCoolDown == 0){
                player.sendMessage("You just milked " + this.Name + ". Cooldown now is: " + this.MilkingCooldown);
                this.CurrentMilkingCoolDown = this.MilkingCooldown;
                player.getInventory().remove(new ItemStack(Material.MILK_BUCKET, 1));
                ItemStack item = this.giveMilkBasedOnQuality();
                player.getInventory().addItem(item);
                this.taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(ZooFee.getInstance(),
                        this::LowerCooldown,
                        0,
                        20);
            }
#

Actually, im going to post the whole code for the handler that i got:

    public void onPlayerMilkEvent(Player player, Entity MilkedEntity){
        if(this.entity.equals(MilkedEntity)){
            if(this.Sex.equals(ZooSex.Male)){
                player.sendMessage(ChatUtils.setColorName("&lYou can't milk a &r&9&lMale"));
                player.getInventory().remove(new ItemStack(Material.MILK_BUCKET, 1));
                return;
            }
            if(this.Age.equals(ZooAges.Baby)){
                player.sendMessage(ChatUtils.setColorName("&lYou can't milk a &r&d&lBaby"));
                player.getInventory().remove(new ItemStack(Material.MILK_BUCKET, 1));
                return;
            }
            if(this.CurrentMilkingCoolDown > 0){
                player.getInventory().remove(new ItemStack(Material.MILK_BUCKET, 1));
                player.getInventory().addItem(new ItemStack(Material.BUCKET, 1));
                player.sendMessage("The Cow: " + this.Name + " has been milked already. Cooldown now is: " + this.CurrentMilkingCoolDown);

            }else if(this.CurrentMilkingCoolDown == 0){
                player.sendMessage("You just milked " + this.Name + ". Cooldown now is: " + this.MilkingCooldown);
                this.CurrentMilkingCoolDown = this.MilkingCooldown;
                player.getInventory().remove(new ItemStack(Material.MILK_BUCKET, 1));
                ItemStack item = this.giveMilkBasedOnQuality();
                player.getInventory().addItem(item);
                this.taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(ZooFee.getInstance(),
                        this::LowerCooldown,
                        0,
                        20);
            }

        }
    }
wet breach
mighty mason
#

Thats the one im trying rn

wet breach
#

Could try it doubt it will work. Otherwise the way you are doing it is the only way

#

Without resorting to nms of course

mighty mason
#

It actually works!

#
@EventHandler
    public void onPlayerBucketFill(PlayerBucketFillEvent e)
    {
        System.out.println("Converted");
        if (e.getItemStack().getType() == Material.MILK_BUCKET)
        {
            e.setItemStack(new ItemStack(Material.BUCKET));
            e.getPlayer().updateInventory();
        }
    }
wraith dragon
#

hey so I got it working but I kind of have to give the player the map item itself for it to render properly, do you know any fix?

#

this is myt code rn

mighty mason
#

Ey, Quick Question. I got a Mob that has custom holos that i made. Using the DPC (Data Persistent Container) can i save this mob and the holos and reload it after?

It has thing like right click action, amongst other things

wet breach
#

Glad it worked for you

umbral marsh
#

Can someone help me? How do I detect when a player gets touched by a falling block?

worldly ingot
#

EntityDamageByEntityEvent

#

There's a cause for FALLING_BLOCK

mighty mason
#

Question; To create custom items that will be use to interact with entitys (Ex: Cow food) is it better to use inheritance from ItemStack or just use the customize the MetaData

pseudo hazel
#

use metadata/pdc

upper hazel
#

how create this?

#

i dont think map api help here

#

text in block lol

lost matrix
upper hazel
#

I don’t see volume, the text is literally in blocks

lost matrix
short raptor
#

Neither of these work to ban player.. first one throws "nosuchmethod" and second one doesn't even compile as you can see

#

victim is a Player

#

red squigglies say "cannot resolve method addban.........."

slender elbow
#

cast to ProfileBanLisy

#

then addBan

short raptor
#

At runtime

#

Its fine in IDE

#

intellisense shows it

slender elbow
#

server version?

short raptor
#

1.20.1

slender elbow
#

disregarding the fact you are running paper and this is spigot, you are running a build prior to that method being added

#

tldr update your server

short raptor
#

Even tho its the same api version?

#

damn

#

I will try update

wraith dragon
quaint mantle
umbral marsh
#

Can someone PLEASE HELPPP

quaint mantle
#

dont ask to ask

#

just ask

umbral marsh
#

How do I check when a falling block hits a player?

#

I am dum

#

And new

#

Hello?

#

lmfao peoples just given up

lilac dagger
#

Probably entitydamagebyentity

#

@umbral marsh

#

I'm pretty sure falln blocks deal damage

umbral marsh
#

Not all the time

shadow night
#

what's the greatest vertical velocity a player can possibly have in vanilla?

glad prawn
umbral marsh
#

???

placid moss
shadow night
#

wait

#

what's the greatest vertical velocity a player can possibly reach in vanilla?

glossy venture
#

bro WHAT

#

ithats the thing tho its not

#

v is like legit some special value or smth

#

jvm bug?

#

this is the java.lang.StringConcatHelper#stringOf code

#

the null check just doesnt work lol

#

i can also not replicate this on my machine with the same data

lilac dagger
#

If value is equal with null returns true

#

Maybe write a print above the return to see whsy your value is

placid moss
#

you should make the code a bit longer, because some things may not work as expected when you shorten everything into one line

#

just seperate the if statements

glossy venture
#

i didnt write this

#

this is from openjdk

#

but i can easily see that if the value was actually null as defined by the jvm it would work as intended

#

my value is some kind of special null it seems like because checking == null doesnt do shit

glossy venture
#

trying that throws the error i showed above

tall dragon
#

a special null huh

glossy venture
#

since the jdk string concatenation code can not handle the value

#

but the jvm still thinks its null when you attempt to deref it

glossy venture
#

i made a special null value

#

i fixed it though, im pretty sure i made it with Unsafe

#

it was trying to get the boolean field from the Boolean class which somehow resulted in a corrupted object value or smth

#

but now that i made a special case for it it works

tall dragon
#

i wonder why its deemed unsafe

slender elbow
#

it's easier and safer to just --add-opens and use reflection regularly lmao

glossy venture
#

yes but slow as fuck

#

unsafe is faster than bytecode

#

like i generated bytecode for the serializers which used GETFIELD and shit and it was slower than using Unsafe

#

and im not gonna require ppl to add flags ill just use Unsafe and method handles to remove encapsulation

#

java security is bullshit when its so easy to break it why even have it

#

its just annoying

lilac dagger
#

Well, there's a reason why security manager is deprecated

glossy venture
#

true

#

its been deprecated since like java 14 or smth tho

#

also will something replace it then or what

lilac dagger
#

No

#

It expects you to give proper permission from the os

slender elbow
#

reflection is slow if you don't optimise for it

glossy venture
#

wdym if you dont optimise for it

glossy venture
slender elbow
#

not once it has asserted it's visible

slender elbow
glossy venture
#

but why tf is it still so slow

lilac dagger
#

Imagine writing final static fields just for jvm to just inline it anyway

glossy venture
slender elbow
#

have you properly benchmarked it.., like, jmh

slender elbow
#

which is inlined

glossy venture
#

oh sick

glossy venture
#

its some goofy benchmark system tho so the results might be off

#

slightly

#

also idk if i could do any optimizations in the bytecode

#

i dont think so

slender elbow
#

we're talking nanoseconds here, the point of bytecode is to be simple, not optimiseable, that is for the runtime to do

glossy venture
#

nvm now the asm version is faster

#

couldve been java version but i think my benchmark system mightve just done some weird shit

quiet ice
#

Unsafe is generally faster due to intrinsification

glossy venture
#

at least its faster than ObjectInputStream

quiet ice
#

ObjectInputStream isn't great...
That is like comparing Windows XP to Win 98

glossy venture
#

i know but i was using that before

#

so im happy it was at least slightly worth it

quiet ice
#

Do you at least have strong enough protection against malicious data?

glossy venture
#

idk

quiet ice
#

Half of Javas exploits come from ObjectInputStream

glossy venture
#

its for internal communication tho

#

closed network

#

so im not too worried about that

glossy venture
#

fuck i forgot to handle booleans again

quiet ice
fallen lily
quiet ice
glossy venture
#

lmao

glossy venture
#

or will the jvm do that

slender elbow
#

bro it literally does not matter

glossy venture
#

i need the nanoseconds

slender elbow
#

don't run in interpreter mode then

glossy venture
#

it doesnt

slender elbow
#

then don't worry

#

profile first, act after results

#

proper profiling is key

scenic onyx
#

?paste

undone axleBOT
scenic onyx
echo basalt
#

pass null

scenic onyx
#

ok

echo basalt
#

actually just pass a world context

#

param

#

what you're writing is weirdly structured

scenic onyx
#

how i can do entity.getEyeLocation().getDirection();???

young knoll
#

What

scenic onyx
young knoll
#

The position vector or the look vector?

inland dust
#

how can i do more commands in a single class file?

scenic onyx
glad prawn
#

getEyeLocation#toVector ?

pseudo hazel
#

wtf is the Distance class

young knoll
#

That is the look vector

#

Entity.getEyeLocation.getDirection

scenic onyx
glad prawn
#

huh

scenic onyx
young knoll
#

Might only be on LivingEntity

scenic onyx
pseudo hazel
#

right

#

looks kinda like a raycast

#

but anyways, I checked and it is on livingentity

inland dust
#

how can i async blocks?

young knoll
#

What

sullen canyon
#

what didn't you understand

young knoll
#

-_-

#

Do you want to edit them async, read them async, turn them into a sink?

remote swallow
#

an asink

inland dust
worldly ingot
#

Okay how do we explain this? lol

#

You cannot just "async a block". That means nothing

lilac dagger
young knoll
#

I want logs to have their own thread

lilac dagger
#

That's doable

young knoll
#

Lol what would that even do

#

Logs don't tick or anything

lilac dagger
#

But isnt the file already written async

worldly ingot
#

Asynchronousy is taking a task and performing that on a thread separate from the server's main thread. The wood block doesn't do anything. There is no task to accomplish. So what do you want to do with this wood block? Do you want to change it to some other block? If so, asynchronous world writes are not supported and can leave the world in an irrepairable state

inland dust
worldly ingot
#

Someone was probably talking out of their ass

#

It depends on what you're doing

inland dust
# worldly ingot It depends on what you're doing

that is the code i done with runTaskLater

    public void onBlockPlace(BlockPlaceEvent event) {
        Player p = event.getPlayer();
        Block under = p.getLocation().clone().subtract(0.0D, 1.0D, 0.0D).getBlock();
        if (event.getBlock().getType() == Material.OBSIDIAN) {
            p.sendMessage("hai piazzato un blocco di obs!");

            new BukkitRunnable() {
                @Override
                public void run() {
                    event.getBlock().setType(Material.AIR);
                    p.sendMessage("Il blocco e' stato rimpiazzato in aria!");
                }
            }.runTaskLater(plugin, 200);
            if (under.getType() == Material.OBSIDIAN) {
                p.sendTitle("Sei sopra un blocco di obs", "OSSIDIANA!");
            }
        }
    }```
#

it's tthe change of a block after an amount of seconds

worldly ingot
#

Yeah, don't run that asynchronously. You're changing a block. It's not supported

lilac dagger
#

Just learn about time complexity and memory complexity and in 99 % of cases your problems resolve themselves

worldly ingot
#

You're changing a block type which will take you nanoseconds to do. Probably less than that 😛 You don't need it async

lilac dagger
#

From within the main thread

young knoll
#

You may want to make a single task that handles replacing blocks later instead of making a task for each

#

But I doubt it matters much

inland dust
lilac dagger
#

Yeah, you can always spread the block placing over many ticks

#

It'll spread the load and you won't feel it

worldly ingot
#

You have to keep in mind that a significant majority of Minecraft is run single threaded

young knoll
#

You won't feel it anyway

#

It's 20 blocks being changed at once

worldly ingot
#

Every single entity, block entity, particle, sound, block logic, containers, literally anything and everything in Minecraft, is being processed synchronously

#

Your single block change will not affect it lol

lilac dagger
#

That's nothing then

young knoll
#

Spigot async everything when?

inland dust
lilac dagger
echo basalt
#

particles not really

worldly ingot
#

anything and everything [...] is being processed synchronously
massive generalization

#

For all intents and purposes, this is true though

echo basalt
#

Well

inland dust
#

can i ask another question?

worldly ingot
#

FOR ALL INTENTS AND PURPOSES

#

THIS IS TRUE

#

lol

echo basalt
#

I guess the packet thread is only a single thread per player

#

a lie it is not

lilac dagger
#

Probably less

worldly ingot
#

We are not getting into packet level details here or the specificities of asynchronization of the server when he's just trying to set a block 😛

lilac dagger
#

I heard something about netty thread pool

#

It must spread the load across those threads

inland dust
#

how can i put 2 or more command in the same .java file but let they get executed from diffrent command like i want to lock the command /plugin / pl how can i do it within a single fie?

#

file*

echo basalt
#

alias?

inland dust
young knoll
echo basalt
#

does it really need to be on a single file

#

What's the benefit other than just having a file with 5000 lines

inland dust
#

thx a lot ❤️

#

@worldly ingot the guy told me the think of RunTaskLater said :"Distributed workloads or an asynchronous task with a map of blocks and times"

worldly ingot
#

Yeah it doesn't need to be async. They're high

#

You can create a single task to replace a list of blocks at specific timestamps, which Coll also suggested (and is probably going to save you from creating tasks over and over again), but it definitely doesn't have to be async

#

And in fact probably shouldn't because you're modifying the state of the world

remote swallow
#

distributed workloads would only be needed for an insane amount of block changes

young knoll
#

No modifying the state of the world async

#

Meanwhile FAWE

echo basalt
#

?wd

#

?workdistro

worldly ingot
#

FAWE really doesn't need to exist

inland dust
#

then it's a good think if i change from RunTaskLater to workloads right?

lilac dagger
#

Usually you shouldn't be doing large block manipulation on a production server

worldly ingot
#

You're A-okay using the task you're using now, Phonk. lol

young knoll
inland dust
worldly ingot
#

In the clear. Good to go

#

Nothing needed to change

lilac dagger
#

I remember just placing large buildings and just waiting, even if my client lost connection

remote swallow
undone axleBOT
#

No, Choco is not real. I was not programmed to say this by Sam.

lilac dagger
#

I would just rejoin later

quiet ice
hushed spindle
#

putting an enchantment level of 0 results in level I right or was that just a potion effect amplifier thing

young knoll
#

just potion effects

hushed spindle
#

gotcha thanks

shadow night
#

does block break event trigger on any block break or only the player?

echo basalt
#

player

shadow night
#

hm

young knoll
#

I'm still thinkin about makin that block remove event

shadow night
#

ig then blockbreak and explosion should work

zenith gate
#

So, I am working on character skills rn, and I don't know how to upgrade the skills based off their level. My current thought process was to use if statements check for level and do the stronger variation of the ability.

if (currentLevel >= 11) {
    .....
} else if (currentLevel >=22 ) {
    .....
}
......

But doing this makes everything else unreachable, and im just drawing a blank, don't know how to structure this.

echo basalt
#

Algorithms!

#

Let's say you have a "strength" skill that has levels from 1 - 100

#

And every 5 levels you want to give health to a player

#

You can just do something like
int healthToAdd = level / 5

young knoll
#

We love math

echo basalt
#

yep

zenith gate
#

Yeah, I understand that, the thing is, these skills can be used over and over and whenever, so the player could be a different level. there are certain sections in the levels where everyone has access to certain things. e.g beserk skill gives buffs, but it cost less mana and last longer the higher level you are. I don't know how to structure when to give what variation of the buff.

if (currentLevel >= 11) {
    .....
} else if (currentLevel >=22 ) {
    .....
}
......

This here only the first if statement runs nothing else will, because the first one will always be true. i dont know how to make this idea work in a sense.

glad prawn
#

i dont

echo basalt
#

So skill tiers?

#

More math!

#

Or if you want to be quirky you can use uhh

zenith gate
#

Yeah. i just dont know how to think of it.

echo basalt
#

data classes for this kind of stuff

zenith gate
#

lets stick to the norm lol

echo basalt
#
public abstract class ActiveSkillData {

  private final int skillLevelRequirement;
  private final int manaCost;
  
  protected ActiveSkillData(int levelRequirement, int manaCost) {
    this.skillLevelRequirement = levelRequirement;
    this.manaCost = ...;
  }

  public int getLevelRequirement() {
    return skillLevelRequirement;
  }

  public abstract SkillType getSkillType();

}
#
public enum SkillType {

  STRENGTH,
  ...
  ;
}
#
public class BerserkerActiveSkillData extends ActiveSkillData {

  private final float damageBoost;

  public BerserkerActiveSkillData(ConfigurationSection section) {
    super(section.getInt("level-requirement"), section.getInt("mana-cost"));

    this.damageBoost = (float) section.getDouble("damage-boost");
  }

  public SkillType getSkillType() {
    return SkillType.STRENGTH;
  }

  public float getDamageBoost() {
    return damageBoost;
  }
}
#

something like that

#

rest is up to you

#

that's just one way to do it

zenith gate
#

How would this fix the different level for skills thing? if someone is level 11 they can have the first varation but once they get to level 21 they get an upgraded, but it checks for the level everytime, and i want them to have the first varaition until they reach 21. then the 2nd unclocks and they can continue using the 2nd varation until level 27, where the 3rd unlocks. I don't really understand what that does.

echo basalt
#

you kinda need to loop on the opposite way

#

ActiveSkillData is a "variation"

#

You can do something like

#

loop through all the variations, from the highest level to the lowest

#

And if the player's level belongs to that variation, stick to it

zenith gate
#

Okay, that makes a little more sense.

scenic onyx
eternal night
upper hazel
#

who knows why annotations are needed? I mean, there is inheritance of interfaces, etc.

#

reflection is very resource intensive

#

only disadvantages

hazy parrot
#

you don't have to use reflection during actual runtime

#

its usually during aplication startup

#

as startup time usually doesn't matter

upper hazel
#

hm

hazy parrot
#

also reflection is pretty much faster in newer java versions

upper hazel
#

and for this reason people decided to give more importance to convenience than speed?

fossil flax
#

i want to replace a default minecraft command with a custom one that i created in my plugin, how can i do?

hasty prawn
#

Yeah I mean as with any other thing, if you're not just calling it tons of times for no reason, you probably wouldn't be able to notice any performance hit

upper hazel
#

hm

#

Well, if you look at it from this side, will registering commands be convenient and at the same time not resource-intensive in the process if you use annotations?

#

The lengths people are willing to go to avoid comparing arguments

warm mica
#

However, I believe that the overhead you get from reflection is negligible and possibly not something that you'd actually notice in practice

wicked quail
#

Does anyone know a way to automatically get the getMappingsVersion() string during the plugin compilation and, for example, save it to a maven property or put it in a file (like what com.google.code.maven-replacer-plugin does)? This would be very helpful working with NMS since the checking of getMappingsVersion() would be automatable.

#

Also, doesn anyone know what that string means? Or if it even has a meaning or it's just random

warm mica
#

I'd guess that this is a version number that is given by Mojang

inner mulch
#

what do i need to type in my pom.xml that it save my plugins into the file i want them to be?

worldly ingot
quaint mantle
full holly
#

Why am I getting this error: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R3.block.data.CraftBlockData cannot be cast to class org.bukkit.material.PoweredRail (org.bukkit.craftbukkit.v1_19_R3.block.data.CraftBlockData and org.bukkit.material.PoweredRail are in unnamed module of loader java.net.URLClassLoader @759ebb3d) when casting this: PoweredRail rails = (PoweredRail) clone.getBlock().getState().getBlockData();

spiral light
#

material and data is not the same

#

try Block#getBlockData()

full holly
#

same error

spiral light
#

can you provide code ?

full holly
# spiral light can you provide code ?

Location clone = ...; clone.getBlock().setType(Material.POWERED_RAIL); PoweredRail rails = (PoweredRail) clone.getBlock().getBlockData(); location.getBlock().setType(Material.POWERED_RAIL); PoweredRail secondRail = (PoweredRail) clone.getBlock().getBlockData(); secondRail.setDirection(rails.getDirection(), rails.isOnSlope()); location.getBlock().setBlockData((BlockData) secondRail);

spiral light
#

what version do you use ?

remote swallow
#

PoweredRail is deprecated

worldly ingot
#

You're deprecated

chrome beacon
#

Did you forget the new keyword: new Color(int, int, int)

remote swallow
spiral light
#

Rail is from org.bukkit.block.data

#

but i wonder how i would check if its a powered rail

chrome beacon
#

?jd

undone axleBOT
chrome beacon
#

oh it's down for some reason

#

?jd-bcc

wicked quail
chrome beacon
#

You probably imported the bukkit ChatColor instead of the Bungeecord one

spiral light
#

nah thats not what i wanted ... i was searching for #IsPowered()
but its packed into Powerable ^^

full holly
#

The JavaDocs page says Rails extends MaterialData, so PoweredRail rails = (PoweredRail) clone.getBlock().getState().getData();. Or am I wrong?

spiral light
#

wrong

#

there is no PoweredRail anymore

#

if you want to check if your Rail is powered or not (and its a Material.POWERED_RAIL as well) you need to check the
Powerable power = Block#getBlockData()

full holly
#

and how can I check the direction and apply it to another rail too?

spiral light
#

Rail rail = Block#getBlockData()

full holly
#

thanks!

spiral light
#

Rail has getShape() and also getShapes (valid shapes that can apply) and a enum for all Shapes

full holly
#

java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R3.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.Rail (org.bukkit.craftbukkit.v1_19_R3.block.data.CraftBlockData and org.bukkit.block.data.Rail are in unnamed module of loader java.net.URLClassLoader @759ebb3d)

#

It's not possible to cast a powered rail to a rail

#

why?

spiral light
#

you could try RedstoneRail as well

echo basalt
#

powered rails can't turn

#

redstone rails can't either

spiral light
#

buttttt the BlockData says it can O.o

echo basalt
#

p sure

#

it's just regular rails that can

spiral light
#

they still have a shape O.o

echo basalt
#

well

#

they're directional

#

huh

spiral light
#

they just have not all shapes available ^^ but still have a shape

glossy venture
#

holy shit finally

worldly ingot
#

That's a lot of nested method calls

glossy venture
#

yeah its ugly

#

i should make it chainable

worldly ingot
#

Or just like a proper readable algorithm lol

glossy venture
#

this is readable ngl

#

just looks ugly

#

this better

grim ice
#

nice

lilac dagger
#

So you actually did it, nice

chilly hearth
#

um

#

alr

#
public class HealthEvent implements Listener {

    @EventHandler
    public void OnBossDamage(EntityDamageEvent e){

           Entity boss = e.getEntity();
           if(boss instanceof WitherSkeleton witherSkeleton){
               if(witherSkeleton.getScoreboardTags().contains("a")){
                   witherSkeleton.setCustomName(ChatColor.BLUE + "" + ChatColor.BOLD + "Ancient Wither Skeleton" + ChatColor.WHITE + "| " + ChatColor.RED +"❤ " + Math.round(witherSkeleton.getHealth()));
               }

           }else if(boss instanceof Zombie zombie){


               if(zombie.getScoreboardTags().contains("b")){

                   zombie.setCustomName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Reaper Zombie" + ChatColor.WHITE + "| " + ChatColor.RED +"❤ " + Math.round(zombie.getHealth()));


               }

           } else if (boss instanceof Ravager ravager) {

               if(ravager.getScoreboardTags().contains("c")){

                   ravager.setCustomName(ChatColor.RED+ "" + ChatColor.BOLD + "Chaos Ravager" + ChatColor.WHITE + "| " + ChatColor.RED +"❤ " + Math.round(ravager.getHealth()));


               }

           }else if(boss instanceof Spider spider){

               if(spider.getScoreboardTags().contains("d")){
                   spider.setCustomName(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "Exotic Spider" + ChatColor.WHITE + "| " + ChatColor.RED +"❤ " + Math.round(spider.getHealth()));
               }

           }else if(boss instanceof Husk husk){

               if(husk.getScoreboardTags().contains("e")){

                   husk.setCustomName(ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "Feral Husk" + ChatColor.WHITE + "| " + ChatColor.RED +"❤ " + Math.round(husk.getHealth()));
}
}
``` its working till Ravager
#

idk why

#

the husk and spider does have the tag

chrome beacon
#

Why are you using scoreboard tags instead of pdc

chilly hearth
#

actually

#

dont ask me why 😦

ocean hollow
chilly hearth
#

nah

#

actually

#

i was trying to do smth with screoboard tags

#

and i had used them all diff classes

#

now its gona take ages to replace with pdc yk

#

but it should work with tags its working untilll ravager

valid burrow
#

If i have a data that i want to save in a db but that data updates like every second for each player is it smart to just temp save it in a var and update the data once the player disconects? or update it like very 10 seconds?

quaint mantle
#

there seems to be a bug with blockdata Leaves

remote swallow
quaint mantle
#

Oak and Birch Leaves in particular thinks that it is waterlogged

valid burrow
remote swallow
quaint mantle
#

mangrove works as usual though

quaint mantle
#

Guys! Why can't I create an inventory named like this: §1§9§2§3§7Menu

valid burrow
remote swallow
valid burrow
#

alright thx ebic

remote swallow
quaint mantle
remote swallow
#

add §x to the start

river oracle
#

I was about to reccomend components but then I remembered you need NMS for that

remote swallow
#

pr it

river oracle
remote swallow
#

do it better

quaint mantle
# remote swallow add §x to the start

You don't understand what I'm trying to do. I want to create an invisible identifier. It can be created for itemstacks, but I don't know, why I can't do the same for inventories.

river oracle
river oracle
#

identifying inventories by names is beyond dumb

remote swallow
#

you cant add an invis hex component without the right format

quaint mantle
remote swallow
#

instance of the view inventory

river oracle
#

infact recently setTitle was added xD really shows you, you really shouldn't be identifying inventories by the title

river oracle
remote swallow
#

forgot

river oracle
#

every inventory event provides you with an Inventory oyu can use

river oracle
remote swallow
#

heres the spigot forum

river oracle
#

^ this is how you really should be doing it. Obviously I wouldn't expect you to copy this 1 for 1, but its a good guide on what idea you should be using

quaint mantle
remote swallow
#

instance of the inv

river oracle
#

remember Inventories override hashCode so Hashmaps will be useful here

remote swallow
river oracle
remote swallow
#

suketto on deez nutz

river oracle
#

helper on deez nuts?

remote swallow
#

shut up

#

its not funny translated

river oracle
#
    static SlotHolder<SukettoContainer> of(@NotNull final SukettoContainer container) {
        return new ContainerSlotHolder(container);
    }
``` :3 I love this method doens't it look great
#

I still haven't updated my lib to 1.20.2

remote swallow
#

too compilcated

river oracle
#

I should really script this

remote swallow
#

6/10

#

i wanna write an nms wrapper

#

that can function of mojmaps or obsfucated and uses reflections/method handles

river oracle
# remote swallow 6/10

imho my container system is ever so slightly better than spigots though its still a pain I might try to attack it with a diff angle in the nera future

remote swallow
#

eg NMSWrapper.getClass("net.minecraft.server.world.entity.player.EntityPlayer").getVariable("connection")

#

idk if that package is write

river oracle
#

e.g. right now I'm opening the menu before changing anything when really that should be done after

remote swallow
river oracle
restive jackal
#

are PDCs accessible through the data command? curious if I could set custom PDC data without needing a plugin

river oracle
restive jackal
#

I'm a fan of pain /s

remote swallow
#

idk what the legality of that is though

quaint mantle
river oracle
#

if you do it at runtime you'd need to load the mappings into memory or you're slowing your nms calls down by having to run them asynchronously (again this doesn't mean on another thread)

remote swallow
#

would mojank or spigot appreciate me putting mappings on central

river oracle
#

💀 nah bruh

#

mojang lawyers might, they might be boared

#

give them something interesting to do

remote swallow
#

"hey boss this guy put all the mappings on maven central, what do we do"

river oracle
#

"take it down"

river oracle
remote swallow
#

no

#

fix it

river oracle
#

I did :P

remote swallow
#

ill obsfucate the obsufcated mappings

#

get shit ion

river oracle
#

enchanting tables are so wack

remote swallow
#

its probably for the xp

river oracle
#

like the menu won't work unless the block is in the world but like you could totally just ignore that and create the menu anyways and it works fine

remote swallow
#

wait

#

no it doesnt drop xp

#

spawn a table above their head and give them that

river oracle
# remote swallow wait

there is a check to see if its placed in the world, but you can legit just ignore it and force create the menu anyways

#
                        new EnchantmentMenu(i, playerinventory, ContainerLevelAccess.create(player.level(), pos))
                        , ServerAdapter.toMinecraftChat(super.getTitle())```
remote swallow
#

expand the height map at 0, 0 and spawn one there

river oracle
upper hazel
#

@river oracle godgo dead bro

river oracle
#

?

remote swallow
#

what in the fuck does that mean

river oracle
remote swallow
#

nerd

river oracle
#

that doesn't make any sense, it should just be implemented as needed not used accross every single block

#

Minecraft Stone Menu Confirmed 😱. I just right clicked stone! You won't believe what happens next

river oracle
#

I'm really curious

#

don't leave me hanging

remote swallow
#

i think godgo is gotta

#

gotta dead bro

#

his bro is dead?

young knoll
#

Maybe they meant godot

thin iris
#

is there any public image to particle converters

young knoll
#

godot is dead

river oracle
young knoll
#

Hey it might be dead

#

Maybe they killed it just now

river oracle
restive jackal
#

I godgo geddaway
I annaflah awayy
yea
yea
yea

young knoll
#

I mean image to particle is pretty easy

young knoll
#

Could make an executable jar for it

#

rather than a server

river oracle
thin iris
#

i just need to cut the demogorgons head into pieces to make a trap on the floor

zealous osprey
river oracle
river oracle
thin iris
#

alr

young knoll
#

Doesn't sound too hard

#

Just convert each pixel to a redstone dust color

upper hazel
#

I could not resist)

terse pumice
#

How would I go about checking if an item frame itemstack is an invisible item frame? My current thought would just be to get nbt and check if {EntityTag:{Invisible:1b}} exists

young knoll
#

Yeah it appears we don't have a meta type for that

remote swallow
#

@worldly ingot add it

upper hazel
#

I encountered a problem when I tried to create an annotation for registering a command. How get commandSize from args (not maxArgsSize)

river oracle
#

choco is a busy man

remote swallow
#

no

river oracle
#

lazy

remote swallow
#

yup

terse pumice
#

I haven't really messed with nbt too much previously, what would be the best way to check that?

worldly ingot
terse pumice
#

ooh ok

young knoll
#

Oh boy weird name time

worldly ingot
#

Trying to remember and find it

river oracle
#

?jd-s

undone axleBOT
worldly ingot
#

I think it is, yeah

young knoll
#

It's not a block state

river oracle
#

oh its an entity 💀 worse

worldly ingot
#

It's covered by CraftMetaEntityTag but I don't know what the interface is for it

young knoll
#

inb4 there is none

left pine
#

Hello, I wanted to know if there is an event to save if the player right clicks with an item in the main hand?

worldly ingot
#

There might not be, actually

young knoll
#

kek

#

I don't see anything that stands out in the javadocs

young knoll
worldly ingot
#

Honestly Coll, perfect candidate for your virtual entities

#

Implementation is already there and done

terse pumice
#

I couldn't spot anything either

#

What's a virtual entity?

river oracle
#

entities the player can see but they dont actually exist on the server

terse pumice
#

ohh

#

makes sense

river oracle
#

so the player sends the packet to the player saying its there but it really isn't

#

iirc ^

young knoll
#

No you can't see them

#

They exist on the server, but not as part of a world

river oracle
#

ahhhh okay

#

wrong way around :P

terse pumice
#

interesttingg

young knoll
#

Hmm so it's the exact same as spawn eggs

#

But without the entity type

#

Question is should it be split up into multiple metas for differnt entity types

river oracle
terse pumice
#

there wouldn't be too many right? unless i am misunderstanding

#

you'd have like item frame and leash(?)

young knoll
#

Item frame and armor stand have this tag

#

Haven't seen anything else yet

terse pumice
#

that makes sense

young knoll
#

Lead does not have it, neither does boat

terse pumice
#

thought maybe leash knot might

#

makes sense

#

invisible boat would be pretty cool lol

young knoll
#

I'm talking about items that make use of this tag

river oracle
young knoll
#

Well armor stand has differnt methods than itemframe

#

Sure the dev could cast but ehhh

river oracle
young knoll
#

Probably

river oracle
#

e.g. ItemEntityMeta or whatever
then ItemFrameEntityMeta and ArmorStandEntityMeta etc etc or whatever it'd be called

young knoll
#

Probably

#

Technically spawn egg meta could extend it too

#

Spawn eggs are special though because you can use entity type with them

river oracle
#

I've always wanted to integrate a better inventory system into bucket but its so messy 😭 and virtual containers are well, awful

young knoll
#

Which means yes, you can have a creeper spawn egg spawn a chicken

umbral marsh
#

anyone know how to detect if a falling block hits an entity?

river oracle
young knoll
umbral marsh
#

How would I do that

young knoll
#

FallingBlock#setHurtEntities

umbral marsh
#

hmmm

young knoll
#

there's also setMaxDamage

umbral marsh
#

Let me try that

#

I only want it do damage to the player

young knoll
#

Yeah then set it to hurt entities, set the damage, and then listen for the damage event and cancel it if it's not a player

worldly ingot
#

I'd imagine boats and armour stands are included as well but were just never updated

young knoll
#

boats don't have it

#

According to the wiki

river oracle
#

you;'re on the new wiki right :P

young knoll
#

mhm

river oracle
#

beast

young knoll
#

They also don't show the option on mcstacker

#

Hmm painting also don't show it on the wiki

#

Seems to be

glad prawn
umbral marsh
#

I’m compiling rn for the other thing tho

young knoll
#

cod, salmon, pufferfish, tropical fish and axolotl buckets (not tadpole for some reason), armor stands, and both item frames

#

Will require some testing I guess

#

So should there be subclasses for the specific entity types?

worldly ingot
#

Want to know the great part about tropical fish needing support? There are overlapping ItemMeta types again 🙃

#

I had to deal with that bullshit for the first time when adding ArmorMeta

young knoll
#

For some reason tropical fish has 2 tags

#

wtf mojang

opaque scarab
#

Is the a way to have pistons move unmovable blocks?

young knoll
#

Uhh

#

Technically yes

opaque scarab
#

I’m sure there is with the API, but I have no idea how

umbral marsh
#

Awww it doesn’t work

#

Can I send code?

young knoll
#

kek

opaque scarab
young knoll
#

ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify existing classes or to dynamically generate classes, directly in binary form.

opaque scarab
#

Oh lovely LOL. I’ll need to modify the class of a block?

quiet ice
#

Whomst dared to mention ASM?

terse pumice
#

Coll is what you're working on a pr for spigot or a separate lib?

quiet ice
#

You've summoned the geolykt

young knoll
opal juniper
#

what does it do

quiet ice
#

Oh apparently nothing of note. I sleep.

young knoll
#

Oof

#

My feels

opal juniper
#

night night geol

young knoll
#

Lets pistons push any block

umbral marsh
#

hey coll

                Location loc = player.getLocation();
                FallingBlock block = player.getWorld().spawnFallingBlock(loc, Material.GRASS, (byte) 0);
                block.setHurtEntities(true);
                block.setVelocity(player.getLocation().getDirection().multiply(2.0D));
            }```
opal juniper
#

illegal

quiet ice
#

Why would you even need ASM there?

young knoll
#

How else you gonna do it

quiet ice
#

Oh, you are retransforming classes. That is cursed.

young knoll
#

hehehe

opal juniper
#

doesn’t that break like a lot of stuff

scenic onyx
#

how i can get the block lokking of player?

young knoll
#

Might break other plugins that mess with those specific NMS classes

opal juniper
#

ray trace

remote swallow
#

player.getBlockExact

opal juniper
#

i thought that it would mess with that

young knoll
#

nop

#

Well, if they rely on something not being movable then yes

quiet ice
young knoll
#

It has a config for that

#

No idea

#

"Issue warnings when agents are loaded dynamically into a running JVM."

#

Probably not yet

quiet ice
#

Ah you are using bytebuddy, in that case it would still work as long as you keep it updated.

#

But smh, not using raw ASM.

young knoll
#

It is raw asm

#

Bytebuddy is only for injecting into class loader

quiet ice
#

Albeit that would be equally cursed

young knoll
#

The transformation itself is raw ASM

quiet ice
#

Yeah I know

young knoll
#

Well

#

Blah to you

quiet ice
#

I find it interesting that most people add a wrapper around the ClassVisitor/ClassNode schema. What is the point in that?

opaque scarab
#

There’s no other way to move a piston LOL?

umbral marsh
#
                Location loc = player.getLocation();
                FallingBlock block = player.getWorld().spawnFallingBlock(loc, Material.GRASS, (byte) 0);
                block.setHurtEntities(true);
                block.setVelocity(player.getLocation().getDirection().multiply(2.0D));
            }```
quiet ice
umbral marsh
#

the falling block still dont hurt entitys

opaque scarab
quiet ice
#

I wouldn't use setHurtEntities generally

umbral marsh
#

what would you use?

quiet ice
#

Manual proximity checks and more explicit damage handling (in order to not cause overly generic events)

frosty geyser
#

is there a simple way to see if a server version is greater than 1.16? (without NMS)

quiet ice
#

However uh, that is the code that I've been inherited and it is very old code as it stems from pre-1.12 times

quiet ice
umbral marsh
#

ummm... how would I do that...

#

as you can tell by my leaf, i am new as heck to this stuff

quaint mantle
#

Anyone know a gradle plugin to code smth using mappings and then deobuscate smth once it’s compiled

frosty geyser
quiet ice
#

The most obvious choice would be to go with a newly added material but that wouldn't actually be great.

tribal quarry
#

(Adventure)
Hello, does replaceText invocation affects hoverEvents & other stuff, or its just text?:

message.replaceText(b -> b
    .matchLiteral(entry.getKey())
    .replacement(entry.getValue()));
quaint mantle
# remote swallow for nms?

No, the thing I’m working on requires me to obfuscate the jar but I am tryna code without the obfuscated jar

remote swallow
#

do you hav emappings

quaint mantle
remote swallow
#

paper weight is for nms

#

read what hejust said

umbral marsh
#

hey geol how would i do those proximity checks? and damage handling?

remote swallow
#

it probably exists just i cant findit

quaint mantle
tribal quarry
young knoll
#

Dear god CraftMetaSpawnEgg is an abomination

remote swallow
quaint mantle
#

I’ve never made a gradle plugin before

remote swallow
#

isnt jfrog dead and you can publish it anywhere aslong as you give gradle the repo

remote swallow
#

something j died like last year

#

cant remember if it was jfrog or something else

quaint mantle
#

Idk my team still uses it

quiet ice
remote swallow
#

jcenter

#

thats it

quaint mantle
quiet ice
#

jfrog shouldn't be used regardless

quaint mantle
quaint mantle
remote swallow
#

it should work with artifactory

quiet ice
#

You'd generally want to roll your own repository for private stuff

quiet ice
quaint mantle
quiet ice
#

Especially gradle plugins tend to be a bit strange in layout that chances are jfrog may block your upload. You are better off going to the gradle plugin center if a private repo isn't viable

quaint mantle
#

With a new ver patch obv

quiet ice
#

If you know that you can publish gradle plugins to jfrog then great. Otherwise I cannot guarantee anything

sterile token
#

Is there a way to convert custom "&" for color into ChatColor.Enum?

#

Because there is bug when you use bungee components and colors via the char. It happens that apply the color to some lines of the whole component

worldly ingot
#

Yeah because you shouldn't be mixing legacy text with components

sterile token
#

perfect, what about this?

#
public static BaseComponent[] createCustomComponent(String input) {
        Pattern pattern = Pattern.compile("&[0-9a-fk-or]");
        Matcher matcher = pattern.matcher(input);
        List<BaseComponent> components = new ArrayList<>();
        int previousEnd = 0;

        while (matcher.find()) {
            int start = matcher.start();
            int end = matcher.end();

            if (start > previousEnd) {
                String plainText = input.substring(previousEnd, start);
                components.add(new TextComponent(plainText));
            }

            ChatColor color = ChatColor.getByChar(matcher.group().charAt(1));
            if (color != null) {
                TextComponent textComponent = new TextComponent(input.substring(start, end));
                textComponent.setColor(color);
                components.add(textComponent);
            }

            previousEnd = end;
        }

        if (previousEnd < input.length()) {
            String remainingText = input.substring(previousEnd);
            components.add(new TextComponent(remainingText));
        }

        return components.toArray(new BaseComponent[0]);
    }
lilac dagger
#

You can use a method to turn legacy text into a component

#

And then append it to your components

sterile token
#

isnt that?

lilac dagger
#

It's better that what you're doing

sterile token
#

how? But that will broke, because you mixin componentes with legacy text, what said the staff not doing

lilac dagger
#

Not sure how it was called

#

It won't, it'll make the hierarchy like you're supposed to

#

From the legacy text

sterile token
#

What i thought was, the only way color works great is via TextComponent#color() so i said, well i can just create a parser from &<color> obtaining its ChatColor object, to finally apply to the component

What you think choco? I see you typing too much and im really anxious haha

lilac dagger
#

You can do this too

#

But if it's done for you in the api, why bother?

worldly ingot
#

Just as a general note, please avoid arrays for components. It can be represented as a single component.

public static BaseComponent createCustomComponent(String input) {
        Pattern pattern = Pattern.compile("&[0-9a-fk-or]");
        Matcher matcher = pattern.matcher(input);
        ComponentBuilder builder = new ComponentBuilder();
        int previousEnd = 0;

        while (matcher.find()) {
            int start = matcher.start();
            int end = matcher.end();

            if (start > previousEnd) {
                String plainText = input.substring(previousEnd, start);
                builder.append(plainText);
            }

            ChatColor color = ChatColor.getByChar(matcher.group().charAt(1));
            if (color != null) {
                builder.append(input.substring(start, end)).color(color);
            }

            previousEnd = end;
        }

        if (previousEnd < input.length()) {
            String remainingText = input.substring(previousEnd);
            builder.append(remainingText);
        }

        return component.build(); // You can use #create() if you REALLY need a BaseComponent[]
    }```
#

Really not much reason to not use a ComponentBuilder here

sterile token
#

oh right really thanks, thanks sir

#

Can i see what yo umean @lilac dagger ?

remote swallow
#

hi chocus

worldly ingot
#

I don't know if your logic is sound by the way. I just converted it to use a ComponentBuilder lol

lilac dagger
#

I don't have my pc on hand to look 😦

sterile token
sterile token
lilac dagger
#

But i am 100% sure there is a from legacy to component somewhere in there

#

Just search the md components for it

sterile token
lilac dagger
#

Try that

#

Yes

sterile token
#

But that brokes too if im not wrong

lilac dagger
#

It shouldn't i think

sterile token
#

Thats what causing color being apply to some lines and the others get without the color

lilac dagger
#

It actuslly parses the legacy text

#

And i'm pretty sure it supports bold and underline

lilac dagger
#

It shouldn't cause issues

worldly ingot
#

I mean yeah if you're insistent on using legacy colour codes that's the method you should be using

#

But if you're using components you should ditch the notion of legacy format codes entirely

eternal night
#

prayHalo components prayHalo

sterile token
#

yeah the problem comes when using config files, you wont be creating components for them

#

And also you have to make huge configurations for configuring component messages

worldly ingot
#

If you want to use BungeeChat still there's MineDown as a library you can use for parsing, or if you want to use Adventure then there's MiniMessage

young knoll
#

Minimessage

#

We still need ChocoMessage

sterile token
river oracle
#

ChocoMessage when??

river oracle
#

from configuration messages? just use MineDown its relatively small, provides nice BaseComponent[] (and I add an extra step and reduce the array into a BaseComponent)

sterile token
lilac dagger
worldly ingot
#

Like I said, MineDown is a good option

river oracle
#

MineDown is perfect for this. If you don't want the array too you can always reduce it into a single component

worldly ingot
#

It's only 5 classes

sterile token
river oracle
#

I shade minedown into all my projects

#

its great

sterile token
#

Right really thanks to all i will try it

lilac dagger
#

Minedown does sound pretty cool

#

But i think bungeechat would be cool if it had some way to parse legacy chat for clickable/hoverable

sterile token
#

Yeah my goal is to make a fully and simple library working for both platform 😂

worldly ingot
#

I'm going to figure something out. Whether it's getting MineDown directly integrated into BungeeChat or adopting MiniMessage's language syntax

#

I want something easy

lilac dagger
#

I feel like choco would say, "you can always contribute"

worldly ingot
#

Paper will inevitably remove BungeeChat. They despise it

#

It's been deprecated for a long while now, it will go

sterile token
#

Choco if i design a simple and functional components system for spigot would be apply as contribution? How about the probability

worldly ingot
#

We have a component API

#

I'm finalizing it 😛

sterile token
worldly ingot
lilac dagger
river oracle
lilac dagger
#

Imagine if java kept breaking stuff

#

Not fun

worldly ingot
#

Yeah I made sure to drop array syntax because it was never really necessary, just conflated with existing API is all

sterile token
river oracle
#

I've never looked

worldly ingot
#

They're mutable

#

I need to maybe figure something out for that too? Not sure

sterile token
worldly ingot
river oracle
sterile token
#

I dont understand the sense of mutability with texts?

drifting viper
quiet ice
#

So?

sterile token
drifting viper
sterile token
#

I would love to find such a great information fully related to working witth Packets, because we most of here dont really have the best or been friends of packets to use them correctly

drifting viper
#

Ye, I saw there where really not much resources about Macking an Anti-Cheat or something like that most of the knowledge just comes over time

chrome beacon
#

That's an advanced topic

sterile token
chrome beacon
#

Don't expect any tutorials

sterile token
#

Let discuss about the topic

chrome beacon
#

You'll learn over time how the game works internally and then you can work from there

ivory sleet
#

more like 1% if even that

sterile token
#

Yeah i think understanding the base is the most important thing, but im really stucked around how mojang process the packets with Netty

#

Because they just use them raw, they dont even use Protobuf so you deal a lot understand fucking data types

drifting viper
#

ye NMS is really ugly, But many Packet Librarys makes your Life alot eaiser

sterile token
#

Yeah, but doest make sense just using a library and thats done

#

Because if you know how packets works internally, you know to came with solutions

quaint mantle
elfin cairn
#

package com.example.linkeddamage;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class LinkedDamagePlugin extends JavaPlugin implements Listener {

private Map<Player, Player> linkedPlayers = new HashMap<>();

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

@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    Player joiningPlayer = event.getPlayer();
    Player randomPlayer = getRandomPlayer();

    if (randomPlayer != null) {
        linkedPlayers.put(joiningPlayer, randomPlayer);
        event.getPlayer().sendMessage("You are linked with " + randomPlayer.getName() + ".");
    }
}

@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
    if (event.getEntity() instanceof Player) {
        Player damagedPlayer = (Player) event.getEntity();

        if (linkedPlayers.containsKey(damagedPlayer)) {
            Player linkedPlayer = linkedPlayers.get(damagedPlayer);
            double damage = event.getDamage();
            double linkedDamage = damage * 0.3;

            // Inflict 30% of the damage on the linked player
            linkedPlayer.damage(linkedDamage);
undone axleBOT
quaint mantle
#

if you use netty its irrefutably gonna be faster

sterile token
#

PLease!!

elfin cairn
#

linkedPlayer.sendMessage("You received " + linkedDamage + " damage from " + damagedPlayer.getName() + ".");
}
}
}

// Helper method to get a random player on the server
private Player getRandomPlayer() {
    Player[] onlinePlayers = Bukkit.getOnlinePlayers().toArray(new Player[0]);
    if (onlinePlayers.length > 0) {
        int randomIndex = new Random().nextInt(onlinePlayers.length);
        return onlinePlayers[randomIndex];
    }
    return null;
}

}

drifting viper
#

👍

orchid gazelle
#

please, we already told you to use pastebin

elfin cairn
#

can someone tell me how to put that in my server

sterile token
orchid gazelle
#

?paste

undone axleBOT
quaint mantle
#

underestanding the netty design can be

drifting viper
elfin cairn
#

how

chrome beacon
#

?services

undone axleBOT
sterile token
#

Thats for fure bro

quaint mantle
#

i mean

#

there are a lot of shitty protocols that still are used today

#

mc isnt that bad compared to some of them

chrome beacon
#

People

sterile token
#

i just use weird conventions that ppl here uses hahaha

drifting viper
#

I guess its true that like only 1% of Developers are really Heavily into Packets, especially into Anti-Cheats, Thats the Reason there are not many Realy Good Anti-Cheat, I Mean at this Point the Most is just scam Intave, Matrix, Artermis and more costs hundreds of Dollars but are not that Good

quaint mantle
#

lmao

#

yeah they are a fkn scam

drifting viper
#

The Reason is that there is not an Big competition

lilac dagger
#

I could make a better anti cheat

quaint mantle
#

doubt

lilac dagger
#

In fact i'll just make something for aimbot and post it

quaint mantle
#

even if u are competent it demands a lot of time

quiet ice
sterile token
#

A really nice example of shity and scam anticheats is called Verus, cost over 120 usd they license for using and doesnt even give exact positives about the "lagging cheat"

quiet ice
#

Multi-currency economy implementations are few are far spread out for example.

drifting viper
quaint mantle
#

yes

drifting viper
#

Do you know Spartan Anti-Cheat ?

quaint mantle
#

for u to understand and be able to write anti cheats properly u need to be proficient in nms packet protocol, nms physics, netty and what not

worldly ingot
quaint mantle
#

i just know a lot of mediocre servers use essentials as an impl against vault

sterile token
#

In my case what doesnt help me is the shity and shity Mojang data types, why fuck they dont use plain Buffers without adding shity encoding

quiet ice
worldly ingot
#

I do! 🙂

quiet ice
sterile token
lilac dagger
#

It better support async

quaint mantle
quiet ice
quaint mantle
#

and quite poor

quiet ice
#

Yeah, but as the API does not support multi-currency the impls generally don't either

quaint mantle
#

mojang has done a nice job to map out primitive datatypes to more data oriented ones

sterile token
quaint mantle
drifting viper
#

I was writing with the Developer of Spartan and asked him why the Anti-Cheat is Bukkit Events based and if he planning a Packet Rewrite, He told that he never had Problems using Bukkit Events and That if he would make a New Anti-Cheat he would use Packets but at the current State he would must be Rewrite everthing. So hes basicly to Laziy to Rewrite the Premium Plugin which many People use, I don't understand how this Anti-Cheat is so Popular

quiet ice
quaint mantle
#

it looks like a java 6 api

quiet ice
quaint mantle
#

iirc it uses doubles

quiet ice
#

I have a project that is actually compiled with Java 6 - eventually I want to move to Java 5.

quaint mantle
#

and already there I decided to not touch it

#

the api developer who founded it must have been quite inexperienced when he started it

#

idk maybe its better now

quiet ice
#

Oh my god - you are one of the people to think that JIT optimizes short-lived objects.

sterile token
#

how much you think hypyxel anti cheat costs? any idea here i really interested on its price idk why

quaint mantle
#

no not rly

#

but doubles arent great precision wise

sterile token
quiet ice
#

Only for very high values (read: Multiple billions)

quaint mantle
#

depends but yea