#help-development

1 messages · Page 1049 of 1

kindred sentinel
#

(I used winrar)

eternal oxide
#

its 100% not empty in resources?

kindred sentinel
#

in resources it's 0 kb

eternal oxide
#

then fix it. your original is bad

kindred sentinel
eternal oxide
#

delete jar and build again

#

do not build with server running

kindred sentinel
#

Yeah I did

#

but it's still empty

eternal oxide
#

remove teh maven jar plugin and test without it

kindred sentinel
eternal oxide
#

delete teh profile section from your pom

kindred sentinel
#

like without profile?

#

Still empty

eternal oxide
#

that makes no sense at all

kindred sentinel
#

Well

#

yeah

eternal oxide
#

I've done .nbt file packaging and Schematics myself

#

you got no errors in the mavan logs during building?

kindred sentinel
eternal oxide
#

if you deleted the profile section and are not using filtering of resources your .nbt should be fine. Even if you were filtering it would be corrupt but not empty

kindred sentinel
#

._.

#

Well

#

It's just empty

eternal oxide
#

filtering causes the .nbt file to have a corrupt header identifier byte

kindred sentinel
#

Well it's 0 kb

eternal oxide
#

an empty .nbt file makes no sense, unless you have a messed up file structure for your project and are really looking at the wrong location

kindred sentinel
#

I oppened it using note

eternal oxide
#

show the full project structure

chrome beacon
#

You could put the entire project on github

#

and let us take a look

kindred sentinel
#

wait..

#

for some reason saveResource() doesn't work

#

the folder appears only because of new File(plugin.getDataFolder(), "Schematics/Electricity.nbt")

eternal oxide
#

use saveResource(path, true)

#

so it replaces

kindred sentinel
#

Still doesn't appears

#

I commented the code of new File()...

#

and the folder, file doesn't really appears

kindred sentinel
#

OH

#

I did something

#

and it works

#

For some reason the problem was in the path

#

Like this it works without errors

glad shore
#

java.lang.IllegalArgumentException: Cannot find net.minecraft.server.v1_20_R3.PacketPlayInUseEntity

Hello - any ideas on that?

halcyon hemlock
#

otherwise you won't be able to access nms

halcyon hemlock
glad shore
#

(1.20.4)

quaint mantle
#

How can I order the teams tab?

quiet ice
glad shore
quiet ice
#

Since the path delimiter in jar files is /

kindred sentinel
quiet ice
halcyon hemlock
#

yeah

#

stupid idea

#

and ugly

quiet ice
#

from what I have heard, this may sometimes cause issues on certain OSes like Windows - although that is not something I have seen yet.
Regardless, you might want to look at the compiled jar file and look whether all files are at the place where they should be

halcyon hemlock
#

windows dont care about capital letters

#

but unix and linux does

tardy delta
#

windows does?

wet breach
#

actually has to do with the FS

#

the case insensitivity goes back to MS-DOS days and is one of the primary things touted in making windows easier to use

#

in the original FAT filesystem, file names and extensions are stored as all uppercase making it case insesitive however not case preserving

#

since then its been improved but the defining feature of being case insensitive has remained in all versions of windows

kindred sentinel
wet breach
#

since linux doesn't do anything in regards to the upper and lowercase characters, they are just treated as being different since they are different in terms of character points

#

and that concludes historical history

tardy delta
#

wouldnt powershell Get-Content care about the casing of the filename?

#

i dont use windows so cant tell

wet breach
#

don't see why it would

#

get-content gets the content of files

#

whether its textual or binary

#

as for the name of the file and its path, the casing doens't matter because of how the FS stores references to it as well as the OS being programmed to treat upper and lower casing as being the same character

tardy delta
#

didnt know that was the case on windows

silent slate
#

I'm new to NMS, how do I use the USE_ITEM packet to detect which item the player is currently right clickng with?

glad shore
#
package net.minecraft.network.protocol.game;

import java.util.function.Function;
import javax.annotation.Nullable;
import net.minecraft.network.PacketDataSerializer;
import net.minecraft.network.protocol.Packet;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.EnumHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3D;

public class PacketPlayInUseEntity implements Packet<PacketListenerPlayIn> {

    private final int entityId;
    private final PacketPlayInUseEntity.EnumEntityUseAction action;
    private final boolean usingSecondaryAction;
    static final PacketPlayInUseEntity.EnumEntityUseAction ATTACK_ACTION = new PacketPlayInUseEntity.EnumEntityUseAction() {
        @Override
        public PacketPlayInUseEntity.b getType() {
            return PacketPlayInUseEntity.b.ATTACK;
        }

        @Override
        public void dispatch(PacketPlayInUseEntity.c packetplayinuseentity_c) {
            packetplayinuseentity_c.onAttack();
        }

        @Override
        public void write(PacketDataSerializer packetdataserializer) {}
    };
    
    ...

}

java.lang.IllegalArgumentException: Cannot find field with type interface net.minecraft.network.protocol.game.PacketPlayInUseEntity$EnumEntityUseAction

Any ideas on that?

chrome beacon
#

??

#

what are you trying to do

worldly ingot
#

Yeah... that's just NMS lol

worldly ingot
#

Which is called in the player's packet handler

#

You can use Player#getItemInUse() to get what item is currently being used

green prism
#

How can I prevent a timerTask from being executed or called after the plugin has been disabled? I always get that error on reload

#

"Plugin attempted to register task while disabled"

green prism
sand spire
eternal oxide
#

you can't start a task in onDisable

green prism
eternal oxide
#

if it's under teh Bukkit scheduler you can ignore it

#

it will be stopped by the scheduler

green prism
#

Yeah but it throws an exception

green prism
eternal oxide
#

show some actual code. just a task running will not throw a can;t register error

sand spire
#

Maybe you don't get an exception if you use /stop instead of /reload

green prism
green prism
eternal oxide
#

even a task timer will not throw a can;t register error on relaod

#

show actual code

sand spire
eternal oxide
#

That code will not throw teh error you are saying

green prism
#

lmao, it's not flagging anymore

#

thank you anyway

glad shore
silent slate
hard socket
#

the evet is not getting fired when I hit as

#

works with pig tho

worldly ingot
#

You showed us an NMS class

glad shore
#
public class PacketListener {

    private final Class<?> packetPlayInUseEntityClazz = Reflections.getNetworkClass("PacketPlayInUseEntity");
    private final Class<?> enumEntityUseActionClazz = Reflections.getNetworkClass("PacketPlayInUseEntity$EnumEntityUseAction");
    private final Class<?> packetPlayOutMapClazz = Reflections.getNetworkClass("PacketPlayOutMap");

    private final FieldAccessor<Integer> entityIdField = Reflections.getField(packetPlayInUseEntityClazz, "a", int.class);
    private final FieldAccessor<?> interactTypeField = Reflections.getField(packetPlayInUseEntityClazz, "action", enumEntityUseActionClazz);
    private final FieldAccessor<Integer> mapIdField = Reflections.getField(packetPlayOutMapClazz, "a", int.class);

...
#
public static Class<?> getNetworkClass(String name) {
        return getCanonicalClass("net.minecraft.network.protocol.game" + "." + name);
    }
#

There u can find the code

blazing ocean
#

that doesn't explain anything

#

if you just send some random reflection accessors

kindred sentinel
#

I changed the register case of some folders, like "Schematics" to "schematics", and trying to package it, but the files still has the same case, and code doesn't, so my code doesn't work how to update case?

glad shore
#

Its for cancling you to break the frames

eternal oxide
#

why not just cancel teh hanging event?

#

you don;t need nms for that

sand spire
# silent slate yeah, but how do i get the ItemStack from the PacketEvent
@Override
    public void onPacketReceive(PacketReceiveEvent event) {
        if (event.getPacketType() != PacketType.Play.Client.USE_ITEM) return;
        if (!(event.getPlayer() instanceof Player player)) return;
        WrapperPlayClientUseItem packet = new WrapperPlayClientUseItem(event);

        ItemStack itemStack = player.getEquipment().getItemInMainHand();
        if (packet.getHand() == InteractionHand.OFF_HAND) {
            itemStack = player.getEquipment().getItemInOffHand();
        }
    }```
#

or just use PlayerInteractEvent

sleek estuary
#

https://paste.md-5.net/igodusaful.cs

Inside the block that checks if the player has the 'break.admin' permission I reuse the cupboard variable that was previously allocated a value and will no longer be used. Should I do this or create a new variable inside this block?

kindred sentinel
#

How to place the structure without any random? Like Structure.place() uses some random parametres, but I don't need any Random

glad shore
#

So I kinda fixed it - for some reason it is not "action" - but "b" - how do I know that its b?
I used BuildTool and it says: private final PacketPlayInUseEntity.EnumEntityUseAction action; -> action, not "b".

It found it out via getDeclaredFields()

kindred sentinel
#

Do you use remapping?

charred blaze
#

where do i check the list of data the player seonds to the server?

safe furnace
#

Hello guys, How can I connect minecraft server database to my own website. I mean I started with html. But I want to show like Player Stats on servers or playtime, Login System BUT with in-game nickname and password. Also and skin of the player (you know what I meant, Like if it's cracked to show Steve, and if it's premium to show their own skin) Anyone can give me ideas how can I make that?.

charred blaze
#

i want to check something

young knoll
#

Well you can get up from the Player object

kindred sentinel
#

The structure doesn't spawn

safe furnace
young knoll
#

Believe it’s #getAddress

kind hatch
young knoll
kindred sentinel
#

oh

#

maybe

kindred sentinel
safe furnace
#

I mean I know Html css and I created website

glad shore
safe furnace
#

But php, i have no clue.

kindred sentinel
kindred sentinel
echo basalt
#

Use java spring or jetty to make a rest server

blazing ocean
#

php concern

#

javalin is good too

echo basalt
#

then make your website query that rest server

#

and use the returned into and display it

safe furnace
kindred sentinel
#

Yeah

echo basalt
#

it just means you're trying to make something bigger than what you can

#

(learn before you try)

safe furnace
#

I know, doesn't mean i can't find one

kindred sentinel
#

No error, no exception, no problem with packaging

young knoll
#

Change I to 1

#

Actually no, v should be 1

kindred sentinel
#

Oh

#

with v

#

it works

#

thanks

#

Finally I understood how to make the basic things that I wanted 😢

#

But I still need some api to create npcs. Is there any API to create npcs? I don't wanna have a deal with nms

young knoll
#

Citizens has an api

kindred sentinel
#

I guess it's not free

#

Yeah, it's not

young knoll
#

They publish builds for free

#

If you know where to look

kindred sentinel
eternal oxide
#

or build it yourself

young knoll
#

Read the resource page

#

It’s in like the first paragraph

kindred sentinel
#

oh

#

fr

sage patio
#

any idea why?

blazing ocean
#

you want the kyori one

#

what is the issue here

#

also

#

you do want the adventure bukkit platform

sage patio
#

ow it has a different one for bukkit?

blazing ocean
# sage patio

also, import those static methods as that will make it way more readable

blazing ocean
#
sage patio
blazing ocean
sage patio
#

import what?

blazing ocean
#

the methods like text("")

#

so you don't have to type Component.text("") every time

sage patio
#

ow

#

yea thanks

blazing ocean
#

because this makes it way more readable

silent slate
#

huh

young knoll
#

I assure you they do

silent slate
#

nah, imma do it this way, i already tried it

#

pointing to this

#
public static void registerLib(Plugin plugin) {
        ProtocolManager manager = ProtocolLibrary.getProtocolManager();

        manager.addPacketListener(new PacketAdapter(plugin, PacketType.Play.Client.USE_ITEM) {
            @Override
            public void onPacketReceiving(PacketEvent event) {
                if (event.getPacketType() != PacketType.Play.Client.USE_ITEM) return;
                Player player = event.getPlayer();
                ItemStack currentItemStack = player.getItemInUse();
                if(player.getWorld().getName().equals("lobby")) {
                    if(currentItemStack.getItemMeta().getDisplayName().equals(ChatColor.GOLD + ChatColor.BOLD.toString() + "GAME SELECTOR")) {
                        Inventory navigatorInv = GUIUtils.getCompassInv();
                        player.openInventory(navigatorInv);
                    } else if(currentItemStack.getItemMeta().getDisplayName().equals(ChatColor.AQUA + ChatColor.BOLD.toString() + "MENU")) {
                        Inventory inventory = Bukkit.createInventory(null, 54, ChatColor.AQUA + "TestMenu");
                        Inventory menuInv = GUIUtils.getLobbyCosmeticInventory(inventory, event.getPlayer().getUniqueId());
                        event.getPlayer().openInventory(menuInv);
                    }
                }
            }
        });
    }
eternal oxide
#

you don't have protocolLib on yoru server

silent slate
#

now i do and it still isnt executing

#

when i click into the air with the compass nothing happens

green prism
# eternal oxide you don't have protocolLib on yoru server

Hey ElgarL,
I've encountered an issue where my inventory caches are twisted/intertwined. As a result, the Plugin#initInventories (that firstly loaded them) method does not clear the cache properly unless the entire plugin is reloaded.
Would it be acceptable to avoid spending hours troubleshooting this and instead just handle a language reload when executing /myplugincommand reload?
Btw, I would inform users with a message like "To update your inventories, you need to restart the server or reload the plugin"
What do you think about this amazing approach?

shadow night
#

is this a band aid solution

eternal oxide
#

sounds like it

#

your cache shoudl store in a static (whatever)

shadow night
#

singleton or something

eternal oxide
#

a cache shoudl only ever store reuseable instances

#

clearing a cache should be as simple as object.clear()

shadow night
eternal oxide
#

I have a finger/angle of keyboard problem

shadow night
#

understandable

green prism
# eternal oxide a cache shoudl only ever store reuseable instances

Well, a GuiConfigRegistrar instance is recreated on /mypl reload. However, when the PlayerJoinEvent calls an instance.getGuiConfigRegistrar().getPlayerInventories() on join, the data inside is the same as before...

On reload & init

        this.guiConfigRegistrar = new GuiConfigRegistrar(
                this,
                this.getCustomConfig().getConfiguration().getConfigurationSection(Section.GUIS.getFieldName())
        );

        this.guiConfigRegistrar.register();

(And I've already tested, configSection is up-to-date)

On-Join

        Bukkit.getScheduler().runTaskLater(instance, () -> {
                    instance.getGuiConfigRegistrar()
                            .getPlayerInventories()
                            .getInventory(targetUUID, fallBackIdentifier)
                            .show(target);
                }, 1L);

GuiConfigRegistrar constructor

    public GuiConfigRegistrar(IdentityPlugin instance, ConfigurationSection section) {
        this.instance = instance;
        this.section = section;

        this.playerInventories = new SetupMap(instance); // (!This should reset it!)

        this.inputMenuLoader = new InputMenuLoader(instance);
    }
#

(Sorry for the long message, but it was a few lines of code for each class)

kindred sentinel
#

How to get permission of the command? Like I want to know if the player has permission when executes whatever command. I used something like

    @EventHandler
    public void onPlayerCommand(PlayerCommandPreprocessEvent event){
        String command = event.getMessage().substring(1).split(" ")[0];
        PluginCommand pluginCommand = Bukkit.getPluginCommand(command);
        if(pluginCommand == null || pluginCommand.getPermission() == null || !event.getPlayer().hasPermission(pluginCommand.getPermission())){
            event.getPlayer().sendMessage("§7Unknown command");
            event.setCancelled(true);
        }
    }

but Bukkit.getPluginCommand(command) is always null

eternal oxide
green prism
# eternal oxide why are you passing an instance and a Section?, then using instance to read a ne...

Well, initInventories (which contains the first piece of code I sent before) is executed after reload. This correctly happens since the System.out prints the newest value correctly. Passing that section means passing an updated one

Reload method:
https://paste.md-5.net/ewaleyugap.cs

initInventories method (works, just doesn't clear the cache when re-executed)
https://paste.md-5.net/uvofehojux.cpp

green prism
tardy delta
#

cuz they are lunatics

eternal oxide
green prism
blazing ocean
green prism
blazing ocean
#

i meant not

hybrid spoke
hybrid spoke
green prism
hybrid spoke
#

germania?

green prism
#

italy

#

btw

real lagoon
#

Pizza, mafia and mandolino

hybrid spoke
#

you forgot pasta

#

👌

real lagoon
#

And pineapple

hybrid spoke
#

ew

green prism
green prism
green prism
real lagoon
real lagoon
#

But I enjoy drugs

#

Anyway

#

How are you guys?

green prism
#

exhausted, wbu

real lagoon
#

Nicen't

shadow night
#

what

hybrid spoke
real lagoon
real lagoon
hushed scaffold
#

was org.bukkit.Material removed in 1.20.6? seems to not exist on a 1.20.6 project but on a .2 project it does exist?

real lagoon
#

And the jdk to 21

hushed scaffold
chrome beacon
#

yeah

green prism
#

nothing worked due to this

hybrid spoke
tardy delta
#

schedule it as a sync task

hybrid spoke
#

just ban them instead

#

should fix the issue

eternal oxide
#

ban doesn;t kick

tardy delta
#

you still need to kick em or they stay

green prism
green prism
green prism
kindred sentinel
#

How to create dimension?

hybrid spoke
#

int[][]

silent slate
#

why is this not working?? when i right click it doesnt work

hybrid spoke
#

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

silent slate
#
@Override
            public void onPacketReceiving(PacketEvent event) {
                if (event.getPacketType() != PacketType.Play.Client.USE_ITEM) return;
                Player player = event.getPlayer();
                ItemStack currentItemStack = player.getItemInUse();
                if(player.getWorld().getName().equals("lobby") && currentItemStack != null) {
                    if(currentItemStack.getItemMeta().getDisplayName().equals(ChatColor.GOLD + ChatColor.BOLD.toString() + "GAME SELECTOR")) {
                        Inventory navigatorInv = GUIUtils.getCompassInv();
                        player.openInventory(navigatorInv);
                    } else if(currentItemStack.getItemMeta().getDisplayName().equals(ChatColor.AQUA + ChatColor.BOLD.toString() + "MENU")) {
                        Inventory inventory = Bukkit.createInventory(null, 54, ChatColor.AQUA + "TestMenu");
                        Inventory menuInv = GUIUtils.getLobbyCosmeticInventory(inventory, event.getPlayer().getUniqueId());
                        event.getPlayer().openInventory(menuInv);
                    }
                }
            }

silent slate
hybrid spoke
kindred sentinel
hybrid spoke
#

we have no idea what you want to achieve

#

whats happening

#

what you expect

kindred sentinel
#

You can use PlayerInteractEvent lol

silent slate
#

NOO

young knoll
#

getItemInUse is not what you think it is

silent slate
#

I already debugged it

#

what is it?

river oracle
hybrid spoke
silent slate
#

ive now changed it to getInventory.getItemInMainHand

slender elbow
#

now your code will break if the compass is on the secondary hand :^)

#

thank god the event has this information 🙏

hybrid spoke
silent slate
#

changed it and still doesnt work

#

no errors, nothing

hybrid spoke
#

updated code?

silent slate
#

only changed line

ItemStack currentItemStack = player.getInventory().getItemInMainHand();

silent slate
#

well too bad this doesnt work

#
if(event.getItem() != null) {
            if(event.getItem().getItemMeta().getDisplayName().equals(ChatColor.GOLD + ChatColor.BOLD.toString() + "GAME SELECTOR")) {
                if(event.getPlayer().getInventory().getItemInMainHand().getType() == Material.COMPASS) {
                    Inventory navigatorInv = GUIUtils.getCompassInv();
                    event.getPlayer().openInventory(navigatorInv);
                }
            } else if(event.getItem().getItemMeta().getDisplayName().equals(ChatColor.AQUA + ChatColor.BOLD.toString() + "MENU")) {
                Inventory inventory = Bukkit.createInventory(null, 54, ChatColor.AQUA + "TestMenu");
                Inventory menuInv = GUIUtils.getLobbyCosmeticInventory(inventory, event.getPlayer().getUniqueId());
                event.getPlayer().openInventory(menuInv);
            }
        }

slender elbow
#

don't compare display names, use pdc to identify custom items

#

?pdc

silent slate
#

nah

kindred sentinel
hybrid spoke
#

tells solution which would fix the problem - "nah"

river oracle
#

using display name is quite idiotic imho

silent slate
#

this doesnt fix it

#

even if i set the displayName to a simple string and rename the item, it doesnt work

#

this "solution" is an unneccesary overcomplication

hybrid spoke
#

yeah no shit sherlock, probably its not the exact same name

#

therefore your code does not run

#

therefore use PDC

silent slate
#

mhh

hybrid spoke
slender elbow
#

I love the part where you ask for help but also dismiss it

#

good luck lol

silent slate
#

would be pretty emberassed saying that

hybrid spoke
#

XD

silent slate
hybrid spoke
#

i agree with emily, good luck tho

slender elbow
#

except it isn't shit

silent slate
#

ChatColor.AQUA + ChatColor.BOLD.toString() + "MENU"

slender elbow
#

your code is, however, given it doesn't work

silent slate
#

there is a item given to the player upon joining the server

#

dont care what is standard or not

hybrid spoke
silent slate
kindred sentinel
# silent slate this doesnt fix it

Just try debugging lol,

plugin.getLogger().info(event.getItem().getItemMeta().getDisplayName());
plugin.getLogger().info(event.getItem().getItemMeta().getDisplayName().equals(ChatColor.GOLD + ChatColor.BOLD.toString() + "GAME SELECTOR"));
plugin.getLogger().info(event.getPlayer().getInventory().getItemInMainHand().getType());```
etc..
hybrid spoke
silent slate
kindred sentinel
#

to understand in which case something breaks

silent slate
#

imma debug the named now

#

and show that they are in fact the same

kindred sentinel
#

but equals is false or true?

silent slate
#

or just accept that i wont

hybrid spoke
#

don't need to -> shouldn't

silent slate
#

not main language -> dont care about ur oppinion

hybrid spoke
#

no idea -> what you just said

silent slate
#

not able to read then

#

or dont want to understand

hybrid spoke
#

its funny how you degraded yourself in just a second

#

imma dip

kindred sentinel
#

Just chill out, or go dm if you want to have an argue, wth are you doing it here?

silent slate
#

bruh

silent slate
slender vortex
#

pls help i cant punch with hand or sword and when i hold normal item the crit bar loads long

tough parcel
#

i was just reading and is there any alternative to pdc for 1.8.8?

kindred sentinel
#

Be polite

silent slate
#

and being called basically an idiot when not doing it

kindred sentinel
silent slate
#

Goksi, grow up please

#

ur just showing us you havent passed the age limit for discord yet

hybrid spoke
#

damn someone stood up with the wrong leg today

silent slate
#

cant happen 2 u

#

wont continue this

#

dont wanna get in trouble, but i could say soo much rn

kindred sentinel
silent slate
#

thats why im not continuing

hybrid spoke
#

we dont need that behaviour here

blazing ocean
silent slate
#

says the one bascially calling me an idiot because i wont use pdc

hazy parrot
kindred sentinel
blazing ocean
#

🤷 i use the command map/a command framework

silent slate
#

or i need a new account

blazing ocean
silent slate
#

should doesnt mean must

#

and i declined

blazing ocean
#

i mean

silent slate
#

politely

#

multiple times

hybrid spoke
blazing ocean
#

if you compare by displayname and you make one small typo you're gonna be sitting there debugging for hours, they're not final and can be changed easily (e.g. via an anvil), make no sense to do, and litearlly just why

silent slate
#

wont explain myself and frankly dont need to

hybrid spoke
blazing ocean
silent slate
hybrid spoke
#

ah yes where you could just change every settings and deactivate it completely lol

blazing ocean
silent slate
#

nah remove the part of the code, because i know thats not the cause of the error

blazing ocean
#

using nms for that makes zero sense and is just stupid

silent slate
#

and then add it later

silent slate
kindred sentinel
#

Is there a way to get vanilla command by it's name? Like command /plugins or command /stop /reload etc

kindred sentinel
blazing ocean
#

Bukkit#getCommandMap

kindred sentinel
blazing ocean
#

what version are you developing for

kindred sentinel
#

1.20.1

shadow night
#

Sir

#

You need reflection

kindred sentinel
#

Maybe CommandAliases?

hazy parrot
#

Don't you need reflection ?

shadow night
blazing ocean
#

paper thing then kekw

kindred sentinel
#

what's reflection?

blazing ocean
hybrid spoke
kindred sentinel
#

._.

shadow night
#

Does reflection count as basic java

hybrid spoke
blazing ocean
#

imagine using reflection

hybrid spoke
shadow night
blazing ocean
#

wrong emoji

violet blade
#

if this keep happening even with a clean reinstall it means its not my fault anymore? 😭

blazing ocean
#

clear your ~/.m2

violet blade
#

already did

blazing ocean
#

looks like something is corrupting your jars then

shadow night
kindred sentinel
hybrid spoke
blazing ocean
#

listen man

remote swallow
#

ASHCTUALLY

shadow night
#

For me deleting .m2 would be tragic

blazing ocean
#

i use paper on my servers

hybrid spoke
blazing ocean
#

(a custom paper fork akshually)

#

poor dappercat

#

poor cat ^

violet blade
hybrid spoke
shadow night
kindred sentinel
# remote swallow uhm

May you help me pls? How to get vanilla commands by it's name? Like command reload, plugins, help, etc

remote swallow
#

command map

hybrid spoke
shadow night
kindred sentinel
shadow night
#

But, actual vanilla commands are not in the command map

remote swallow
#

reflection

kindred sentinel
#

how to use it?

shadow night
kindred sentinel
#

so how to block them?

blazing ocean
#

why is System.getenv nullable and throw an exception when it's null

#

wtf

#

o7 pink name

violet blade
#

can i uhhh, unmaven a plugin?

blazing ocean
#

what 😳

hybrid spoke
shadow night
blazing ocean
#

do you wanna use gradle (my beloved ❤️) instead

violet blade
#

rewrite it to use gradle

shadow night
violet blade
#

cuz im a great maven nojoyer

hybrid spoke
#

you can just change the build system and change it manually

icy beacon
blazing ocean
#

based

hybrid spoke
#

but there is no way to switch it automatically

blazing ocean
violet blade
icy beacon
#

NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

shadow night
#

Pink era is gone

hybrid spoke
blazing ocean
icy beacon
#

british gradle

#

gradle innit

shadow night
#

Lol

violet blade
shadow night
hybrid spoke
shadow night
blazing ocean
#

no point

hybrid spoke
#

i would star it

shadow night
#

Sounds pretty doable

hybrid spoke
shadow night
#

Besides marvin plugins

hybrid spoke
#

but shouldnt be too hard actually

#

the process is always the same

#

except when some gradle users have custom code in their build configs

shadow night
# shadow night Besides marvin plugins

Well, I can add some hardcoded behaviour when it comes to those, like when the shade plugin is used I add the shadow plugin and configure some stuff if needed

icy beacon
#

what the fuck is a marvin

shadow night
#

maven

icy beacon
#

oh

violet blade
#

already failed the first step, im doomed

shadow night
#

lmao

hazy parrot
#

.kts please

hybrid spoke
chrome beacon
#

👀

hybrid spoke
#

basically the same

chrome beacon
#

doc I thought you were a gradle kts user

blazing ocean
#

OLIVO

#

whyyyyyyy

#

i don't like you

hybrid spoke
#

damn who doesnt like olivo

blazing ocean
#

he hates kotlin

#

soo much

hybrid spoke
#

based

chrome beacon
blazing ocean
#

olivo

#

opinions on this ^

chrome beacon
#

...

granite owl
#

whats the name of the api for storing metadata key value pairs again?

#

to not use NMS directly

young knoll
#

pdc

granite owl
#

ty 😄

green prism
#

🇩🇪
🔥

sand spire
lucid cedar
#

Does anybody know how to make DeluxeHub give items to players. I'm trying to make a deluxehub kit menu. But I don't know how to give items to players.

tardy delta
quaint mantle
#

Is better to work with player uuids or full player instances

#

for example for a queue or something similar

eternal oxide
#

UUID as they won't leak

quaint mantle
#

okay thanks

kindred sentinel
#

how to get Plugin from class?

eternal oxide
#

JavaPlugin.getPlugin(...

kindred sentinel
#

thanks

crisp arch
#

anyone know how to set a chest blockstate to single?

#

idk if the api's not flushed out here or something but i cant get it to work

chrome beacon
#

You're using the wrong chest

#

You need the BlockData chest not the BlockState chest

crisp arch
#

theres like 5 different chest types

#

this is a bit confusing lol

#

hold on lemme try that

violet blade
#

anyone else working with these dependencies on 1.20.6/1.21?

crisp arch
#

the second line or the third line

quaint mantle
#

I have a listener for inventory click event, its necessary to use it in other plugin to handle the inventories created on that plugin? I mean, both plugins will work on the same server

chrome beacon
#

The chest import

crisp arch
chrome beacon
#

org.bukkit.block.data.type.Chest

crisp arch
#

OHH

#

wait

#

i get what you mean

#

holy crap okay

#

wait

#

this is really weird then

#

ive been using the wrong type but its worked

#

this was earlier when i used the blockstate chest

chrome beacon
#

BlockData doesn't have PDC

crisp arch
#

and it worked

chrome beacon
#

The state does

crisp arch
#

wait the blockstate can cast to both blockdata chest or blockstate chest?

chrome beacon
#

blockstate can only be cast to blockstate chest

#

blockdata can only be cast to blockdata chest

crisp arch
#

so blockstate chest is a superclass of blockstate

#

but doesnt have the update() method,....?

#

wait wait

#

im casting blockstate to blockdata

#

this doesnt seem right

chrome beacon
#

yeah that's wrong

crisp arch
#

oh shoot wait

#

theres a getblockdata method as well

#

😭

#

my brain is fried

chrome beacon
#

You can skip updating the state

#

you're not modifying it

crisp arch
#

its in an event

#

does that count as not modifying still?

chrome beacon
#

yes

eternal oxide
#

just put the data back

chrome beacon
#

getState returns a copy

#

so calling update on it like that is redundant

crisp arch
#

ic

#

fuck man

#

my code is now a frankenstiein of blockdata and blockstate chest

#

wait so this is correct 💀

chrome beacon
#

yes

crisp arch
#

is there a way to make it look nicer

#

other than moving to different class

tender shard
#

Which one is nicer?

@CommandAlias("mycommand")
public class MyCommand extends BaseCommand {

    private final IServerManager serverManager;
    private final IUserManager<?> userManager;
    private final IOtherStuff otherStuff;
    // More stuff ...

    @Inject
    public ChatFilterCommand(
            IServerManager serverManager,
            IUserManager<?> userManager,
            IOtherStuff otherstuff,
            // More stuff ...
    ) {
        this.serverManager = serverManager;
        this.userManager = userManager;
        this.otherStuff = otherStuff;
        // More stuff ...
    }

    // ...
}

or this:

@CommandAlias("mycommand")
@RequiredArgsConstructor(onConstructor = @__(@Inject))
public class MyCommand extends BaseCommand {

    private final IServerManager serverManager;
    private final IUserManager<?> userManager;
    private final IOtherStuff otherStuff;
    // More stuff ...

    // ...
}
chrome beacon
#

I prefix >:c

tender shard
terse raven
#

I am trying to make a bingo plugin and as one of the options that the players can choose before the game i would like to have smaller Biomes as a sort of fun option to make the game quicker.
I have tried my hardest to implement it purely through my spigot plugin, but I have sadly failed as most sources have just recommended to write a custom BiomeProvider for the WorldCreator but I am just unable todo that (technically i could do that and i have tried, as i would have liked to make a simple wrapper around the default BiomeProvider and just modify the input x and z chunk coordinates by a number larger then 1 to decrease the Biome size, but I was hindered by the lack of a default BiomeProvider anywhere.)
So now I have used a simple Minecraft Datapack that influences the minecraft noise (? tbh that is how i read that it works by working through the files, the datapack itself was downloaded from planetminecraft). And I would like the Datapack to be toggleable on newly generated worlds, is that possible? Or any other suggestion to how I could resolve my issue?

ivory sleet
#

i mean i still barely like guice, spring di, dagger etc but former communicates the usage of a DI framework clearly

crisp arch
#

org.bukkit.block.data.type.Chest chestData = (org.bukkit.block.data.type.Chest) block.getBlockData();
chestData.setType(org.bukkit.block.data.type.Chest.Type.SINGLE);
#

still isnt doing anything

#

💀

young knoll
#

You have to do setBlockData

crisp arch
#

oh wait it creates a copy?

tender shard
crisp arch
#

crap okok

#

thanks

#

pls tell bukkit to refactor org.bukkit.block.data.type.Chest to org.bukkit.block.data.type.ChestData

#

this is killing me

#

😭

kindred valley
#

wawawawawa

worldly ingot
#

You could at least use var to make your declaration simpler lol

#

The type is very clearly outlined on the right hand side of the expression so nothing of value is lost

#

There are times I do wish Java had typedefs though

young knoll
#

def wtf.choco.Choco as bad

worldly ingot
#

Well no but this would be nice:

import org.bukkit.block.Chest;

public class MyThing {

    using ChestData = org.bukkit.block.data.type.Chest;

    public void updateChest(Chest chest) {
        ChestData data = (ChestData) chest.getBlockData();
        data.setFacing(BlockFace.NORTH);
        chest.setBlockData(data);
    }

}```
#

Convenient! :D

slender elbow
#

bad api

worldly ingot
#

ur bad API

slender elbow
#

OKAY

worldly ingot
#

ya get gud

young knoll
#

what about just

#

Import x.y.z as thing

worldly ingot
#

Also valid lol

#

probably more Java friendly tbf

slender elbow
#

knowing the java lang designers, they'd probably want to reuse an existing keyword, lol

#

import to or import with

worldly ingot
#

I meannnn, they did introduce when recently

#

They also added yield not too long ago

#

They're definitely not against new keywords

slender elbow
worldly ingot
#

fwiw I still really don't like yield lol

slender elbow
#

it's alright, i don't mind

worldly ingot
#

ANYTHING ELSE YOU WANNA DISAGREE WITH ME ON TODAY, EMILY!?

slender elbow
#

waffles or pancakes?

worldly ingot
#

I could go for both I have no preference, I switch it up each time I go to a breakfast place

#

I appreciate a good waffle, I appreciate a good pancake

slender elbow
#

okay then no, nothing else

worldly ingot
#

okay :)

young knoll
#

How about they finally use the reserved goto!

#

import x.y.z goto thing

worldly ingot
#

Oh dear

slender elbow
#

const x.y.z goto a.b.c

worldly ingot
#

You know what? I regret my initial proposal

worthy yarrow
#

Don’t give up hope Choco!

spice burrow
#

does anyone have experience working with ClientboundAddEntityPacket?
I am trying to spawn in a fake ItemEntity, and I understand that I have 2 basically useless objects, but it's the only method I've found... i'm fully prepared to get flamed for this lol

 public void sendDropPacket(ServerPlayer breaker) {
        net.minecraft.world.item.ItemStack itemStack =
                CraftItemStack.asNMSCopy(new ItemStack(block.getType()));
        ItemEntity itemEntity = new ItemEntity(breaker.level(), block.getX(), block.getY(),
                block.getZ(), itemStack);

        int x = block.getX();
        int y = block.getY() + 1;
        int z = block.getZ();
        Prisons.getPlugin().getLogger().info(itemEntity.getId() + " itemEntity.getId()");
        breaker.connection.send(new ClientboundAddEntityPacket(itemEntity.getId(),
                UUID.randomUUID(), 54, x, y, z, 0, EntityType.ITEM, 0, new Vec3(0, 0, 0), 0));
    }
#

ignore the logs i was making

worthy yarrow
#

You could also use protocol lib / packet events for packets @spice burrow

spice burrow
#

i doubled checked the docs to make sure the values were right and they seem like it

sacred light
#

Does anyone know how to make a /hub command for bungeecord?

worthy yarrow
kindred solar
#

Hello guys, I am creating a anti dupping plugin, what can be the best play to do here?

worthy yarrow
#

Depends what dupe you're trying to fix

kindred solar
#

no, I am trying to try to alert the staff for possible duppers

spice burrow
#

i like overcomplicating things for some reason

echo basalt
#

There's an Entity#createSpawnPacket method iirc

#

I believe the item is also part of the metadata so you might need that

exotic obsidian
#

guys i have question

spice burrow
exotic obsidian
#

Now I want to create a perk system in one hash map and I want to allow the player to buy all the perks but when the player buys one perk and wants to buy another one it shows that you already bought the perk, I don't want to create a hashmap for each perk, it looks ugly xd.

worthy yarrow
#

ahah no worries

river oracle
#

why do perks even need a hashmap in the first place 🤔 I think your approach to a perk system doesn't really make sense

#

why can't you just do this with Data Objects and a list

exotic obsidian
#

it is temporary perk

#

and it will be deleted after specific time

river oracle
#

so what's wrong with a Map<String, Perk> inside of whatever Player data object you use

#

the fact that they already have the perk is on the front end it shouldn't really touch the actual perks the players have active in their playerdata

river oracle
exotic obsidian
#

my issue is if the player buy one perk and wants to buy the others the player can not. i think because the hashmap.

#

wait

river oracle
#

you just have a naive data implementation then

#

each player should have their own perks individual of all other players

#

and your menu should be regenerated for each player so they see which perks they do and don't have

bitter rune
#

I can't figure out how to edit Minecraft's original code for the life of me, like adding more enchantments without replacing what's there, same with fishing etc

young knoll
#

Well enchantments are data driven now

#

So you can use a datapack

worthy yarrow
#

Oh snap

young knoll
#

Fishing loot is also data driven iirc

worthy yarrow
#

No more need for reflection with enchantments then?

young knoll
#

Well

#

If you want to do it with code you’d need to unfreeze the registry

worthy yarrow
#

Ah ok so still needed in that sense

slender elbow
#

if only there was a registry modification API 😏

young knoll
#

🔨

slender elbow
#

I love construction

wet breach
worthy yarrow
#

Project suggestions?

#

Creativity is failing me today D:

slender elbow
#

http server in c

real lagoon
#

Wtf

worthy yarrow
real lagoon
slender elbow
#

compile Minecraft commands into code

#

yeah idk

worthy yarrow
#

kek

slender elbow
#

just throw stuff and see what sticks

worthy yarrow
#

I wanna work with some more abstraction so lets think what could benefit most

real lagoon
#

Make registries editable in the api

worthy yarrow
#

That's like coll's job or smthn kek

real lagoon
worthy yarrow
#

I mean the reflection method for enchants isn't that bad

#

lil hacky but not bad imo

real lagoon
#

55% of my neurons don't believe that

worthy yarrow
#

Have you done it before?

real lagoon
#

I saw the actual code to insert a custom enchant in newer versions

#

Too much huge

worthy yarrow
#

Eh I think you just set "acceptingNew" field to true, then register your enchantment

young knoll
#

That’s gone

#

Since 1.20.5 iirc

river oracle
#

spigot needs to do a shit ton to their plugin loading

#

tbh

#

not only does it need a rewrite it needs some way to interact before registries freeze

#

We went from changing a single field to be accessible using reflection to having to do this, fucking amazing. The first comment on the thread is kinda unfair

#

its not spigots fault mojang decided to make enchantments data driven and the hack people used no longer is acceptable

young knoll
#

I mean it was always a hack

#

It actually got removed before data driven enchantments

worthy yarrow
real lagoon
young knoll
#

But yes we do need a registry api eventually

#

But that’s not an easy thing to make

worthy yarrow
#

Get the big brains on it

young knoll
#

@worldly ingot you heard the man

river oracle
#

then enchantments went data driven

#

I imagine people will get upset the more stuff goes towards data driven and some other unsustainable API breaks

young knoll
#

You too

#

Get on it!!!111

late sonnet
#

No thanks, no big PR for me xd

worthy yarrow
#

Man I'd do it if I knew how

river oracle
#

just go for it

#

There is no better way to learn than to subject yourself to the burning fires of despair

late sonnet
river oracle
#

there are some things I am not looking forward to doing with my server software damage API is definitely one of them

late sonnet
river oracle
#

as well as world gen have got to be my top 2 most unwanted to touch

late sonnet
#

WorldGen and Registry are things i dont touch xd

river oracle
#

All I know well rn is menu

worthy yarrow
#

When do we start getting dev logs and update notifications for CabernetMC?

river oracle
worthy yarrow
#

Would love to see it

outer tendon
#

Is working with the HandlerList directly considered okay? I'm not sure if this is conventional.

outer tendon
#

I want to use it to register events

#

Im really trying to use it to register events of certain event types, but you cant register for PlayerEvent type. Ive tried using the plugin manager, so Im just wondering if using the HandlerList is conventional

blazing ocean
worthy yarrow
outer tendon
thorny salmon
#

`@EventHandler
public void onInventoryOpen(InventoryOpenEvent e) {

if (e.getInventory().getLocation() != null) {
Player player = (Player) e.getPlayer();
Block chestBlock = e.getInventory().getLocation().getBlock();
if (chestBlock.getState() instanceof Chest) {
Chest chest = (Chest) chestBlock.getState();
Inventory inventory = chest.getInventory();
if (!chest.getPersistentDataContainer().has(NamespacedKey.minecraft("opened"), PersistentDataType.BYTE)) {
if (!isChestEmpty(inventory)) {
if(databaseManager.isKiemTu(player.getUniqueId().toString())==1)
{
List<Integer> emptySlots = getEmptySlots(inventory);
int tiLe = random.nextInt(100);
String tuVi = databaseManager.getNextTuVi(player.getUniqueId().toString());
int tuViConvert = Integer.parseInt(tuVi);
if (tiLe < 5 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapTuyetPham());

player.sendMessage("TEST 5");
} else if (tiLe < 10 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapCucPham());
player.sendMessage("TEST 4");
} else if (tiLe < 20 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapCaoPham());
player.sendMessage("TEST 3");
} else if (tiLe < 30 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapTrungPham());
player.sendMessage("TEST 2");
} else if (tiLe < 50 + tuViConvert) {
inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapHaPham());
player.sendMessage("TEST 1");
}
}
}
chest.getPersistentDataContainer().set(NamespacedKey.minecraft("opened"), PersistentDataType.BYTE, (byte) 1);
chest.update();
} else {

}
}
}
}`

  • I created an event when a player opens a chest and it will add items to it at a custom rate. Chests will be tagged to avoid items being re-added when opening the chest multiple times. But the item is not added even though the message is still showing.
#
  • I tried replacing it with inventory.addItem(itemCongPhap.CongPhapTuyetPham()); but it also has no items in the chest
#
  • Here is some related code.
    private boolean isChestEmpty(Inventory inventory) { for (ItemStack itemStack : inventory.getContents()) { if (itemStack != null && itemStack.getType() != Material.AIR) { return false; } } return true; } private List<Integer> getEmptySlots(Inventory inventory) { List<Integer> emptySlots = new ArrayList<>(); for (int i = 0; i < inventory.getSize(); i++) { ItemStack itemStack = inventory.getItem(i); if (itemStack == null || itemStack.getType() == Material.AIR) { emptySlots.add(i); } } return emptySlots; } }
  • This is the code of the item section
    public class itemCongPhap { public static ItemStack CongPhapHaPham() { ItemStack item = new ItemStack(Material.PAPER); ItemMeta meta = item.getItemMeta(); meta.setDisplayName("§8TEST"); List<String> lore = Arrays.asList( " ", " " ); meta.setLore(lore); meta.getPersistentDataContainer().set(NamespacedKey.minecraft("TEST"), PersistentDataType.INTEGER, 1); item.setItemMeta(meta); return item; }
#

I don't know where I'm wrong, can anyone tell me where I'm wrong?

thorny salmon
drowsy helm
#

Whats the go-to way of making holograms follow an entity now?

jolly creek
thorny salmon
# jolly creek it more clearly somewhere

I just know it's an error in adding items to the chest because when I get the ratio right, the message sent to the player still shows up but it doesn't have any items.

jolly creek
#

the single one makes it unreadable

#

so like ``` code ```

eternal oxide
#

?codeblock

undone axleBOT
#

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

}

}```
Becomes:

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

    }
}```
thorny salmon
#

okay

#
@EventHandler
    public void onInventoryOpen(InventoryOpenEvent e) {
        if (e.getInventory().getLocation() != null) {
            Player player = (Player) e.getPlayer();
            Block chestBlock = e.getInventory().getLocation().getBlock();
            if (chestBlock.getState() instanceof Chest) {
                Chest chest = (Chest) chestBlock.getState();
                Inventory inventory = chest.getInventory();
                if (!chest.getPersistentDataContainer().has(NamespacedKey.minecraft("opened"), PersistentDataType.BYTE)) {
                    if (!isChestEmpty(inventory)) {
                        if(databaseManager.isKiemTu(player.getUniqueId().toString())==1)
                        {
                            List<Integer> emptySlots = getEmptySlots(inventory);
                            int tiLe = random.nextInt(100);
                            String tuVi = databaseManager.getNextTuVi(player.getUniqueId().toString());
                            int tuViConvert = Integer.parseInt(tuVi);
                            if (tiLe < 5 + tuViConvert) {                        inventory.setItem(emptySlots.get(0),itemCongPhap.CongPhapTuyetPham());
                                player.sendMessage("TEST 5");
                        }
                    }                   chest.getPersistentDataContainer().set(NamespacedKey.minecraft("opened"), PersistentDataType.BYTE, (byte) 1);
                    chest.update();
                } else {
                }
            }
        }
    }```
#

I have a character limit so I can only send 1 paragraph like this

#
private boolean isChestEmpty(Inventory inventory) {
        for (ItemStack itemStack : inventory.getContents()) {
            if (itemStack != null && itemStack.getType() != Material.AIR) {
                return false;
            }
        }
        return true;
    }
    private List<Integer> getEmptySlots(Inventory inventory) {
        List<Integer> emptySlots = new ArrayList<>();
        for (int i = 0; i < inventory.getSize(); i++) {
            ItemStack itemStack = inventory.getItem(i);
            if (itemStack == null || itemStack.getType() == Material.AIR) {
                emptySlots.add(i);
            }
        }
        return emptySlots;
    }```
#
public static ItemStack CongPhapHaPham()
    {
        ItemStack item = new ItemStack(Material.PAPER);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName("§8TEST");
        List<String> lore = Arrays.asList(
                " ",
               " "
        );
        meta.setLore(lore);     meta.getPersistentDataContainer().set(NamespacedKey.minecraft("cong_phap_ha_pham"), PersistentDataType.INTEGER, 1);
        item.setItemMeta(meta);
        return item;
    }```
#

Here are the related codes, it is not possible to add items to the chest even though the correct ratio and system message have been sent

jolly creek
#

Also getState() returns a replica of the chest meaning that every single time you call that it will return a different object meaning setting persistent data to it wont work

thorny salmon
shadow night
#

Apply some pdc to player placed chests

jolly creek
shadow night
#

You can't apply pdc to a block

thorny salmon
#

Does PDC mean PersistentDataContainer?

shadow night
#

Yes

#

Iirc you need to get the blockmeta and apply pdc to that

#

Or something like that

thorny salmon
#

the code I provided I think it used PersistentDataContainer right.

shadow night
#

Looks right

#

Btw for character limits

#

?paste

undone axleBOT
shadow night
#

Don't use NamespacedKey.minecraft

thorny salmon
shadow night
#

new NamespacedKey(JavaPlugin, String)

thorny salmon
shadow night
#
if(databaseManager.isKiemTu(player.getUniqueId().toString())==1)
``` wtf does this do now
thorny salmon
#

but constant interaction leads to my server having lower tps if there are too many players spamming. I don't know how to fix it

shadow night
#

Well, you are fetching stuff from your database syncrounosly so, understandable

thorny salmon
shadow night
#

Yeah

shadow night
#

okay, so, wait, what exactly was your issue?

thorny salmon
#

The item cannot be added to the chest even though it falls into the correct ratio

shadow night
#

Ah

#

So, you are adding the items but they don't get added?

thorny salmon
#

yeh

shadow night
#

Hmm

thorny salmon
#

I'm thinking about putting it in the player's inventory instead of the chest, but it doesn't really fit with the server's mechanics

shadow night
#

What if you don't call chest.update(), does that change anything

thorny salmon
#

I haven't tried it yet, I will try it now

thorny salmon
shadow night
#

what thing?

thorny salmon
#

Oh I mean items

shadow night
#

I'm struggling to understand what you mean

thorny salmon
#

But when turned off, it won't attach the NamespaceKey to the chest, so players will take advantage of this. But it's okay, I understand how it works.

shadow night
#

I think the blockstate is from before you changed the inv

thorny salmon
thorny salmon
obtuse hedge
#

Can someone help me get things to resolve
nothing wants to resolve when updating to 1.20.5+

jolly creek
#

same thing since everyone uses it for blocks within the chunk

jolly creek
jolly creek
#

Like this: ```
public class VersionUtils {

private static Enchantment sharpness;

private static Particle block_dust;
private static Particle block_crack;

static {
    sharpness = Registry.ENCHANTMENT.get(NamespacedKey.minecraft("sharpness"));
    
    Integer[] version = Arrays.stream(Bukkit.getBukkitVersion().substring(0, Bukkit.getBukkitVersion().indexOf('-')).split("\\.")).map(e -> Integer.parseInt(e)).toArray(Integer[]::new);
    if (version[1] > 20 || (version[1] == 20 && version[2] >= 5)) {
        block_dust = Particle.DUST_PILLAR;
        block_crack = Particle.BLOCK;
    } else {
        block_dust = Particle.valueOf("BLOCK_DUST");
        block_crack = Particle.valueOf("BLOCK_CRACK");
    }
}

public static Enchantment getSharpness() {
    return sharpness;
}
public static Particle getBlockDust() {
    return block_dust;
}
public static Particle getBlockCrack() {
    return block_crack;
}

}

#

Its annoying ik

obtuse hedge
#

i dont think you understand

#

JavaPlugin is not resolving

jolly creek
obtuse hedge
#

Nothing at all is resolving

jolly creek
#

Store the results of chests in a map of some sort and have the calls async which store it in the map for immediate access

jolly creek
obtuse hedge
#

Gradle

jolly creek
#

Well seems like your dependency is broken then

#

Im not that familiar with gradle

chrome beacon
#

Send your build.gradle

#

?paste

undone axleBOT
obtuse hedge
chrome beacon
#

?whereami

chrome beacon
#

also update Intellij if you haven't

obtuse hedge
#

my intellij is up to date

shadow night
#

Which a chest is

obtuse hedge
#

is there a way to use identifiers in a spigot plugin?

chrome beacon
#

I assume you mean NamespacedKey

obtuse hedge
#

yes

blazing ocean
#

?xy

undone axleBOT
blazing ocean
#

bukkit has namespacedkeys, identifiers are called resourcelocation (in mojmaps at least)

obtuse hedge
#

I want it for my custom items class

#

im making custom items and i want them to have unique identifiers and i dont wanna use integer id's

blazing ocean
#

yeah then use namespacedkeys

obtuse hedge
#

ty

torn shuttle
#

NAY

#

not again

#

I'm going to lose my gourd with how intellij doesn't save my WIP changelog

#

seriously the hell

#

I have like 14 different features I had fully documented and it's almost all gone

#

I actually hate this

pseudo hazel
#

I just make my changelog in a separate md file

torn shuttle
#

that's something a crazy person does

pseudo hazel
#

to not have ides to fuck it up

#

losing work isnt?

torn shuttle
#

I reported the issue to jetbrains

#

this is definitely a bug

pseudo hazel
#

yeah well they havent fixed it yet

#

so why bother xD

torn shuttle
#

they are not going to fix it if you don't report it

#

and I didn't see any open tickets about it

#

cool now I rewrote the entire thing and I'm not sure that I covered every change

glad shore
drowsy helm
#

can we see your code

torn shuttle
#

always good when a changelog is so long it blows past the discord character limit

lilac dagger
obtuse hedge
#

Is there a modern version/way of doing translateAlternateColorCodes

#

I dont wanna sit and build a text component for every message I have

lilac dagger
#

no, why would there be?

#

oh, for text components

#

hmm, i'm not sure

#

you can don't really have a choice with text component as far as i know

obtuse hedge
#

is that free use?

jolly creek
#

Translates for & vanilla colors and hex in the format (hex:#ffffff) and auto converts to closest vanilla color for bukkit users

jolly creek
#

I made it dw

obtuse hedge
#

alr

#

wait

#

its returning string

jolly creek
obtuse hedge
#

ah

jolly creek
#

is that what you were looking for?

obtuse hedge
#

no :(

jolly creek
#

then what do you mean by modern approach?

obtuse hedge
#

a way to put "§cHi" in and get a TextComponent out

drowsy helm
#

if you just want raw string to component you can just split it by each colour code then translate and append to the component

obtuse hedge
#

I tried that, my approach was very messy and i couldnt get it to work

obtuse hedge
#

it takes text

#

but it doesnt color it

#

wait

jolly creek
#

new TextComponent(translateAlternateColorCodes('&', "&cHi"));

obtuse hedge
#

what

chrome beacon
obtuse hedge
#

i did that

#

and it didnt work

chrome beacon
#

Instead of using legacy text colors

obtuse hedge
#

but now it does!??!?!

jolly creek
chrome beacon
#

No

jolly creek
#

How can you get more modern than the basic one method call?

chrome beacon
#

Instead of using magic color values it properly converts the colors in to components

jolly creek
#

How is this useful?

chrome beacon
#

So instead of a string containing §c it will a component set to the color red

jolly creek
#

Game already converts it no problem

chrome beacon
#

for now

#

also the minimessage format allows for more flexible messages

jolly creek
#

They aren't going to change it because no one uses § ever for anything else

obtuse hedge
#

wait can i pass it raw still?

chrome beacon
#

Users can easily add hoverable text, clickable text or whatever they'd like

#

Besides the mini message format is much more readable

#

<red>Red Text
§cRed Text

obtuse hedge
#

so it still allows for §

shadow night
#

<red>Red Text</red>

chrome beacon
jolly creek
#

Yeah I just llooked at it

jolly creek
shadow night
obtuse hedge
#

testing it rn

jolly creek
#

its like html but without the wasted time of closing it, I like it

obtuse hedge
#
return (TextComponent) MiniMessage.miniMessage().deserialize(input);
chrome beacon
#

Can't cast it like that

shadow night
#

That's like player.sendMessage("yes"

chrome beacon
jolly creek
obtuse hedge
#

oh well

#

i dont need textcomponent

#

it works fine as component

#

so i dont need to cast

#

for what i need

#

oh

#

it didnt work

obtuse hedge
#

i was lied to

chrome beacon
#

There are html tags that don't need closing tags

obtuse hedge
#

wait no

#

i made a code mistake

shadow night
jolly creek
#

I use it and the strings still contain them

chrome beacon
jolly creek
#

So how does minimessage bypass this?

#

It is handled client side the color codes by magic values

chrome beacon
#

MiniMessage serializes the tags in to components

#

components can have color without magic values

#

which is the way the game has been doing it for years now

shadow night
#

what is a magic value

chrome beacon
#

§ colors are only still there because they haven't bothered to remove them

jolly creek
#

Yes but arent the components anyways translated to magic values on the server? Since vanilla clients can join spigot

obtuse hedge
#

it died

chrome beacon
#

The client can understand components just fine

obtuse hedge
#

Legacy formatting codes have been detected in a MiniMessage string - this is unsupported behaviour. Please refer to the Adventure documentation (https://docs.advntr.dev) for more information.

shadow night
#

Minecraft has used a proper component system for ages

obtuse hedge
#

BOOO

jolly creek
#

What version did they start that?

shadow night
#

Spigot has been behind for like years