#help-development

1 messages ยท Page 1016 of 1

swift dew
#

same ItemData

remote swallow
#

what are you trying to do

#

this is an xy situation

#

?xy

undone axleBOT
grim hound
#

Persistent data is only for bukkit values

#

Not for the entirety of it's nbt

#

Check with I think /data get @s Inventory[0] with the item in hotbar's most left hand side

#

Is that how you spell it?

#

"Left hand side"

swift dew
# remote swallow what are you trying to do

i have a method for creating an itemstack with a custom class named ItemData, i use that void to create item1 with a static BaseStats value from another class, then i use the itemdata item1 has to create item2, item1 and item2 dont stack

#

item1 is created from ItemData/from scratch, item2 is created from retrieved ItemData from item1 which is an itemstack

#

thats the difference basically

chrome beacon
#

compare the nbt of the items

#

and see the diff

swift dew
#

aight 1 sec

#

yeah they have differences in itemdata

#

wtf

#

ill prob check what wrong tomr, thanks for the help

undone yarrow
#

I found this piece of code and I was wondering if it's possible to also add a listener for a drop action (when the player drops the 'boomerang' item) https://hastebin.skyra.pw/juxahusive.csharp
Haven't used java in a while so am not in any state to completely change around this code, but was wondering if its possible with a simple extra if statement

tardy delta
alpine urchin
chrome beacon
#

Have you considered using the Files api instead

#

(For the copying part)

tardy delta
#

and InputStream::transferTo

chrome beacon
#

eh Files make more sense

eternal oxide
#

You also have directories returned bny list()

#

using Files

alpine urchin
#

trying Files @chrome beacon

#

so the issue is the actual copying

alpine urchin
#

from some random spigotmc forum

alpine urchin
grim hound
#

I can't even think of an insult back

grim hound
alpine urchin
#

it copies just fine

#

i use files

#

copies fine

grim hound
#

I actually don't see what could be wrong

alpine urchin
#

ima retry

grim hound
#

Since I'd probably write that almost the exact same way

grim hound
alpine urchin
#

nope, its as if nothing happened

#

it creates a new world

#

yes

#

but its just default generator settings

grim hound
#

What about the files being copied?

#

Maybe they're just not being loaded?

#

Anyway, gl, amma go sleep now

alpine urchin
#

good rest

grim hound
#

Isn't it late for you as well?

alpine urchin
#

affirmative

grim hound
#

Man, I love the way you speak

grim hound
harsh ruin
#

Quick question; How do I send a variable in a String?

chrome beacon
#

send where

junior cradle
#

How to make such a skorbovrd without numbers with Packets, I tried with mine only with ticks, and I know that this is only possible with 1.20.4
https://ibb.co/b3HyMqR

storm crystal
#

how can I filter out black heart particles on damaging an entity? I tried using ProtocolLib and reading about it on forums but it didn't work as intended

#

If there's no better thing than ProtocolLib, then how can I use it properly?

worldly ingot
#

That's very likely done on the client

raw epoch
#

Do someone have a datapack that modify the witch drops to match the new witch buff?

echo basalt
#

(what is a private static final set)

echo basalt
#

If it still shows there's nothing you can do, other than making the particle invisible in the resourcepack and redirecting packets to some other particle

wet breach
storm crystal
#

and it didnt work at all

echo basalt
#

get rid of the second if check

#

Just to be sure

#

It could also be related to a world event

worthy yarrow
#

Is there much reason to be using pdc for inventory populators? Such as those for menus with no persistence really needed?

young knoll
#

What is an inventory populator

worthy yarrow
#

Any item

young knoll
#

Why would you need pdc on it

worthy yarrow
#

lore and what not, but that's what I'm asking is there any reason for pdc given these are just like menu buttons

young knoll
#

No?

#

Also lore isnโ€™t pdc

worthy yarrow
#

mate

#

alright

young knoll
native nexus
#

This conversation confuses me

young knoll
#

It confuses me and I was part of it

native nexus
#

Why are pdcs so hard to grasp for people.

worthy yarrow
#

I understand pdc mateeeee

#

You just don't understand my question

vast ledge
#

I dont even understand your question reading it as a thirdparty

nova notch
#

it seems you should ask a better question

worthy yarrow
#

Surely

#

Here's what I think: It was a bad question and I've already found my answer so thank you all for helping me

vast ledge
#

Oh, okay

round finch
#

i got a dream.. knowning how to save a list in a chunk

#

๐Ÿ˜ฎโ€๐Ÿ’จ

round finch
#

u know it brother

#

๐Ÿ’€

remote swallow
round finch
young knoll
#

Yes

round finch
remote swallow
#

choose your type

round finch
#

ahh my bad

#

Thank you so much!!

#

no issues ๐Ÿ™‚

broken nacelle
#

eclipse + white theme = โ˜ ๏ธ

round finch
#

๐Ÿ’€

drowsy helm
#

Okay I'm still really stuck on this.

I'm using "C:\Program Files\Java\jdk-21.0.2\bin\java.exe" -jar BuildTools.jar --dev --dont-update --remapped --compile CRAFTBUKKIT,SPIGOT
To compile and I've simply changed System.out.println("Loading libraries, please wait..."); to System.out.println("Loading libraries, please wait... TEST"); in craftbukkit to test if its compiling properly, but once I decompile the generated spigot-server jar I it hasn't changed.
Looking at the Craftbukkit jar it compiles fine and shows the TEST. I have checked my .m2 and it has the updated one with TEST. so where on earth is it getting the non-updated version from?

#

I've also tried generating patches for craftbukkit and still no change

alpine urchin
#

sometimes you just want something working then you make the code neat

drowsy helm
#

wait omg

#

spigot-server has its own craftbukkit package

hard badge
#
@EventHandler
public void onRightClickDoor(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    Action action = event.getAction();
    Block blockClicked = event.getClickedBlock();
    BlockState blockState = blockClicked.getState();

    if (action == Action.RIGHT_CLICK_BLOCK) {

        if (blockClicked.getType() == Material.IRON_DOOR_BLOCK) {
            Door iDoor = (Door) blockState.getData(); 

            blockClicked.getState();

            if (iDoor.isOpen() == false) {
                player.sendMessage(ChatColor.AQUA + "WORKS!");
                iDoor.setOpen(true);
                blockState.update();
            } else {
                iDoor.setOpen(false);
                blockState.update();
            }
        }
    }
}

why dose this code not work i want to be able to toggle the iron door to open or close on right-click

drowsy helm
#

does it not execute at all

hard badge
#

it dose

#

but door dosent open

#

wait no

#

it stopes after this line

#

BlockState blockState = clickedBlock.getState();

drowsy helm
#

you need to apply the state to the door

hard badge
#

how do i do that

drowsy helm
#

blockState.update()

#

oh im tripping

#

you did that

hard badge
#

the thing is code fully stops after that one line

#

it dosent even get to where we cheack weather door is open

drowsy helm
#

try blockState.setBlockData(iDoor)

#

then update

#

and how are you verifying that the it is stopping

#

java code doesnt just stop unless theres an exception

hard badge
#

@EventHandler
public void openDoor(PlayerInteractEvent event) {
Block clickedBlock = event.getClickedBlock();
if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (!(clickedBlock.getType() == Material.IRON_DOOR) {
return;
}
BlockState blockState = clickedBlock.getState();
Bukkit.broadcastMessage("-1");
Door iDoor = (Door) blockState.getData();
Bukkit.broadcastMessage("-2");
clickedBlock.getState();
if (iDoor.isOpen() == false) {
event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
iDoor.setOpen(true);
blockState.update();
} else {
iDoor.setOpen(false);
blockState.update();
}
}it never broadcasts -2

drowsy helm
#

doesnt really make sense unless its throwing an exception

hard badge
#

java.lang.ClassCastException: class org.bukkit.material.Door cannot be cast to class org.bukkit.block.data.type.Door (org.bukkit.material.Door and org.bukkit.block.data.type.Door are in unnamed module of loader java.net.URLClassLoader @5a10411)

gives me this error

drowsy helm
#

oh you're using the wrong import

hard badge
#
@EventHandler
    public void openDoor(PlayerInteractEvent event) {
        Block clickedBlock = event.getClickedBlock();
        if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
            return;
        }
        if (!(clickedBlock.getType() == Material.IRON_DOOR)) {
            return;
        }
        BlockState blockState = clickedBlock.getState();
        Door iDoor = (Door) clickedBlock.getBlockData();
        Door.Hinge hinge = iDoor.getHinge();
        Bukkit.broadcastMessage(hinge + "");
        clickedBlock.getState();
        if (iDoor.isOpen() == false) {
            Bukkit.broadcastMessage("2");
            event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
            iDoor.setHinge(Door.Hinge.LEFT);
            blockState.update();
        } else {
            iDoor.setHinge(Door.Hinge.RIGHT);
            blockState.update();
        }
    }```
#

now this code runs all the way

#

but it still dosent open

drowsy helm
blazing ocean
#

m

small valve
#

Maybe a dumb question, is there a way to run automated unit tests on certain aspects of a plugin? Like... example; test to make sure player is successfully teleported. Is this feasible or must you test manually?

blazing ocean
#

mockbukkit

#

but idt so for that kind of stuff

junior cradle
#

How do I convert net.kyori.adventure.text.Component to net.minecraft.network.chat.Component ?
Punched and does not work

public static @NotNull net.minecraft.network.chat.Component convertComponentToMinecraft(@NotNull Component component) {
        return net.minecraft.network.chat.Component.literal(LegacyComponentSerializer.builder().build().serialize(component));
    }

MiniMessage
https://ibb.co/fMQkbFQ
https://ibb.co/hDnDRcP

hazy parrot
#

You can maybe test if coordinates are correct

small valve
round finch
#

i have a problem then I'm placing an item
pdc string returns null

blazing ocean
#

?paste

undone axleBOT
round finch
umbral ridge
#

๐Ÿ˜ฟ

junior cradle
blazing ocean
blazing ocean
#

it was something with component serializer iirc

junior cradle
# blazing ocean `GsonComponentSerializer` for the adv one, idk what the class name for the nms o...

No work

public void newScoreboard(@NotNull String name, @NotNull Component title) {
        String serialize = GsonComponentSerializer.builder().build().serialize(title);
        MutableComponent literal = net.minecraft.network.chat.Component.Serializer.fromJson(serialize);

        this.scoreboard.addObjective(name, ObjectiveCriteria.DUMMY, literal,
                ObjectiveCriteria.RenderType.INTEGER, false, null);
        this.name = name;
    }
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.

blazing ocean
pseudo hazel
#

what are you even trying to do

blazing ocean
blazing ocean
junior cradle
blazing ocean
#

you cannot pass in an nms component into an objective

#

vanilla limitation

pseudo hazel
#

yes correct

#

so what do you want to do with this component

blazing ocean
#

especially nms ones

pseudo hazel
#

nms ones will never work for normal api stuff iirc

blazing ocean
#

even paper doesn't support it and they made almost every string method deprecated

pseudo hazel
#

lmao

junior cradle
#

@blazing ocean Thanks, it works! ๐Ÿงก

public static @NotNull net.minecraft.network.chat.Component convertComponentToMinecraft(@NotNull Component component) {
        return net.minecraft.network.chat.Component.Serializer.fromJson(GsonComponentSerializer.gson().serialize(component));
    }
umbral ridge
#

๐Ÿ˜ฟ

quaint mantle
blazing ocean
tardy delta
#

React not too bad

round finch
#

now it works

granite cloud
#

please anyone help me

#

i am getting 1 error again and again

spiral tusk
#

I think you have to provide just a bit more information so that anyone can help you ^^

granite cloud
#

this error

#

when player try to join

spiral tusk
hard badge
#

Anyone know how to remove the thing that gets typed in chat after a command like for example /tp <player>

Player has teleprted to player

quiet ice
misty ingot
#

how would one go about making permissions like "abc.#" where whatever the highest amount of # the player has i can grab and use?

nova notch
pseudo hazel
#

you mean the tab completion?

nova notch
#

no?

junior cradle
nova notch
#

i have not tested this but try StyledFormat.NO_STYLE for the number format?

young knoll
#

Thereโ€™s an option to hide them now

junior cradle
dreamy chasm
#

question about how people handle passing there plugin instance around, I previously had a getInstance function in my plugin class, but was told to do dependency injection. But it seems like I am having to just pass the plugin to every function now, just for logging etc. Feels like I am still doing it wrong, any guidance?

nova notch
junior cradle
nova notch
#

Ah yeah I guess that's just for the color then

#

Well it was worth a shot

#

No clue how to do it directly with packets

#

But it is possible

hard badge
#
@EventHandler
    public void openDoo(PlayerInteractEvent event) {
        Block clickedBlock = event.getClickedBlock();
        if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
            return;
        }
        if (!(clickedBlock.getType() == Material.IRON_DOOR)) {
            return;
        }
        BlockState blockState = clickedBlock.getState();
        Door iDoor = (Door) clickedBlock.getBlockData();
        Door.Hinge hinge = iDoor.getHinge();
        Bukkit.broadcastMessage(hinge + "");
        clickedBlock.getState();
        if (iDoor.isOpen() == false) {
            event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
            iDoor.setHinge(Door.Hinge.LEFT);
            blockState.update();
            blockState.setBlockData(iDoor);
        } else {
            iDoor.setHinge(Door.Hinge.RIGHT);
            blockState.update();
            blockState.setBlockData(iDoor);
        }
    }```
this still dosent work
eternal oxide
#

You have to parse it yourself.

#

loop over all PermissionAttachmentInfo#getPermission() checking the #getValue() and find the highest

fair rock
eternal oxide
hard badge
#

i did that and now it works but it works as in it just rotates the door not opens it

fair rock
#

use setOpen instead of setHinge?

eternal oxide
#

well, all you did is move the Hinge. you never setOpen

#

iDoor.setopen(!iDoor.isOpen())

#

will toggle it

hard badge
#
@EventHandler
    public void openDoor(PlayerInteractEvent event) {
        Block clickedBlock = event.getClickedBlock();
        if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
            return;
        }
        if (!(clickedBlock.getType() == Material.IRON_DOOR)) {
            return;
        }
        BlockState blockState = clickedBlock.getState();
        Door iDoor = (Door) clickedBlock.getBlockData();
        clickedBlock.getState();
        if (iDoor.isOpen() == false) {

            event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
            iDoor.setOpen(true);
            blockState.setBlockData(iDoor);
            blockState.update();
        } else {
            iDoor.setOpen(false);
            blockState.setBlockData(iDoor);
            blockState.update();
        }
    }

This dosent work for some reason

eternal oxide
#

so no need for your if check or your duplicate code

#
event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
iDoor.setOpen(!iDoor.isOpen());
blockState.setBlockData(iDoor);
blockState.update();```
#

no need for your check

#

you don;t need to check IF its open

inner mulch
#

how can i spawn the structure overlay?

eternal oxide
#

also, this line does nothign clickedBlock.getState();

fair rock
#

Instead of:

    if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
            return;
    }

And you can use != in Enum comparing

like

    if (event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
            return;
    }
hard badge
#
@EventHandler
    public void openDoor(PlayerInteractEvent event) {
        Block clickedBlock = event.getClickedBlock();
        if (event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {
            return;
        }
        if (clickedBlock.getType() != Material.IRON_DOOR) {
            return;
        }
        BlockState blockState = clickedBlock.getState();
        Door iDoor = (Door) clickedBlock.getBlockData();
        event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
        iDoor.setOpen(!iDoor.isOpen());
        blockState.setBlockData(iDoor);
        blockState.update();
    }

This still dosent work i think ill start trying with redstone power or something

eternal oxide
#

are you doing this on teh top or bottom of the door?

hard badge
#

in game i try both

#

but none of the door parts open

fair rock
#

Question, do you get your debug message "WORKS!"?

hard badge
#

yes i get it

eternal oxide
#

um you are doing this in teh interact event but not canceling it?

#

clicking a door opens/closes it

#

ah Iron door

#

you may have to get the other half too

#

as its a biSected block

hard badge
#

i just relized the problem why it dosent work i forgot that right lcick also gets ran for off hand

#

so the event gets trigerd twice

fair rock
#

๐Ÿ’€

#

Just check for the hand

fair rock
#

I would say its just the hand problem

hard badge
#

now it all works thanks for the healp

rapid vigil
eternal oxide
#

?di

undone axleBOT
wintry elk
#
ItemStack Ares_Hammer = new ItemStack(Material.DIAMOND_SWORD, 1);
        ItemMeta areshammermeta = Ares_Hammer.getItemMeta();
        areshammermeta.setDisplayName("" + ChatColor.BLUE + ChatColor.BOLD + "Ares Hammer");
        areshammermeta.setLore(List.of(ChatColor.GRAY + "A hammer hand crafted by Ares himself", "", "" + ChatColor.WHITE + "Kill" + ChatColor.GRAY + " a player to gain " + ChatColor.WHITE + "Invisibility" + ChatColor.GRAY + " and " + ChatColor.AQUA + "Speed 2", "" + ChatColor.GRAY + "for 15 seconds", "" + ChatColor.DARK_GRAY + "Cooldown: 60s", "", "" + ChatColor.WHITE + "Sneak + Right Click Ability: ", "" + ChatColor.GRAY + "Spawn 3 Vex's to fight for you", "" + ChatColor.DARK_GRAY + "Cooldown: 1m 30s"));
        areshammermeta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, new AttributeModifier("generic.attackDamage", 9, AttributeModifier.Operation.ADD_NUMBER));
        areshammermeta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, new AttributeModifier("generic.attackSpeed", 0.9, AttributeModifier.Operation.ADD_NUMBER));
        areshammermeta.setCustomModelData(25);
        Ares_Hammer.setItemMeta(areshammermeta);
        ARESHAMMER = Ares_Hammer;

How can i stop it from added all of these extra stuff

#

i messed that up

#
areshammermeta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, new AttributeModifier("generic.attackSpeed", 0.9, AttributeModifier.Operation.ADD_NUMBER));

young knoll
#

One of the attribute modifier constructors lets you specify an equipment slot

hardy lagoon
#

I dont have much experience with custom items like this tho

young knoll
#

That will hide the entire tooltip

hardy lagoon
#

The tooltip contains all the damage stats no?

young knoll
#

It contains everything

#

The name, lore, modifiers

wintry elk
#

what do i set the uuid to?

young knoll
#

Anything

#

You can just use a random one

wintry elk
#

how do i make a uuid ๐Ÿ˜ญ

hazy parrot
#

UUID.randomUUID or smth

blazing ocean
wintry elk
#

thank you

rough drift
#

so, titles do not support components in Spigot

#

you can use a custom unicode character instead

#

packets

acoustic pendant
#

Is there any resource that shows how to change GUIs texture? I haven't found anything

rough drift
#

make a character with a really large sprite and add it to the title

worldly ingot
rough drift
worldly ingot
#

We have API for components in inventory titles (and really all across the API) waiting approval

#

Until then, you can't really accomplish this in Bukkit

rough drift
#

๐Ÿ”ฅ

echo basalt
#

for months now

drowsy helm
#

I donโ€™t get it

rough drift
#

hey choco

drowsy helm
#

How car

rough drift
#

when can we edit an inventory view's title

drowsy helm
#

Hold packet

worldly ingot
echo basalt
#

One thing I'd like to see is some sort of native parser for components

rough drift
worldly ingot
#

And I would show it to you but my browser just crashed

#

So that's cool

echo basalt
#

So plugin devs don't need to come up with their own for things like configurable messages / items

drowsy helm
#

Mr chocolate when you pr do you have to create patches aswell

echo basalt
#

Something like minimessage but native

worldly ingot
rough drift
#

but sadly I'm stuck on the ancient 1.17

worldly ingot
#

Well that sounds like a you problem now doesn't it?

rough drift
#

yes

echo basalt
#

Another thing I'd like to see on the component system is text replacement / manipulation

#

Adventure has the replaceText functions, bungee doesn't

worldly ingot
#

You could always PR those ๐Ÿ‘€

#

To your benefit, BungeeChat is on GitHub

drowsy helm
#

Easy pr

worldly ingot
#

Easier manipulation of components has also been on my todo list, I've just been preoccupied with other things

#

String replacement was discussed in the component PR

drowsy helm
#

Do you work fulltime choco

worldly ingot
#

Yes

drowsy helm
#

Are you melded to your chair yet pog

worldly ingot
#

Practically

echo basalt
#

first big purchase I made after I did full-time work was get a nice chair

drowsy helm
#

So worth it

echo basalt
#

And for some reason there's an industry thing where expensive chairs don't come with head rests

drowsy helm
#

Gaming chairs are horrible for ergonomics

echo basalt
#

So the second big purchase I did was spend 250$ on a headrest

worldly ingot
#

Never again

echo basalt
#

Yeah

#

Bought a gaming chair for 140 bucks

#

it was just a slab of plywood with a little bit of something around

#

The cool thing about expensive chairs is that you can never sit on a regular office chair anymore, they're horrible

fair rock
#

What would you recommend instead because currently i have one and my full-time jobs start 03.06 xd

drowsy helm
#

I have some cheap $200 office chair and itโ€™s great

echo basalt
#

I use a Haworth Fern with the Atlas headrest

#

chair was like 1k

#

If you live in the US you can find used herman millers / steelcase for as low as like 300 bucks

fair rock
#

Thank you c:

echo basalt
# fair rock Thank you c:

Overall main models you're looking for are:

  • Herman Miller Aeron (pretty famous) - Mesh
  • Herman Miller Embody (better than aeron imho but like double the price, rare find) - Fabric
  • Herman Miller Sayl (weird model, cheaper than others but no third-party headrest available) - Fabric with weird plastic back
  • Steelcase Gesture (No headrest iirc) - Fabric
  • Steelcase Leap V2 (No headrest iirc) - Fabric
  • Haworth Fern (Third-party headrest made to order, takes about a month on average) - Fabric with rubber mesh behind
  • Haworth Zody (No headrest iirc) - Mesh back iirc
#

You want components

#

This is a lot easier with paper

#

Or you can use nms to send packets :) and open the inv entirely through that

fair rock
echo basalt
#

If you are sending packets, make sure to use the same container ID otherwise it nukes your inventory

#

And ideally call player#updateInventory to resync every item

chrome beacon
#

Don't use toString on them

echo basalt
#

string concatenation calls toString anyways

#

try calling updateInventory a tick later

#

Or setting the items after changeTitle is called

surreal mural
#

hello,I am look for a method that allows players can switch into a new server in a new ip without using bungeecord.
โ€‹(Making a mod with plugins to achieve it,I have done a lot for this with mods,but mods affect more seriously than bungeecord in fact)
โ€‹and I want to beg your pardon because I am a student but not a native speaker so there might be some mistakes

short drift
#
    // On placing a trapdoor.
    @EventHandler public void onPlayerPlaceTrapdoor(BlockPlaceEvent event) {
        Block block = event.getBlockPlaced();
        System.out.println("Block placed is: " + block.getType());
        if (!(block instanceof TrapDoor trapdoor)) {
            System.out.println("Block placed is not a trapdoor.");
            return;
        }
#

I don't understand.

fair rock
#

block.getState()

short drift
fair rock
#

if (!(block.getState() instanceof TrapDoor trapdoor)) {

short drift
#

Yes, I understood that, but ... ?

#

Why?

#

Why isn't it matching with Block?

#

It's not in the same inheritance hierarchy?

chrome beacon
#

no it's not

short drift
#

Confusing.

chrome beacon
#

also checking getState isn't very good for performance

fair rock
chrome beacon
#

it has to copy the entire block state

short drift
#

So what would you recommend then?

chrome beacon
#

Keep a HashSet of known trapdoor materials and check against that

short drift
#

Urgh...

eternal oxide
#

if (Tag.TRAPDOORS.isTagged(block.getType()))

short drift
fair rock
#

Since when that exists or im just living on a fucking moon

short drift
#

I did not know that.

#

Very cool. Thank you @eternal oxide

chrome beacon
#

oh nice there's a tag for that

chrome beacon
#

There weren't that many of them last time I checked but it looks like they've added a ton

green prism
#

Which logger does the latest version of BungeeCord use?

#

Isn't it log4j?

sonic sky
#

Probably

green prism
#

My MongoDB logging level changer that works in Spigot doesn't work in Bungee (it's Log4j-based)

#
    /**
     * Set the log level to WARN for the MongoDB driver
     */
    private void disableMongoInfoLogging() {

        // Set the log level to WARN for the MongoDB driver
        Configurator.setLevel(
                "org.mongodb.driver",
                org.apache.logging.log4j.Level.WARN
        );

    }
#

Seems weird

sonic sky
#

Any errors?

green prism
#

Well, no

#

๐Ÿ˜…

dim frost
#
protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.VEHICLE_MOVE) {
   @Override
   public void onPacketReceiving(PacketEvent event) {
      PacketContainer packet = event.getPacket();
      Player p = event.getPlayer();
      p.sendMessage("1: " + packet.getStrings().read(0) + " 2: " + packet.getStrings().read(1) + " 3: " + packet.getStrings().read(2));
   }
});

Trying to get data on player movement with packets but nothing happens according to intended code, what am I doing wrong? (first time using protocol lib)

sonic sky
vast ledge
fair rock
green prism
#
        // Check for logging options
        if(this.customConfig.getBoolean(ConfigKey.DISABLE_MONGO_LOGGING)) {
            this.disableMongoInfoLogging();
        }

        // Initialize the databases
        this.initDatabases();

And it's executed before the database connection

tardy delta
#

me still looking for years now how to change the mongodb logger level

vast ledge
#

Same ++

green prism
#

Unfortunately, it doesn't work on BungeeCord

#

But it does on Spigot/Paper and every other fork that has log4j

tardy delta
#

where does Configurator come from?

green prism
#

You'll need this library:

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.23.1</version>
        </dependency>
tardy delta
#

dammit another dependency

#

no plain java code?

green prism
green prism
chrome beacon
#

The server provides that though

#

so you don't need to shade it

green prism
dim frost
vast ledge
#

i see

dim frost
#

what I need is exactly WASD movement

#

Basically to simulate controls in my vehicle plugin that is

green prism
eternal oxide
#

pretty sure its a steerage packet

vast ledge
#

yea

chrome beacon
#

The server does

vast ledge
#

VehicleSteerPacket

#

or smth

green prism
#

In console

dim frost
#

thanks ill try that!!

chrome beacon
#

Take a look :)

dim frost
#

also whats the difference between overriding onPacketReceiving or onPacketSending

chrome beacon
#

Listening for packets recieved vs packets being sent

dim frost
#

But what is meaning of a steer vehicle packet being sent?

#

does that mean the server is driving the vehicle or what??

eternal oxide
#

its never sent from teh server

dim frost
#

oh wait

#

I mean what does Server.VEHICLE_MOVE mean when its onPacketSending

#

does it simply not do anything if its on sending?

pseudo hazel
#

that shouldnt happen I think

#

if it does you can ignore it

green prism
# chrome beacon Take a look \:)

Thank you!
Now the question has changed haha
How can I change MongoDB's logging level?

    private void disableMongoInfoLogging() {

        System.out.println("Disabling MongoDB info logging...");

        // Set the log level to WARN for the MongoDB driver
        Logger logger = Logger.getLogger("org.mongodb");
        logger.setLevel(java.util.logging.Level.WARNING);

    }
16:25:47 [INFO] Disabling MongoDB info logging...

16:25:47 [INFO] MongoClient with metadata {"driver": {"name": "mongo-java-driver|sync", "version": "5.0.1"}, "os": {"type": "Windows", "name": "Windows 11", "architecture": "amd64", "version": "10.0"}, "platform": "Java/Oracle Corporation/21.0.3+7-
vast ledge
#

If it were that simple, i have yet to find a method to make it shut the fck up

pseudo hazel
#

dont use mongo

#

easiest solution

vast ledge
#

No

#

use mongo

#

dont use sql

green prism
green prism
dim frost
#

[Pets] Unhandled exception number 256 occurred in onPacketReceiving(PacketEvent) for Pets java.lang.IllegalStateException: Override onPacketReceiving to get notifcations of received packets!

pseudo hazel
#

ah yeah

dim frost
#

@eternal oxide
I get this exception
Unhandled exception number 32 occurred in onPacketReceiving(PacketEvent) for Pets java.lang.IllegalStateException: Override onPacketReceiving to get notifcations of received packets!
with this code

protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.STEER_VEHICLE) {
            @Override
            public void onPacketReceiving(PacketEvent event) {
                PacketContainer packet = event.getPacket();
                Player p = event.getPlayer();
                try {
                    p.sendMessage(packet.getBooleans().read(0).toString());
                } catch (FieldAccessException ex) {
                    p.sendMessage("0");
                }
            }
        });
#

Im not sure what it means

#

full exception

#

nvm I fixed it

#

idk how

fair rock
#

Magic as always

chrome beacon
#

Probably running an old jar

dim frost
#

now im gonna mess around to figure out wat and how to take from the packet container

dim frost
chrome beacon
#

Looking at the structure of the nms packet class is also useful

#

since ProtocolLib is essentially a layer of reflection

dim frost
#

PacketWrapper?

#

im sorry ive no idea what you mean exactly

#

im not familiar with terms especially like nms

#

@chrome beacon sorry to ping was bringing your attention to the reply

chrome beacon
chrome beacon
#

it can also be used to refer to CraftBukkit and/or non-api code that's part of Spigot

dim frost
#

ohhh

chrome beacon
#

basically the server internals

dim frost
#

I thought it specifically mentioned to packets or something..

#

damnn

shadow night
chrome beacon
#

what are you working on

shadow night
dim frost
#

In a more basic form called a Pet

#

oh wait

#

i wasnt asked that

#

anyway

chrome beacon
dim frost
#

Olivo how do I use packet wrapper is there a wiki?

chrome beacon
#

It's just classes that wrap the protocollib api

#

open the class for the packet you want to read

#

and see how it works

dim frost
#

okay ty

dim frost
#

I cant import the api because of bad gateway

#

lmao

#

what do I do now ._.

#

and yes its an error from the repo

dim frost
#

Im a rookie in java as well

#

(I started java before bukkit but didnt get as good as I should have before starting on bukkit api)

chrome beacon
chrome beacon
#

this.handle is the packet container

dim frost
#

Ohh so u mean like

#

just understand what its wrapping

#

and directly implement it without using the api?

#

ig that works

#

Oh shitttt

#

I figured it out..

#

the whole time the cause for blank output was .getField

#

I needed .read

#

bruhhh

#

@chrome beacon THANKS ALOT

#

I got WASD ANDDDD jump & shift!!!

knotty meteor
#

Hey, does someone know how i can put text with a texturepack font as a GUI title name?
Because then it is a custom gui texture for me

/tellraw @a [{"text":"S","font":"minecraft:ui"}]
textcomponents wont work i already tried, and if it is with packets can someone send an example please?

I work with spigot 1.19.4

dim frost
#

thanks so much

chrome beacon
knotty meteor
#

Yeah but not everyone uses paper for their server, or does paper plugins also work on normal spigot servers?

chrome beacon
#

anyways people have told you what to do with the packet already, no?

soft hound
#

Hey everyone!

I'm trying to access data from the commands.yml that is in a package inside the project structure, any help on how to access it ?

undone axleBOT
knotty meteor
soft hound
rough drift
#

how can I iterate every item in an inventory view? Is that possible? Do I need to combine the sizes of the bottom and top inventories to loop?

ivory sleet
#

Yea I think you just iterate through both top and bottom

rough drift
#

ah thanks

#

man ghost items are difficult ๐Ÿ˜ญ

#

(accessibility settings go brrrrrrrr)

ivory sleet
rough drift
#
var size = view.getTopInventory().getSize() + view.getBottomInventory().getSize();
for (int i = 0; i < size; i++) {
    var item = view.getItem(i);
}
```Am I correct here?
chrome beacon
rough drift
#

I have pretty much never used inventory views ๐Ÿ˜…

knotty meteor
#

Alright thank you!

inner mulch
#

is a getter faster when there is less data in terms of memory? or is there no real difference

rough drift
#

wym

inner mulch
#

i get 1kb object

#

i get 2kb object

chrome beacon
#

Sounds like you're micro optimizing

inner mulch
#

some faster or not?

#

im just curiosu

rough drift
#

it passes a reference

chrome beacon
#

You probably have other code that you should focus on instead

rough drift
#

the size is constant

#

i.e. 8 bytes iirc

#

so you don't have to worry about it

ivory sleet
soft hound
#

When creating custom .yml files in resources The way to extract them is doing File file = new File(getDataFolder(), "file_name.yml"); right?

rough drift
chrome beacon
#

you're just definging a path to a file

rough drift
#

why would it be more though

soft hound
chrome beacon
#

no

soft hound
#

Then i can save it with FileConfiguration

#

Oh..

ivory sleet
chrome beacon
#

not unless you tell it

rough drift
ivory sleet
#

๐Ÿฅฒ

chrome beacon
#

The File object is just a path to the file

rough drift
#

I'll keep it like this for now I guess? or acutally...

#

?jd-s

undone axleBOT
rough drift
#

wrong one

#

?stash

undone axleBOT
inner mulch
#

how do you guys name your data objects

#

i feel like playerdata is kinda boring

ivory sleet
soft hound
#

Would getResource("commands.yml"); get the file's information ?

ivory sleet
soft hound
#

Contents i mean

rough drift
rough drift
#

you can read all of the contents of that file with it

#

you need to specify the full path from the root of resources

#

so in this case, /plugin.yml for the plugin.yml file

chrome beacon
#

if you're just trying to create a config read the wiki link sent earlier

rough drift
#

if you had a folder, it would be /myfolder/whatever.whatever

soft hound
#

I have resources/commands.yml

#

and i want to read the commands inside of it

rough drift
soft hound
#
private void createCustomConfig() {
        customConfigFile = new File(getDataFolder(), "custom.yml");
        if (!customConfigFile.exists()) {
            customConfigFile.getParentFile().mkdirs();
            saveResource("custom.yml", false);
         }

        customConfig = new YamlConfiguration();
        try {
            customConfig.load(customConfigFile);
        } catch (IOException | InvalidConfigurationException e) {
            e.printStackTrace();
        }
        /* User Edit:
            Instead of the above Try/Catch, you can also use
            YamlConfiguration.loadConfiguration(customConfigFile)
        */
    }``` they have this here on the doc u guys seynt
ivory sleet
#

looks alright

soft hound
#

so it will save the file and it's contents

#

okay perfect, thx โค๏ธ

ivory sleet
#

this will

  1. take the file from JAR and put it in DATAFOLDER if its not in the DATAFOLDER, it may also create parent folders and the DATAFOLDER itself if they're missing.
  2. read the file from the DATAFOLDER, the contents will be dumped into ur YamlConfiguration object
rough drift
#

so

#

apparently

#

InventoryView#setItem doesn't set a fake item

ivory sleet
#

fake item?

rough drift
#

yeah I need to make a single player see a "custom" item to their person

#

I figured editing a view wouldn't change the underlying container

chrome beacon
#

make a new inventory

#

or use packets

rough drift
#

honestly probably not worth it yet, I'll make that a proper feature in my framework later and deal with accessibility at another time ig

pseudo hazel
#

a view is just a reference to the inevntories involved

ivory sleet
#

yea the name is a maybe a bit misleading but its not a deep snapshot of everything sadly

rough drift
#

well, that's fine I guess

upper hazel
#

how is this possible? "Condition 'section == null' is always 'false'" when i try use it

#

this warning show me when i check null in another class

#

compiler wrong?

eternal night
#

is anything calling that constructor

upper hazel
eternal night
#

Yea then maybe IJ just attempts to be smart

knotty meteor
#

Does someone know where i can download paper 1.19.4 api jar?
And no im not going to use maven

eternal night
#

use gradle ๐Ÿ‘

knotty meteor
#

No

upper hazel
#

lol

eternal night
#

then suffer

knotty meteor
#

I use eclipse

eternal night
#

not using a build system is brain dead

#

completely brain dead

knotty meteor
#

External jars ON TOP

eternal night
#

no

upper hazel
#

Gradle is actually easier but is needed mainly in large projects, although this is a matter of taste

eternal night
#

paper-api is not a single jar

#

it has transitive dependencies

knotty meteor
#

Oowh

eternal night
#

So like, ggwp you'll be downloading like 20-30 jars

knotty meteor
#

;(

river oracle
#

Yeah guys maven sucks

#

Javas build system on top right? Right??

knotty meteor
#

YES

river oracle
#

No you're just ignorant it's okay

knotty meteor
#

I dont like changes i use eclipse with external jars for like 7 years now

eternal night
#

I mean yea, you certainly can.

#

But you'll have to suffer your way there

#

gl with it

knotty meteor
#

๐Ÿ˜ญ

#

Im autistic i know

river oracle
#

You and me both friend but even I use gradle

vital sandal
#

how do I spawn the display entity ?

#

java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.Display

eternal oxide
#

Display is abstract

#

err an interface

#

you can;t spawn an interface, spawn one of the classes that implement it

eternal night
#

(which, its still an inteface but yea, Display.Text would be one)

wraith dagger
#

hi guys is there anyway i can create spigot fork that allow zombie spawn natural at the daytime?

#

today i tried to create spigot fork and i reliszed i can edit everything which in server-side and i want to make a server mob and animal be able to spawn at daytime

#

i know there are method that replace the anime or make a runnable

eager rock
#

Hey guys! What should I use for multi module projects? Maven or Gradle ๐Ÿ™‚

wraith dagger
#

but i think there must be the thing can able to spawn as vanilla system

eternal night
#

pick which one you are more comfortable with

eager rock
#

Thanks! ๐Ÿ˜ƒ

pseudo hazel
#

time of day has actually nothing to do with it

vital sandal
pseudo hazel
eternal oxide
pseudo hazel
#

but usually you would create a display type you want to use anyways

vital sandal
#

hmm

#

most of everything implement it

pseudo hazel
#

i think its just textdisplay, blockdisplay and itemdisplay

vital sandal
#

hmm

#

is it possible to make it rotate with player facing direction

chrome beacon
#

yes

#

That's a flag

pseudo hazel
#

iirc billboard or smth

rough drift
#

can you no longer set air in recipes (1.20.5+)

carmine mica
#

air is not a valid ingredient for any recipe

#

the network codecs will blow up

#

what recipe are you trying to use air with @rough drift ?

rough drift
carmine mica
#

I meant what kind of recipe? what is even the point of having air as an ingredient

#

and yeah, air is not valid anymore

rough drift
#

user-input

carmine mica
#

no what? what kind of recipe, crafting? furnace, smithing? what

rough drift
#

oh, crafting table

#

my bad I'm tired asf ๐Ÿ˜ญ

carmine mica
#

yeah, just don't put air and it'll be fine

rough drift
#

well, need to rework stuff now then

#

ty

#

wait

#

if it is a shaped recipe

#

do I just not set an ingredient?

#

i.e.

#

recipe.shape(" 1 ", " 2 ", " 3 "); (example for demonstrative purposes)

carmine mica
#

yeah, just put a <space> in the shape string

#

yes

#

that's always worked and been the way you are supposed to do it

rough drift
#

Alrighty, I forgot about it

green prism
#

Can you please help me?

java.lang.ClassCastException: class org.bson.Document cannot be cast to class org.bson.Document (org.bson.Document is in unnamed module of loader 'WidenBank-1.0-SNAPSHOT-shaded.jar' @1a4d535c; org.bson.Document is in unnamed module of loader java.net.URLClassLoader @5ed2475d)

(I'm working with my own APIs)

#

?paste

undone axleBOT
green prism
chrome beacon
gentle inlet
#

Anyone got some code or could tell me how i could implement some code so that on right click it throws a pickaxe that mines blocks and damages players I was thinking/hoping to use item display entites

chrome beacon
#

Listen to the interact event
check for pickaxe
spawn item display

every tick:
move item display
check for collision with block/entity with help of a bounding box

#

That's the general code flow

green prism
chrome beacon
#

bson is being shaded

#

from somewhere

#

If you're shading MongoDB that would be why

green prism
#

It's probably from here

chrome beacon
#

since it has bson as dependency

green prism
#

I'm not sure haha

chrome beacon
green prism
#

Yeah, thank you

green prism
# chrome beacon yeah so relocate it

It's the same, even after relocation

java.lang.ClassCastException: class it.mikeslab.widenbank.api.org.bson.Document cannot be cast to class org.bson.Document (it.mikeslab.widenbank.api.org.bson.Document is in unnamed module of loader 'WidenBank-1.0-SNAPSHOT-shaded.jar' @fb2a123; org.bson.Document is in unnamed module of loader java.net.URLClassLoader @30574c12)
    at it.mikeslab.widencommons.api.various.aggregate.AggregatorManager.aggregate(AggregatorManager.java:51) ~[WidenCommons.jar:?]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.5.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
              <configuration>
                  <relocations>
                      <relocation>
                          <pattern>org.bson</pattern>
                          <shadedPattern>it.mikeslab.widenbank.api.org.bson</shadedPattern>
                      </relocation>
                  </relocations>
              </configuration>
          </execution>
        </executions>
      </plugin>
eager rock
#

Hello! I'm trying to do a multi-project and I ran into my first problem.

Cannot set the value of property 'downloadService' of type io.papermc.paperweight.DownloadService using a provider of type io.papermc.paperweight.DownloadService.

    id 'java'
    id 'io.papermc.paperweight.userdev' version '1.7.1'
}

group = 'coma112'
version = rootProject.version

repositories {
    mavenCentral()
    maven {
        name = 'papermc-repo'
        url = 'https://repo.papermc.io/repository/maven-public/'
    }
    maven {
        name = 'sonatype'
        url = 'https://oss.sonatype.org/content/groups/public/'
    }
}

dependencies {
    paperweight.paperDevBundle('1.19.2-R0.1-SNAPSHOT')
}

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
}

tasks.register('prepareKotlinBuildScriptModel')```
#

Anyone? ๐Ÿ˜„

#

I have absolutely no idea what's the problem in the plugin module it's working fine

eager rock
#

idgf tbh I just wanted a simple answer I didn't know that there is a fork wark ๐Ÿ’€

blazing ocean
#

you're asking for paper tooling help in the spigotmc discord

misty ingot
#

is there a way to make a method such that
if i give it, say "&f" or "ยงa" it would return "WHITE" or "GREEN"
(preferably without having a million if statements)

misty ingot
#

well yes but

#

actually i think thats the best way

blazing ocean
#

you could combine ChatColor#translateAlternateColorCodes and ChatColor#getByChar?

misty ingot
#

does #getByChar work only on the ยง?

blazing ocean
#

Gets the color represented by the specified color code

#

would assume

misty ingot
#

hmm lemme test that

#

didnt know we had a #getByChar

blazing ocean
#

would just return null if not possible

#

so you can run it on each char

#

and if it's null, add the original char back in

eager rock
#

Or you could just iterate through all the values of the chatcolor enum class

blazing ocean
#

why do that on each char

misty ingot
#

the thing is lets just say i sort of have a color stored somewhere like ยงf or whatever and i have a button to change said color and that button is a piece of wool but i want the wool to be of the current color, which is why i asked

blazing ocean
#

wools are seperate materials

misty ingot
#

a very small detail but i must implement it to satisfy my brain

#

yes i know ill append the WOOL_ to the string and do Material.valueOf

blazing ocean
#

ah yes, BOLD_WOOL

misty ingot
#

or whatever way WOOL is named

#

well unfortunately im not allowing people to set the colors to BOLD

blazing ocean
#

do you not want strikethrough wools

#

smh

shadow night
eager rock
#
        colorCode = colorCode.toUpperCase().replace('&', 'ยง');

        for (ChatColor color : ChatColor.values()) {
            if (color.toString().equals(colorCode)) return color.name();
        }
        
        return "UNKNOWN";
    }```

Idk if its working
green prism
# chrome beacon yeah so relocate it

I think I'm getting closer to the solution. WidenCommons (the core) actually uses the 'libraries' feature from plugin.yml to get the mongo-driver, which also contains BSON

libraries:
  - "org.mongodb:mongodb-driver-sync:5.0.1"
misty ingot
#

why would i need toUpperCase

green prism
eager rock
#

It should work without it

#

It's just my thingy

misty ingot
#

ive implemented my own piece of code to just test it out real quick

pseudo hazel
#

is it possible to revoke advancements from players that arent online? i have uuid (and the advancement I wanna revoke)

#

I could only find methods on Player

ivory sleet
#

You may have to edit the player data file

#

or compute it lazily once player logs on

pseudo hazel
#

hmm

#

weird

#

how do I edit the player data file

#

and will that work for online players? or do I need both methods (player data file and Player api)

#

I guess revoking it when the player logs in is possible but just kinda annoying

#

its surprising to me that statistics are available for offline players but not advancements..

chrome beacon
#

Remove my.permission from the permissions section

#

You already defined it on your command

worldly ingot
#

PandaThink Well, no, that's just saying that you want to use my.permission for the command. That looks correct

#

Are you defining it anywhere in source as well? via the PluginManager?

#

Or do you have another plugin that also has the "my.permission" defined?

misty ingot
#

whats the best way to check if like a player has a permission mypermission.5 my method returns 5, if they have mypermission.99 it returns 99 and so on

#

even if they have both .5 and .99 it should return 99

shadow night
#

What if bruteforcing or something

misty ingot
#

well thats an obvious way to do it but what if a person enters .999999999

#

im looking for an efficient way

green prism
#

Hello. I have a plugin that uses an API to query a BSON document from a database when requested by another plug-in through the API. The process is asynchronous and uses a CompletableFuture. However, when completing the future through the API, it returns a different class loader (the one the first program loaded), which causes an error. Can you please help me?

java.lang.ClassCastException: class org.bson.Document cannot be cast to class org.bson.Document (org.bson.Document is in unnamed module of loader 'WidenBank-1.0-SNAPSHOT-shaded.jar' @44bec7d5; org.bson.Document is in unnamed module of loader 'WidenCommons-2.3.4.jar' @2bfc24ac)

chrome beacon
#

Don't provide it twice

#

If WidenBank requires WidenCommons then just provide bson it commons

#

and not in bank

#

also do relocate if you're shading

green prism
#

It returns an instance created by a different class loader

chrome beacon
#

that's the problem

#

Now do what I said

dawn flower
#

can u make a player ride a block display

green prism
chrome beacon
#

are you using Paper

#

if not send both of your poms

#

all of it

#

?paste

undone axleBOT
lusty cipher
#

the docs for BlockDropItemEvent say to use getBlockState() to get info on the broken block

#

why does it return a block with type AIR for me

#

or no wait sorry I was calling getBlockState().getBlock() nvm

wraith delta
#

But youโ€™d want to use a interaction entity if itโ€™s clicking required

lusty cipher
#

I have a OfflinePlayer which has never played on my server before, and therefore it has no information besides the UUID. Is there any way I can tell the server to fetch that player?

lusty cipher
#

looks like that is a replacement API for OfflinePlayer? So I should always use that instead where possible?

chrome beacon
#

It's not a replacement

short plover
#

how do you summon an entity in the world without having the server calling the EntitySpawnEvent

chrome beacon
#

It's just a part of the offline player that handles the player profile

lusty cipher
#

for the uuid and name I mean

#

sorry im tired

chrome beacon
#

ie the information about the account

#

you can use it if you want

undone axleBOT
short plover
# chrome beacon ?xy

I wanna spawn an entity that already exists to another location, tried doing that and it crashes the server prob cuz it calls EntitySpawnEvent infinitely

chrome beacon
#

so you're spawning an entity in the spawn event?

short plover
#

yeah like when the entity spawns I wanna spawn it again in another location

chrome beacon
#

so you want to spawn another one?

#

or move the spawned one

#

?

short plover
#

spawn another one

chrome beacon
#

so you'll need a way to track the spawned entity

#

you can attach a PDC to the spawned entity

#

and then break the method if the spawned entity has it

short plover
#

I was just thinking that yeah, thank you

chrome beacon
#

Use the spawn method that takes a consumer to spawn the entity

#

and modify it in the consumer

short plover
#

gotcha

chrome beacon
#

that just ensures the entity is modified before it's spawned

#

instead of spawned and then modified

#

it's good practice when you want to modify the spawned entity

short plover
#

yeah

chrome beacon
#

and in this case required

sage patio
eternal oxide
#

someone who uses gradle. Building EssentialsX with EssentialsX:build -x checkstyleMain -x test
I get one error that halts teh build

dawn flower
#

how do you change the rotation of a group of block displays

#

(a group means they're riding each other)

royal jay
#

I tryed to update a plugin to 1.20.6 however the class "Material" apparently is not in 1.20.6 anymore, how can i replace this class for example by the creation of itemstacks?

chrome beacon
#

It's split

#

Item and Blocks have their own respective class

#

also that should only be in the feature preview builds

#

?

#

not the regular 1.20.6

young knoll
#

Itโ€™s in main, but marked as internal

chrome beacon
royal jay
eternal oxide
#

?paste

undone axleBOT
dawn flower
#

oh wait the rotation is in the transformation?

grim hound
#

or just save it into a Map or a Set

#

with an identity check for equality

#

or maybe not, many solutions ahead

orchid iron
#

are glow colors broken on 1.20.4?

#

i registered a team, added the player name as entry, set the color to something and i set player.setGlowing(true) but the color is still white

echo basalt
#

Do you have the TAB plugin on the server?

minor garnet
#

i have armor stand that is being defined with rotations, but how do I get a vector based on it?

        armorStand.setHeadPose(new EulerAngle(-angle.x, angle.y, angle.z));

        final Vector direction = new Vector(Math.toDegrees(-angle.x), 
Math.toDegrees(angle.y), Math.toDegrees(angle.z)).normalize();

I tried with math.todegress and without
but the direction is not exactly with the rotation pose:

echo basalt
#

An euler angle is made of 3 angles, all in radians

#

X (pitch)
Y (Yaw)
Z (roll)

#

Mess with trig a little bit and you'll get somewhere

#

Start by setting Z to like -90ยบ so it's flat

#

Then rotate Y for your yaw (should be something like atan2(vec.z, vec.x)) and rotate X for your pitch (asin(vec.y)?)

#

something like that

eager rock
# orchid iron i registered a team, added the player name as entry, set the color to something ...
        String playerName = player.getName();
        Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();

        if (isEnabled() && CBounty.getDatabaseManager().isBounty(player)) {
            player.setGlowing(true);

            Team team = scoreboard.getTeam(playerName);
            if (team != null) team.unregister();
            team = scoreboard.registerNewTeam(playerName);
            team.setColor(ChatColor.valueOf(ConfigKeys.GLOWING_COLOR.getString()));
            team.addEntry(playerName);
        }
    }```
#

try this

minor garnet
echo basalt
#

Ah you want the opposite

#

yeah that just needs math

minor garnet
#

ye

night gorge
#

Oh

#

So you want to convert from pitch and yaw to a normal vector of the same angle?

minor garnet
#

does the roll value in the headpose also influence the vector?

#

i think yes..

night gorge
#

E.g. if you have pitch = 0 and yaw = 90, you want a Vector of (-1, 0, 0) for example

minor garnet
#

yes but i my euler angles it also has the roll value, now I dont know if this influences its rotation, for example

night gorge
#

Nope, however, what is the roll for?

minor garnet
night gorge
#

Are you trying to get it to rotate like a player head would?

minor garnet
#
    public Vector eulerAnglesToVector(final EulerAngle angle) {
        double pitch = angle.getX();
        double yaw = angle.getY();

        double pitchRad = Math.toRadians(pitch);
        double yawRad = Math.toRadians(yaw);

        double x = -Math.cos(pitchRad) * Math.sin(yawRad);
        double y = -Math.sin(pitchRad);
        double z = Math.cos(pitchRad) * Math.cos(yawRad);

        return new Vector(x, y, z);
    }```
#

no, I just want to transform the head pose rotation of an armor stand to a vector direction

graceful stream
#

Guys im playing on a MC server with a backpack plugin. I put some important items in the backpack and they despawned. After trying for a while i discovered that its actually possible to dupe items with this backpack. Sometimes the items despawn and sometimes they duplicate, there is a pattern but since im not a developer its not easy to find the patern. Any smart developer down to help? I can pay.

night gorge
#

I think I get you, but what I mean is that when you rotate armour stand heads, they don't rotate the same way player heads do

#

I came across the same issue a couple days ago, I'll share the solution with you

#

Lemme find the code

analog mantle
minor garnet
night gorge
#

Mhm

#

My solution was to use the Armour Stand's position yaw rather than its head yaw, but continue using the head pitch. That way it lines up properly

#

To influence its position yaw, you'll have to use .teleport

minor garnet
#

wait

#

but what about the head rotation, thats what I need,

night gorge
#

Does the head have to be yaw-rotated separate to the rest of the body or nah?

analog mantle
#

@graceful stream

minor garnet
night gorge
minor garnet
#

you mean the ''head pose'' or the location.getYaw? if you mean the location yaw, pitch is always 0

night gorge
#

I mean is the location.getYaw necessary for aesthetics

minor garnet
#

no

night gorge
#

Cool beans

#

My solution can work then c:

#
public void armorStandFace(ArmorStand armorStand, float yaw, float pitch) {
    Location armorStandLoc = armorStand.getLocation();
    EulerAngle headPose = armorStand.getHeadPose();

    // Yaw
    armorStandLoc.setYaw(yaw);
    armorStand.teleport(armorStandLoc);

    // Pitch
    headPose = headPose.setX( Math.toRadians(pitch+90) );
    armorStand.setHeadPose(headPose);
}
#

There ye go @minor garnet

#

It sets the armour stand's look direction by changing its head's pitch but its body's yaw. This way it'll rotate like you expect it would

night gorge
#

Hopefully that helps a bit c:

night gorge
#

Sorry for all the math yap :3

minor garnet
night gorge
#

Alrighty

minor garnet
#

basically I have converted a quaternion to euler angles, but I needed to get the rotation direction vector that the armor stand had,
and yes I can directly use the quaternion for this, but I needed to find out how to get the direct rotation vector of the head from the armor stand head pose

night gorge
#

Ah, I have no understanding of quaternion mathematics, sorry ><

analog mantle
#

thats what i use

#

yaw & pitch are just regular degrees

night gorge
analog mantle
#

i got it from MC source code so kinda weird

minor garnet
#

yeah i think is not woring

night gorge
#

Ahh the compiler probably did that then :P

analog mantle
#

Why would it do that?

minor garnet
night gorge
# analog mantle Why would it do that?

For optimisation. The code inside Math.toDegrees is pretty simple and it can just take the internal code from there and inline it into the calling function. That way a small bit of processing power is saved from function calling

minor garnet
#

I need the direction of the head so I can use it in mathematics that I have to get the center

slender elbow
#

the runtime might but javac certainly doesn't do any optimisations beside constant folding which is very pepega

#

but also that's translating to radians, not degrees :p

analog mantle
#

That's not what it does

night gorge
#

Ahh

#

Sorry

#

I assumed Java's compiler did inlining optimisations

analog mantle
#

What does this mean to you?
INVOKESTATIC java/lang/Math.toDegrees (D)D

night gorge
#

Yeah

#

I just checked

analog mantle
#

this is just some simple bytecode.

night gorge
#

Yes, I already found that out

minor garnet
#

๐Ÿ˜’

analog mantle
#

3 lines lol

night gorge
nova notch
#

no more public static void main???

slender elbow
#

no more public class main public static void main string args

nova notch
#

holy hell

young knoll
#

I mean the bytecode would look the same on basically any java version

analog mantle
#

No public class Main either

young knoll
#

You can still use it if it makes you feel better

analog mantle
#

why would you not be able to use it? that's dumb lol

drowsy helm
#

you can still use it

#

you just have the option to not

analog mantle
#

The shortcut is only implemented to make learning Java much more clear

#

psvm is the first thing a new learner sees

#

it may seem complicated.. you get the point i'm tryna make

golden basin
#

i wanted to create a custom item which is a dagger. i want its durability to be half of an iron sword. i used this is.setDurability((short) 125); but its not working. can anyone help pls?

dim frost
#
protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.STEER_VEHICLE) {
            @Override
            public void onPacketReceiving(PacketEvent event) {
                PacketContainer packet = event.getPacket();
                float ws = packet.getFloat().read(1);
                float ad = packet.getFloat().read(0);
                boolean jump = packet.getBooleans().read(0);
                boolean shift = packet.getBooleans().read(1);
                UUID id = event.getPlayer().getUniqueId();

                if(ws > 0) fire(ControlKey.W, id);
                if(ws < 0) fire(ControlKey.S, id);
                if(ad > 0) fire(ControlKey.D, id);
                if(ad < 0) fire(ControlKey.A, id);
                if(jump) fire(ControlKey.JUMP, id);
                if(shift) fire(ControlKey.SHIFT, id);
            }

            public void fire (ControlKey key, UUID id) {
                Bukkit.getPluginManager().callEvent(new ControlKeyEvent(key, id));
            }
        });

(Please dont mind the multiple stupid looking if statements, its temporary but feel free to improve it)

#
java.lang.IllegalStateException: ControlKeyEvent may only be triggered synchronously.```
#

And I am not aware how to sync threads

#

Can someone help :(
[Im a rookie in java and barely started with bukkit..]

young knoll
#

Wrap it in Bukkit.getScheduler.runTask

dim frost
#

Can you explain what that does?

#

Ill just add I actually want to learn how the error came to be and visualize the issue

#

if someone is free enough to do that..

dim frost
young knoll
#

It calls it on the main thread at the start of the next tick

dim frost
#

So it basically syncs it?

young knoll
#

Yes

dim frost
#

Btw so is the packet on a different thread?

young knoll
#

Alternatively you can make your event async by passing true to the super constructor

young knoll
dim frost
#

(Im trying to learn threads but very confused from all the different things on net)

dim frost
#

Or just some part of it, if so

#
Bukkit.getScheduler().runTask(this, new BukkitRunnable() {
            @Override
            public void run() {
                protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.STEER_VEHICLE) {
                    @Override
                    public void onPacketReceiving(PacketEvent event) {
                        stuff
                    }
                });
            }
        });
#

Is this how it is supposed to be done?

young knoll
#

Just the part that calls the event

dim frost
#

Ohhh

#

Thanks ill test that

#
public void fire (ControlKey key, UUID id) {
                Bukkit.getScheduler().runTask(Pets.getInstance(), () -> Bukkit.getPluginManager().callEvent(new ControlKeyEvent(key, id)));
            }
```?
dim frost
#
@EventHandler
    public void onControlKeyTrigger(ControlKeyEvent e) {

        Objects.requireNonNull(Bukkit.getPlayer(e.getPlayerUUID())).sendMessage(e.getKey().name());

        PetFrame pet = Pets.getInstance().checkPetRider(e.getPlayerUUID());
        if(pet == null) return;

        if(e.getKey().equals(ControlKey.W)) launch(pet);
    }

    private void launch(PetFrame pet) {
        Vector v = pet.getInteraction().getLocation().getDirection().normalize().multiply(2);
        pet.getInteraction().setVelocity(v);
        pet.getModel().setVelocity(v);
        Bukkit.getPlayer(pet.getPlayerUUID()).sendMessage("Launched!");
    }
#

Intentions

  • Send player the control key that is pressed (Works)
  • Launch the pet some 2 blocks away [It sends the message "Launched!" but doesnt actually do anything to the entity's velocity]
#

Issue being ^

#

In this case the interaction's face is being used as the base of movement regardless of where or what the display item is facing

#

(getModel is an item display) (getInteraction is an interaction entity)

dim frost
#

Another question, whats the packet that handles INTERACT?

mortal hare
#

unpopular opinion, notch is not the power which powered minecraft success

#

notch stepped down from development of minecraft since the release of 1.0

blazing ocean
mortal hare
#

so actually its jeb's and other developers efforts (dinnerbone) that really took minecraft to another level of popularity

granite cloud
#

i have added cmi plugin when a person sends tpa request it is demading 50money i see whole config file i am not able to find config to change this

tall dragon
#

im working on a few different projects with 1 other developer. these projects depend on eachother and are private. does any1 know of any affordable solutions for hosting these artifacts online but also like private. i know about sonatype nexus. but i was wondering if there is anything more affordable out there. i coulnt find anything

eternal night
#

Any cheap VPS should be enough to handle reposlite

tall dragon
#

well i thought about it. but from what i can read online nexus might need a pretty powerfull machine with quite a bit of ram

#

i might be wrong tho

#

oh what is reposlite

eternal night
#

Lightweight and easy-to-use repository manager for Maven based artifacts in JVM ecosystem.

tall dragon
#

i see, i haven't looked at that one yet. i'll see if i can get this one up and running thanks

dim frost
#

*Deleted some messages because I found the solution

tall dragon
dim frost
#

@young knoll are you available? I have some issues in code if you can help

#

sorry to disturb

blazing ocean
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

dim frost