#help-development

1 messages ยท Page 1658 of 1

earnest lark
#

it worked allright

#

tnks

chrome beacon
#

NMS requires Java 16 in 1.17. Compatability might be difficult. (You will need reflection here)

mortal hare
#

^^

quaint mantle
#

Oh. I indeed use NMS (1 gradle submodule per NMS version)

chrome beacon
#

Yeah you need a reflection module for 1.17+

quaint mantle
#

So reflexion will be the only way to avoid using Java 1.16

#

@waxen plinth this is my issue

   +
  /  \
 2    3 # where to put the '*'?
#

ok

quaint mantle
#

thank you ^^

mortal hare
#

if what your asking

#

:"D

quaint mantle
#

No

waxen plinth
quaint mantle
#

yep

waxen plinth
#

Okay

#

Tokenize

#

Put it in a linked list

quaint mantle
#

no rhats where I fail

mortal hare
#

what even is this

waxen plinth
#

Putting it in a linked list?

#

Or tokenizing?

quaint mantle
waxen plinth
#

Stop

#

Just put the tokens in order in a linked list

#

1+2*3

#

[1, +, 2, *, 3]

#

Start there, okay?

quaint mantle
#

ok

waxen plinth
#

Let me know once you've done that and have your tokens in a linked list

#

Linked lists are usually useless, but they have a few special properties that make them really good at this specific thing

quaint mantle
#

K

#

done

waxen plinth
#

Alright

#

Now, here's what makes linked lists useful

#

We're going to iterate over the linked list looking for operators of each priority

#

I don't know if you have a priority system set up, but you're going to need it

#

Just assign each operator a priority, with operators that should be applied first having a higher priority

#

So * and / should have a higher priority than + and -

wintry pumice
#

hi im working with the maprenderer and map api

is render ultimately called by the main server thread? and what does that function actually do?

waxen plinth
#

Now, the most basic way to approach this is to iterate over the list once for each priority we are looking for

lost matrix
waxen plinth
#

Yep

#

Makes em super useful for this though

#

I can explain how to do it faster later, imagine, but for now we're going to do it the simple way

#

Iterate over the list once for each operator priority

#

So we start at the highest priority there is, let's say you've given a priority of 10 to * and /, and a priority of 5 to + and -

#

You'll loop over looking for operators of priority 10, then 5

#

When you reach an operator token with priority 10 on your first loop

lost matrix
wintry pumice
#

ye

waxen plinth
#

It's very simple, you just look at its neighbors

wintry pumice
#

thats what im doing i was just curious

waxen plinth
#

Its neighbors are 2 prior to it, and 3 following it

#

So all you need to do is remove its neighbors and replace the * token with the result of 2*3

#

Which is 6

#

So you end up with [1, +, 6]

wintry pumice
#

how does the canvas work, does it send the image to the client when the client is near (and call render to grab the image?)

waxen plinth
#

Then on your next iteration, you find the + and do the same there, replacing the 2 value tokens and the operator token with their result, and it becomes [7]

quaint mantle
#

this is O(n^2) though right

lost matrix
quaint mantle
#

im gonna start with math eval then expressions

waxen plinth
#

He is

waxen plinth
#

Just, strictly mathematical ones

#

It does get more complicated once you throw more types in the mix than numbers

#

You need to keep track of which operators to use based on the types

wintry pumice
#

like does render create the image packet once for each individual client, or does it call render to create a single one and distribute that packet to whoever comes near

earnest lark
#

?paste

undone axleBOT
wintry pumice
#

and if its the first is it possible to cache that packet because the maps images i render never change

#

if its the second then its whatever

sacred ice
#

you can store them

#

into byte array

#

that what I do for video

wintry pumice
#

the packet?

earnest lark
sacred ice
#

no buffer

wintry pumice
#

yeah

#

im already doing that

#

i want to cache the packet

#

is that possible

sacred ice
#

the packet you can't

wintry pumice
#

or do i need to hack nms

#

sad

sacred ice
#

but the data that is send yes

wintry pumice
#

ya

#

is there no spigot interface where i can override specific requests

sacred ice
#

maybe packet listener?

wintry pumice
#

oki ill look into it

#

i just dont want the main server thread reencoding the same packet a billion times

#

ty

#

microsoft please fix :((((((((((((

grim ice
#

btw Elgar the code u gave me works

#

i aint gonna ping u tho

eternal oxide
#

thanks ๐Ÿ™‚

grim ice
#

oh LOL

eternal oxide
#

missing command from plugin.yml

earnest lark
#

oh yea

grim ice
#

no ur not

#

ur smart <3

wintry pumice
#

oh also arithmatic expression thing

grim ice
#

thats fine

#

dw

#

i forgot thaat even after making like

#

20 plugins

vale ember
grim ice
#

some ppl have more and still forget

earnest lark
eternal oxide
earnest lark
#

i dont get any errors

#

imma try something

vale ember
earnest lark
#

see if it works

wintry pumice
#

arithmatic expression parsing u could just try converting it to like rpn or some other ast and then process it i think thats linear time

eternal oxide
#

We could start at teh beginning.

wintry pumice
#

way easier than whatever random stuff u do with trees and nodes and whatever

grim ice
#

elgar

#

do u know how do i remove a certain element from a config file

#

like

#

'- SOMETHING'

#

I wanna delete it

eternal oxide
#

set to null

#

if its a path you set to null

grim ice
#

yeah but idk the path

eternal oxide
#

if its an element in a list, you remove it from the list and then set teh list

grim ice
#

yeah but idk the pathhhhhhhhhhhhhhhh

eternal oxide
#

You need to know the path

grim ice
#

cant i loop thru the config lines

#

and remove it

spring river
#

Hello, it's possible to automatically fill the version on plugin.yml with the gradle version variable from the build.gradle please ?

wintry pumice
#

@quaint mantleyeah if you want to do in linear time just implement shunting yard and then once its in postfix its easy

arctic moth
#

how do you enable/disable hardcore

naive brook
#
int counter = 15;
        for (int i = 0; i < stringbuilder.eventScoreboard().size(); i++) {
            StringBuilder current = stringbuilder.eventScoreboard().get(i);
            Team team = scoreboard.registerNewTeam("team"+i);
            if (current.length() <= 16 ) {
                team.setPrefix(colors(current.substring(0, current.length())));
                team.addEntry(ChatColor.GRAY+"");
                objective.getScore(ChatColor.GRAY+"").setScore(counter);
             } else if (current.length() <= 32) {
                 team.setPrefix(colors(current.substring(0, 16)));
                team.addEntry(colors(current.substring(16,current.length())));
                objective.getScore(colors(current.substring(16,current.length()))).setScore(counter);
            } else if (current.length() <= 48) {
                team.setPrefix(colors(current.substring(0, 16)));
                team.addEntry(colors(current.substring(16, 32)));
                team.setSuffix(colors(current.substring(32, current.length())));
                objective.getScore(colors(current.substring(17,32))).setScore(counter);
            } else if (current.length() > 48) {
                team.setPrefix(colors(current.substring(0, 16)));
                team.addEntry(colors(current.substring(16, 32)));
                team.setSuffix(colors(current.substring(32, 48)));
                objective.getScore(colors(current.substring(17,32))).setScore(counter);
            }
            counter = counter - 1;
        }
``` so everything works but when setting the score this happens....
#

it skips some lines

#

on the loop

#

for somereason

#

it supposed to print the whole lines

eternal oxide
grim ice
#

a player name from the whole config

eternal oxide
#

you shoudl never have a player name in the config

naive brook
grim ice
#

my config would look like this:
Teams:
TEAMLEADER:
- GUY1
- GUY2
TEAMLEADER2:
- GUY 1

eternal oxide
#

UUIDs

naive brook
#

^

grim ice
#

still how to remove it

grim ice
#

but i clear the config each server restart either way :/

eternal oxide
#

is it a teamleader you are trying to remove?

grim ice
#

no

#

both actually

#

if its a team leader / person

mortal hare
#

he's looking how to remove the index from the list array

#

configuration section

grim ice
#

yeah but i dont know the path

earnest lark
#

my thing is still broken

grim ice
#

like i dont know who the team leader is

eternal oxide
#

if its a member in the list, you need to get teh list, remove the member adn put the list back

mortal hare
#

well TEAMLEADER is the key to the list

#

you can loop the keys of the Teams node

grim ice
#

yeah and getKeys(true)

mortal hare
#

then loop the keys of leader lists

grim ice
#

but idk how to remove it

mortal hare
#

if it find that player name

#

clone that list

eternal oxide
#

getStringLIst

mortal hare
#

and remove the player from inside it

#

and put it back

#

afaik there's no way to remove dynamically from config list

#

in bukkit api atleast

grim ice
#

idk mannn

#

anyone has an idea of how can i make a teams plugin in a better way

#

its like a /party plugin basically

tall dragon
#

why do you not cache the teams

grim ice
#

but with some special stuff

mortal hare
#

store the uuids first of all

tall dragon
#

instead of having it in config

eternal oxide
#

why put them in the config if they are only for a session?

mortal hare
#

he wants them to persist

#

after server restart

grim ice
#

no

tall dragon
#

well you can save

grim ice
#

they need to gte removed

#

after restart

tall dragon
#

so why set to config?

eternal oxide
#

they get wiped on a restart so no point in storing them in the config

mortal hare
#

then why tf are you saving it into config

grim ice
#

because im dumb, idk another way

#

do i use data structures

eternal oxide
#

a List

mortal hare
#

use List

#

ArrayList is the most widely used

eternal oxide
#

if you have a leader Map<UUID, List<UUID>>

mortal hare
#

LinkedList is good for adding removing but not searching

#

Map is the fastest

#

but requires abit more memory

grim ice
#

nwrgjnoaojgjagojbagragbrjagbrjagbrjagrjboaaogrgggga

#

Yay! I have to recode 10 commands again!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

quartz pike
#

arent u a "Minecraft Plugins Dev (Java)"

#

jeez

eternal oxide
#

Only store things in a file/config/database that you need to access across server starts

grim ice
mortal hare
#

yea because reading from ssd harddrive is soooo much slower

#

compared to RAM

grim ice
#

most ppl here are plugin devs

#

but r they all good

#

no

#

and if ur not helping, take ur ass outta here :D

quartz pike
#

but thats just my opinion ๐Ÿ™‚

eternal oxide
#

Do you access these Leader list and locations outside the commands?

grim ice
#

your opinion is not appreciated, frick off

eternal oxide
#

then simples, create a BaseCommand class

grim ice
#

wut

mortal hare
#

oh yeah good idea

#

what he wants u to do is an "abstract class"

#

for commands

eternal oxide
#

in that class you add a private static Map<UUID, List<UUID>> leaders = new Hashmap<>();

mortal hare
#

that way you would only get that variable for that extended classes only

grim ice
#

o

eternal oxide
#

then make all your commands extend BaseCommand

mortal hare
#

BaseClass [private static Map<UUID, List<UUID>> leaders = new Hashmap<>();]
YourCommandClass [has the same hashmap, but other non extending classes doesn't]

grim ice
#

but

#

aihef0aoweuawfeuafw

#

ok lemme try

eternal oxide
#

remember its static so only one instance ever will be created

mortal hare
#

static would make sure that it wouldnt instanciate every time

#

that's what i was gonna say lol

#

๐Ÿ˜„

eternal oxide
#

๐Ÿ™‚

#

This is what static is designed for

mortal hare
#

well its just like static in c, but could be read from multiple translatable units

grim ice
#

u forgot a capital )

#

M

naive brook
grim ice
#

xd

naive brook
#

it supposed to print those lines

#

but doesn't

grim ice
#

@eternal oxide sorry for being so annoying, but can u give me an example of a party create command with mechanic, so i get familar with it

eternal oxide
grim ice
#

sorry for being so annoying

tall dragon
#

@grim ice

public abstract class BaseCommandExample implements CommandExecutor
{

    @Getter
    private static Map<UUID, List<UUID>> leaders = new HashMap<>();

}
public class CommandExample extends BaseCommandExample
{


    @Override
    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, String[] strings) {
        getLeaders()//do shit


        return true;
    }
}

this is rougly what the guys mean

mortal hare
#

well yeah but you didnt implemented getter there

naive brook
mortal hare
#

oh

arctic moth
#
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(cmd.getName().equalsIgnoreCase("enablehardcore")) {
            if(sender.isOp()) {
                // hardcore setter
                if(sender == Bukkit.getConsoleSender()) {
                    System.out.println(ChatColor.RED + "Hardcore enabled");
                }
                else {
                    sender.sendMessage(ChatColor.RED + "Hardcore enabled");
                }
                return true;
            }
        }
        return false;
    }

why is this not triggering when i do /enablehardcore

mortal hare
#

that's a lombok

arctic moth
#

(also btw does the color thing work for println)

tall dragon
#

yea i used lombok for ease. sorry for any confusion

earnest lark
#

well you need to put the command in the yml file

arctic moth
#

i did

mortal hare
#

did you registered the command

#

via the plugin

quaint mantle
mortal hare
#

aka set executor

earnest lark
#

?paste

undone axleBOT
eternal oxide
# grim ice sorry for being so annoying
public abstract class BaseCommand implements CommandExecutor {

    protected static JavaPlugin plugin;
    protected static Map<UUID, List<UUID>> leaders = new HashMap<>();

}```
mortal hare
#

why plugin is not static

arctic moth
eternal oxide
#

it shoudl be

earnest lark
arctic moth
#

this pops up in chat

#

when i use the command

tall dragon
quaint mantle
#

Yes

earnest lark
#

i think there is sonmething wrong with my main and i dont know what it is and why it is not working

tall dragon
#

its not needed

quaint mantle
#

Only if class - executor

tall dragon
#

well yea

arctic moth
eternal oxide
#

@grim ice Then each of your commands ```java
public class TestCommand extends BaseCommand {

public TestCommand(JavaPlugin plugin) {

    TestCommand.plugin = plugin;
}

}```

#

It will tell you implement missing methods

#

auto compete it and its done

tall dragon
#

if its a console sender obviously it has OP

arctic moth
#

lol

#

but it also should work for players with op

tall dragon
#

well it wont right now

#

well it will

quaint mantle
#

Just first check if ! sender instanceof player

#

Do what you need with console

tall dragon
#

but it just does the same for both cases

quaint mantle
#

And also

#

It's same messages

#

Just if !sender.isOp() return true

#

And after that send your message

grim ice
#

but i meant

#

tthe usage of the lists

#

and hashhmaps

eternal oxide
#

get them made first

arctic moth
#
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        if(sender.isOp()) {
            // hardcore setter
            sender.sendMessage(ChatColor.RED + "Hardcore enabled");
        }
        return true;
    }

so i changed my code to this but theres no difference

tall dragon
#

it still prints white in chat?

arctic moth
#

both just say /enablehardcore in chat

arctic moth
quaint mantle
#
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        if(!sender.isOp()) return true;
           
     sender.sendMessage(ChatColor.RED + "Hardcore enabled");
        
        return true;
    }
eternal oxide
# grim ice and hashhmaps
if (leaders.containsKey(player.getUniqueId())) {
    List<UUID> members = leaders.get(player.getUniqueId());
    members.add(newMember.getUniqueId());
}```
grim ice
#

o

arctic moth
lusty cipher
#

why can't I pass a ModUpdateData to a function taking T extends ModUpdateData as a parameter?

arctic moth
quaint mantle
#

Show your code

#

With ss please

arctic moth
#

me?

quaint mantle
#

Yes

eternal oxide
#

to add a leader is similar, test if they don;t exist then leaders.put(player.getUniqueId(), new ArrayList<>());

arctic moth
#

the whole thing or just the class

quaint mantle
#

@waxen plinth
now to make this faster

#

Only onCommand method

arctic moth
#
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        if(!sender.isOp()) return true;
        sender.sendMessage(ChatColor.RED + "Hardcore enabled");

        return true;
    }
quaint mantle
#

Ss please

#

I'm on phone

arctic moth
#

whats ss

quaint mantle
#

hes fine

arctic moth
#

lol

quaint mantle
#

Screenshot

#

you can read it

arctic moth
#

o

quaint mantle
#

No I can't I have bad screen now

arctic moth
quaint mantle
#

Oh yes

mortal hare
quaint mantle
#

Do you have an @override?

waxen plinth
undone axleBOT
waxen plinth
#

So the next step

arctic moth
quaint mantle
#

Set it

waxen plinth
#

You don't need to iterate once for every operator priority

#

You can iterate once

quaint mantle
#

How

arctic moth
waxen plinth
#

You iterate, storing each operator's linked list node in a list

#

Then you sort by their priorities

#

Then combine with their neighbors just as you did before

#

Easy!

quaint mantle
waxen plinth
#

One iteration, much faster

arctic moth
#

no

tall dragon
quaint mantle
#

^^

arctic moth
arctic moth
#
package com.tristandasavage.halfheartsurvival;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

@Override
public class Commands implements CommandExecutor {
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        if(!sender.isOp()) return true;
        sender.sendMessage(ChatColor.RED + "Hardcore enabled");

        return true;
    }
}
quaint mantle
#

nah over onCommand

tall dragon
#

ahh

waxen plinth
tall dragon
#

yea above onCommand

quaint mantle
arctic moth
#

o im an idiot srry

#

xD

waxen plinth
#

Right

#

And you have its nodes, right?

#

You can use those nodes directly?

quaint mantle
#

Its just holding tokens rn

waxen plinth
#

But is it a proper linked list?

#

With nodes that store the value and point to the previous and next node?

arctic moth
#

still all it does is say /enablehardcore in chat

quaint mantle
#

its a fucking linked list

waxen plinth
#

Yes

quaint mantle
#

java.util

waxen plinth
#

And it has nodes

#

OHH

quaint mantle
#

<Token>

arctic moth
#

even with the @Override and implement and stuff

waxen plinth
#

I thought you were doing this in python?

quaint mantle
#

kotlin

waxen plinth
#

Ah

#

For this you will need your own linked list implementation then

#

Because you need access to the nodes

#

And java's LinkedList does not expose them

quaint mantle
#

k

#

ill just extend a stack

arctic moth
quaint mantle
#

class TokenList extends Stack<Token>

waxen plinth
#

What

tall dragon
waxen plinth
#

Would that give you access to the nodes

waxen plinth
#

I can't imagine a stack is doubly linked

arctic moth
#

wdym by that

tall dragon
#

just send the class again

arctic moth
#

k

#
package com.tristandasavage.halfheartsurvival;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;


public class Commands implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        if(!sender.isOp()) return true;
        sender.sendMessage(ChatColor.RED + "Hardcore enabled");

        return true;
    }
}
quaint mantle
#

its legit designed for tokens I could imagine

tall dragon
waxen plinth
#

You need a linked list with nodes that you can access and store

arctic moth
#

the plugin.yml works cuz i am able to do /help with the command

#

and its one of the suggested option things when you type /enable in mc

quaint mantle
#

k

tall dragon
#

can i see the cmd registration

arctic moth
#

wdym

quaint mantle
#

plugin.yml

#

command registration

tall dragon
#

wherever you register the command

#

in your onEnable im guessing

arctic moth
#

commands:
enablehardcore:
description: Enables hardcore in the current world
usage: /enablehardcore
enablespawnprotection:
description: Enables 5 second invincibility after spawning
usage: /enablespawnprotection
disablehardcore:
description: Disables hardcore in the current world
usage: /disablehardcore
disablespawnprotection:
description: Disables 5 second invincibility after spawning
usage: /disablespawnprotection

#

lol the only one im using is enablehardcore for test

quaint mantle
#

its your ussage message sening

#

sending

arctic moth
#

?

tall dragon
#

yea

arctic moth
#

o

quaint mantle
#

show in your onEnable() registering executor

#

getCommand("commandname").setExecutor(new ClassName());

arctic moth
#

public void onEnable() {
this.getServer().getPluginManager().registerEvents(new Listeners(), this);
instance = this;
this.logger = this.getLogger();
this.logger.log(Level.INFO, "Half Heart Survival v1.0 has been loaded!");
Bukkit.getServer().getWorlds().get(0).setGameRule(GameRule.NATURAL_REGENERATION, false);
}

#

o lol

tall dragon
#

-,-

quaint mantle
#

and where registering command ._.

ancient plank
#

๐Ÿคฎ having multiple commands just to toggle something

quaint mantle
#

instance on 2 line

#

๐Ÿคฎ

unreal quartz
arctic moth
#

xD

tall dragon
#

wasnt that one of the first things we asked. wether or not you registered the command?. haha

arctic moth
#

idk

quaint mantle
#

register your command

#

done

arctic moth
#

btw the command still doesnt work

#

just shows the usage thing

tall dragon
#

what did you add

quaint mantle
#

btw you need register

#

it

#

show code

arctic moth
#

i did register it

quaint mantle
#

show

arctic moth
#

ok we're making progress

#

internal error xd

quaint mantle
#

ill need to create screenshot where i said SHOW

arctic moth
#

?

quaint mantle
#

show code

arctic moth
tall dragon
#

bruh

quaint mantle
#

bruh

tall dragon
#

"a"

ancient plank
#

do you

arctic moth
#

lol

tall dragon
#

replace a

quaint mantle
#

?learnjava

undone axleBOT
tall dragon
#

by your cmd name

arctic moth
#

lol

arctic moth
#

i am so stupid

quaint mantle
#

yes

ancient plank
#

are you new to java on top of trying spigot? SC_ZERO_THINK

arctic moth
#

ye

#

lol im used to python

quaint mantle
#

๐Ÿ’ฉ

#

L

ancient plank
#

should learn java before trying spigot, you wont learn core java knowledge using spigot

quaint mantle
#

^^

ancient plank
#

As I always say; The only hard part about Spigot is knowing Java.

tall dragon
#

wise words

torn oyster
#
            World w = Bukkit.getWorld("world_active");
            for (Chunk c : w.getLoadedChunks()) {
                for (BlockState b : c.getTileEntities()) {
                    if (b.getType() == Material.CHEST) {
                        chests.add(b.getBlock());
                        if (b.getY() == 126 || b.getY() == 118) {
                            addLoot(b, LootTable.ISLAND);
                        } else {
                            addLoot(b, LootTable.MIDDLE);
                        }
                    }
                }
            }```
#

why doesnt that work

quaint mantle
#

@waxen plinth walk me through this

torn oyster
#

only a few chests have items put into them

paper viper
#

Bukkit is also an ass api in general too tho

quaint mantle
#

use b.getBlockY()

paper viper
#

But not knowing Java makes it worse

quaint mantle
#

etc

paper viper
#

Lol

torn oyster
#

middle loot works fine

waxen plinth
quaint mantle
#

try with getBlockY

quaint mantle
#

PES_CoolBiker how bout now

#

google man has infinite time

arctic moth
#

is there a way to enable/disable hardcore

#

using plugin ofc

quaint mantle
#

.g how to enable/disable hardcore mode spigot

#

oh its in other server

arctic moth
#

lol

quaint mantle
#

!google

#

which command

arctic moth
#

ive already googled didnt get anything

quaint mantle
#

?google how to enable/disable hardcore mode spigot

undone axleBOT
quaint mantle
#

mhm

arctic moth
#

all it is is crap about how to enable hardcore on a server

#

but its not using plugin

#

just server.properties

quaint mantle
#

dont think its possible

#

i need to give you time for that

#

but im so lazy

tall dragon
paper viper
#

Does it on load up

quaint mantle
#

๐Ÿ˜‰

paper viper
#

Best option is to restart the server

#

After setting the value

earnest lark
tall dragon
#

yea that would be possible

earnest lark
#

i do not know why my thing is not activating can anyone help

ancient plank
#

thing
-- not activating
very description

tall dragon
#

whats supposed to happen ๐Ÿ˜‚

quaint mantle
#

and main class named Main

unreal quartz
#

because the guy does not confirm to society

paper viper
#

My thread

#

๐Ÿฅฒ

unreal quartz
#

fuck ur thread

ancient plank
#

why're you implementing listener on your main class when it has javaplugin ConfusedShock

paper viper
earnest lark
unreal quartz
#

harsh words are harsh

torn oyster
waxen plinth
tall dragon
earnest lark
#

bc is was originaly supposed to be on a death

quaint mantle
#

but its entityDamageEvent

earnest lark
#

i got it to work

tall dragon
#

perfect

earnest lark
#

is there a command like /kill @e [type=!player] to kill a npc

#

or do i have to reload my server

grim ice
#

@eternal oxide UM

#

how do i check if a player is in a team?

#

lol

eternal oxide
#

loop the leaders lists

grim ice
#

o

eternal oxide
#

so check each list.contains

quaint mantle
grim ice
eternal oxide
#

no you can loop the keyset

grim ice
#

o

queen niche
#

Does someone know a program that is able to check a folder on Malformed JSONs? I have a resource pack full of jsons, deleted the ones I donโ€™t use, validated the ones I edited all seems fine but it keeps giving me a Json malformed error.

eternal oxide
#
boolean found = false;
for(UUID key: leaders.keySet()) {
  if(leaders.get(key).contains(player.getUniqueId())) found = true;
}```
grim ice
#

u forgot

#

.keySet()

#

lul

#

ty tho

#

ur so helpful damn

eternal oxide
#

fixed ๐Ÿ˜‰

grim ice
#

btw

#

another quick question

#

how to check if the for loop found anything with the if requirements

#

OH

#

I GOT AN IDEA

#

int i = 0;

#

i++;

#

ezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

eternal oxide
#

why do you need an index?

#

what are you doing with the search?

#

if you just want to check if they are in any of the lists boolean found = false; before the loop, then in the loop if found = true;

torn oyster
#
            World w = Bukkit.getWorld("world_active");
            for (Chunk c : w.getLoadedChunks()) {
                for (BlockState b : c.getTileEntities()) {
                    if (b.getType() == Material.CHEST) {
                        chests.add(b.getBlock());
                        if (b.getY() == 126 || b.getY() == 118) {
                            addLoot(b, LootTable.ISLAND);
                        } else {
                            addLoot(b, LootTable.MIDDLE);
                        }
                    }
                }
            }```
why are some chests not having items added
eternal oxide
#

updated code

#

I'd make some utility methods for things like that

grim ice
#

idek how to return your favors man

eternal oxide
#

like isLeader, hasGroup, getLeader(Player member)

wary harness
ancient plank
#

] - '&b,

wary harness
#

s.replaceFirst("- '","- "");

#

why is this not working

arctic moth
#

how do you do this.getConfig inside of a different class

ancient plank
#

?di

undone axleBOT
wary harness
#

so I am replacing - ' with - "

#

first one

#

in string

#

and from some reason it wont replace it

#

any ideas

eternal oxide
wary harness
eternal oxide
#

yes

quaint coral
#

I'm getting an error when more than one person joins a server, I can't send pictures though

wary harness
eternal oxide
#

I guess not

wary harness
vague oracle
#

If you are using paper you could set max joins per tick to 1

eternal oxide
wary harness
#
  • '
#

betwean

eternal oxide
#

Still works System.out.println("- ' &b".replaceFirst("- '", "-\""));

quaint coral
#

[Disconnect] User MerryArbo has disconnected, reason: Internal Exception: java.io.IOException: Error while read(...): Connection reset by peer
Spigot 1.8.8

opal juniper
#

spigot 1.8 not supported here

lost matrix
wary harness
eternal oxide
#

๐Ÿ™‚

wary harness
#

idiot

#

confirmed

opal juniper
#

seems like a me thing to do

wary harness
#

just got of work after 12h

wary harness
#

and thought good idea would be code something

#

xd

#

not sure any more

#

Thanks guys

lost matrix
torn oyster
#

they are all chunks around 0,0

grim ice
#

Elgar

#

o is he here

quaint coral
lost matrix
#

Those are some dangerously hard coded conditions you got there. I think you should just use the PDC of the Chests
and make a command that adds the PDC tag to a chest.

You can get Chunks by calling World#getChunkAt(int, int)

tall dragon
lost matrix
opal juniper
#

what smile said

quaint coral
lost matrix
lost matrix
opal juniper
#

and donโ€™t you even dare say that hypixel uses 1.8 or whatever - hypixel uses a jar so dissimilar from spigot that it is completely different story

tall dragon
opal juniper
#

for 1, theirs is maintained

#

wait people use plain bukkit still?? xD

tall dragon
#

for some reason

#

yes

opal juniper
#

paper ftw

ivory sleet
#

Yatopia fingergunsanimated

opal juniper
#

spigot people are cooler tho

#

xD

#

conclure

#

no

ivory sleet
#

Did you change name?

opal juniper
#

myeah

ivory sleet
#

mok

#

mnice

opal juniper
#

mwhatever

paper viper
#

๐Ÿ™

ivory sleet
#

Uh a server I was dev on did

#

So technically yes

paper viper
#

Doesnโ€™t it have bad reputation

#

Lol

#

Airplane is better I heard

ivory sleet
#

Uh lol yes perhaps

quaint coral
paper viper
#

No

grim ice
#

StringBuilder message = new StringBuilder();
for(String arg : args) {
message.append(arg);
}

quaint coral
#

;-;

grim ice
#

this will build a message

#

of command argumentsr

#

right

ivory sleet
#

Sure will

#

then ::toString()

paper geyser
#

so yk how when you go to break smth with a sword in creative it does nothing?

lost matrix
ivory sleet
#

Ye

paper geyser
#

well

#

TIL it still sends a break packet

tall dragon
paper geyser
#

and triggers "BlockBreakEvent"

paper viper
#

Doesnโ€™t String.join exist?

ivory sleet
#

Yeah

tall dragon
#

probably

ivory sleet
#

Tho idr if it took regex only

tall dragon
#

but i use my own join method so i was just looking for one lmao

grim ice
#

o

paper geyser
#

any ideas why it triggers blockbreakevent?

ivory sleet
#

Thatโ€™s weird

paper viper
#

Maybe it also tracks break stages?

paper geyser
#

maybe?

ancient plank
#

I had a weird bug with one of my plugins where somehow ops could break blocks with a sword lul it was wonky as fuck because I had no idea why it happened, and I couldn't reproduce it on my dev server.

quaint mantle
#

@chrome beacon btw should I import spigot-api 1.13 too ?

#
  • You told me 1.13 api + jdk 8.
  • Direct access is possible for NMS pre1.17 (within my NMS submodules that include full spigot server as compileOnly dependency)
  • Since accessing to java 16 compiled classes with java 8 will fail, 1.17+ NMS can only be done using reflexion

But in the main project, what spigot-api should I include as dependency ? 1.13 ?

paper geyser
#

i use 1.13

naive brook
#

so my code console logs the lines read frm scoreboards.yml but it doesn't display more than a few lines on the scoreboard

quaint mantle
naive brook
#
int size = stringbuilder.eventScoreboard().size() + 1;
        for (int i = 0; i < stringbuilder.eventScoreboard().size(); i++) {
            StringBuilder current = stringbuilder.eventScoreboard().get(i);
            Team team = scoreboard.registerNewTeam("team"+i);
            if (current.length() <= 16 ) {
                System.out.println(current+"Current: "+current.length()+ "Index: "+i);
                team.setPrefix(colors(current.substring(0, current.length())));
                team.addEntry(ChatColor.GRAY+"");
                objective.getScore(ChatColor.GRAY+"").setScore(size);
             } else if (current.length() <= 32) {
                 System.out.println(current+"Current: "+current.length()+ "Index: "+i);
                 team.setPrefix(colors(current.substring(0, 16)));
                team.addEntry(colors(current.substring(16,current.length())));
                objective.getScore(colors(current.substring(16,current.length()))).setScore(size);
            } else if (current.length() <= 48) {
                System.out.println(current+"Current: "+current.length()+ "Index: "+i);
                team.setPrefix(colors(current.substring(0, 16)));
                team.addEntry(colors(current.substring(16, 32)));
                team.setSuffix(colors(current.substring(32, current.length())));
                objective.getScore(colors(current.substring(17,32))).setScore(size);
            } else if (current.length() > 48) {
                System.out.println(current+"Current: "+current.length());
                team.setPrefix(colors(current.substring(0, 16)));
                team.addEntry(colors(current.substring(16, 32)));
                team.setSuffix(colors(current.substring(32, 48)));
                objective.getScore(colors(current.substring(17,32))).setScore(size);
            } else {
                
            }
            System.out.println(size);
            size = size - 1;
        }
``` why isn't it displaying
tall dragon
#

it has so much repeated code. you should really make a method to handle some ofthat

quaint mantle
#

how do i get the locations iwthin a chunk?

quaint mantle
naive brook
tall dragon
#

but what are you trying to achieve right now

naive brook
#

ooh that

#

was the problem

#

i fix it

tall dragon
#

so its working now?

naive brook
#
if (current.length() <= 16 ) {
                System.out.println(size);
                System.out.println(current+"Current: "+current.length()+ "Index: "+i);
                team.addEntry(colors(current.substring(0,current.length())));
                objective.getScore(colors(current.substring(0,current.length()))).setScore(size);
             } else if (current.length() <= 32) {
#

changed

#

the line

#

instead of being the entry empty

#

i made it

#

works flawless

#

thanks

tall dragon
#

you should still make yourself a method to handle the substring shit along with color

#

will be much cleaner

tall dragon
#

alright. well good luck

naive brook
#

thanks people

tall dragon
#

like the corners of a chunk or something?

quaint mantle
#

just check to see if a location is within a chunk*

tall dragon
quaint mantle
sullen dome
#

i actually stated that in past i guess, but... what is the fucking reason for it not showing in "autocompletion"?

#

thats not for this specific case only, it's often occuring for random classes

tall dragon
#

maybe just intellij bugs

#

honestly i hate the new versions

#

i still use 2019

#

its the best

sullen dome
#

it's actually an older one already

#

bc i dont like material theme beeing paid lol

tall dragon
#

well the recent versions just contains random freezes as well

#

for no reason

sullen dome
#

oh

#

cyberpunk ide?

tall dragon
#

i guess Xd

#

i have a pretty solid rig. but still had problems. so i gladly reverted back to 2019

sullen dome
#

tbh, if eclipse wouldn't look like a messy 2012 app, i'd probably switch

#

intellij lets me hate it more every day

tall dragon
#

not me. i think eclipse is even more shite ๐Ÿ˜‚

sullen dome
#

well, eclipse works at least

tall dragon
#

true

#

but intellij offers alot more

sullen dome
#

yea

#

but doesnt work xd

tall dragon
#

seems like a dilemma ๐Ÿ˜‚

sullen dome
#

or is it a general thing that stuff from gradle libraries doesnt appear in autocomplete list

tall dragon
#

but i have encountered classes not showing up either. but for me it was only when i just added a library

#

after id use 1 import it would then autocomplete any more

eternal oxide
#

Install teh plugin DevStyle for Eclipse

sullen dome
#

same for this one if not imported already

#

devstyle doesnt make eclipse look good

#

it makes it look better

#

but better doesn't mean good

#

and tbh, it's not hard to make eclipse look better

tall dragon
#

am i the only one using a background on my ide? haha

sullen dome
#

i dont remember how to do that lol

#

thats the reason i dont

tall dragon
#

Settings > apearance & behavior > apearance > background image

sullen dome
#

uiii

#

thanks bud

eternal oxide
#

DevStyle

#

Looks good to me

tall dragon
#

doesnt outdo this for me though

sullen dome
#

now i'm getting more weirdo again, yessir

tall dragon
#

lmfao

eternal oxide
#

Backgrounds are for desktops not programs ๐Ÿ˜‰

sullen dome
#

backgrounds for programs are a nice addition

#

i mean

#

you don't have to use it

eternal oxide
#

I'd find them distracting. Give me a nice blank page to write on

sullen dome
tall dragon
#

well i had others those where distracting

#

but a dark one works good for me

sullen dome
#

imagine intellij would for example remove themes because someone says themes are for desktop environments

#

or remove dark mode because someone says light mode is better

eternal oxide
#

Its not about removing if it never had it in the first place

sullen dome
#

then replace my remove with never added

tall dragon
#

imagine using discord light mode ๐Ÿ™ƒ ๐Ÿ˜‚

sullen dome
#

discord light mode be like nuclear bomb

#

i remember using a gif background in intellij

#

but removed it as it lagged my pc to hell somehow

tall dragon
#

nah man

#

that would actually be too distracting

sullen dome
#

yeah kinda

#

but tbh, it's distracting enough to see YoU WaNnA ShArE YoUr aNoNyMoUs dAtA? like every 5 seconds

#

dunno why it does that for me

tall dragon
#

huh

#

never seen that

sullen dome
#

it often just shows random popups again for me, idk

#

because NETHER_BRICK_ITEM doesn't exist afaik

eternal oxide
#

what item and what spigot version?

#

What item?

sullen dome
#

afaik, it's NETHER_BRICKS

eternal oxide
#

it should be NETHER_BRICK. NETHER_BRICKS would be the block type

sullen dome
#

weird

#

well, idk

#

What does NETHER_BRICK give you

opal juniper
#

like singular brick

twilit crown
#

hello all!
I had a quick question about Bungeecord! So if I have two servers, each set in their individual server.properties to have their player limit at sayyyy 50 players.
and then in my Bungee proxy I setup my priorities section in the config.yml
Once Server1 is full of players, will bungeecord auto redirect players to Server2?
More specifically, will Bungeecord redirect a player to Server2 as long as they aren't able to connect to Server1 (Like if connecting to server1 fails it'll attempt server2?) Like say they aren't whitelisted on Server1 for example.

I'm just trying to understand how that all works

eternal oxide
#

No its not a queuing system.

#

It by default sends everyone to the lobby server

#

then from there you send them wherever you want

earnest lark
eternal oxide
#

Ask specific questions and probably

earnest lark
#

ok

maiden cape
#

btw does anyone know where that image of slot numbers is
for player inventories

earnest lark
#

private final Player player; this does not work

twilit crown
maiden cape
eternal oxide
eternal oxide
#

final fields have to be assigned at definition or in the class constructor

earnest lark
#

how i dont know how to do that

twilit crown
#

@earnest lark heres a code example

earnest lark
#

ok

eternal oxide
#

learn what a class constructor is

earnest lark
#

oh

twilit crown
eternal oxide
#

So if you create a final Field you must either set it when you define it or set it in the class constructor

earnest lark
#
        Channel channel = nmsPlayer.getHandle().b.a.k;```
this is not working
analog inlet
#

How can I build Spigot without using build tools?

earnest lark
eternal oxide
kind patrol
eternal oxide
analog inlet
#

i looked build tools source code, there is a lot of git command and maven command

errant drift
#

There are a few things in standalone section of spigot that build it for you

#

Use if you want ๐Ÿคทโ€โ™‚๏ธ

#

Buildtools is easy though

analog inlet
#

I don't really get what they mean

eternal oxide
analog inlet
#

Actually I want to recompile entire 1.17 to Java8

eternal oxide
#

you can;t

#

Minecraft itself requires java 16 as a minimum for 1.17

analog inlet
#

but I can recompile it

eternal oxide
#

No

analog inlet
#

and fix the error by my self

eternal oxide
#

it doesn;t work like that

analog inlet
#

If minecraft uses some new features

eternal oxide
#

You can;t recompile Minecraft

analog inlet
#

Why is it?

eternal oxide
#

There is far too much that is integral to Java 16 in MC 1.17

#

It would be like trying to fit a 8 ltr V8 into a horse and buggy

analog inlet
#

But it still possible right?

eternal oxide
#

Its possible if you had years of experience. But you don;t

analog inlet
#

I dislike J9+ Module System

#

And original Spigot don't have a Kotlin Object classes support

eternal oxide
#

You are not forced to use teh Module system

#

everythign you did on 8 will work on upto 14?

analog inlet
#

I'm lazy to pass JVM args

eternal oxide
#

You mean you want reflection

analog inlet
eternal oxide
#

There are ways around some of it but most is a case of getting used to

#

What part is your main issue?

analog inlet
#

Like: GSON can't access some fileds

eternal oxide
#

Yes, final fields

analog inlet
#

I know that can solve by pass JVM args

eternal oxide
#

and it seems there are no plans to work around it

#

the JVM args is going away soon too

analog inlet
analog inlet
#

So I want to recompile Minecraft to a older version

#

Without module system

eternal oxide
#

its going ot be a case of rewite what you need in your plugins to not use final if you want to serialize

sullen dome
young knoll
#

You can bypass the reflection with Unsafe

#

Not that I would know

earnest lark
#

ok i have a npc spawn when a player dies but now i want it so that if i click on the npc it will bring up the inventory of the dead player can anyone help

eternal oxide
#

not on 16 you can;t

analog inlet
young knoll
#

You can

eternal oxide
#

I tried every which way and never got it to work

analog inlet
#

I tried that before

eternal oxide
#

tried sun and everything

analog inlet
#

And also who writes this build tools

eternal oxide
#

Luckily my issue was with the class loader and spigot implemented a Libraries feature which got around my problem

young knoll
#
private static Unsafe getUnsafe()
        throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
    Field field1 = Unsafe.class.getDeclaredField("theUnsafe");
    field1.setAccessible(true);
    Unsafe unsafe = (Unsafe) field1.get(null);
    return unsafe;
}
#

That method worked fine for me

analog inlet
young knoll
#

That just gets the unsafe

analog inlet
#

I remember Unsafe is final field

eternal oxide
#

yeah. getting is simple

#

changing is where it falls apart

young knoll
#

?paste

undone axleBOT
analog inlet
#

Recompile to Java8 is quite easy for changing plugin code

young knoll
analog inlet
#

My plugins are all Kotlin and have no Module System support

#

And Everytime the main class without a object and is singleton

#

looks weird

young knoll
#

I guess I should just share the entire class, I got the methods from a UnitTest framework after much searching

Edit: Powermock is the framework

knotty ruin
#

What method could I use to update lighting in a specific chunk? I'm looking to do this through 1.17 (NMS is fine).

eternal oxide
#

I'll take a look at that later. Could be handy, thanks.

covert bluff
#

How would I make it so that if the player's health is 20.0, it becomes 10? etc etc

knotty ruin
#

divide by 2 (can't use troll emote here sad)

covert bluff
#

That's what I did, but weird things happened with it

#

I want it to only show things such as 10.0, 9.5, 4.5 etc etc

eternal oxide
#

do you mean you are getting too many hearts or something?

covert bluff
#

But it's showing things like 5.003 or 5.351

knotty ruin
#

subtract 10

covert bluff
analog inlet
#

Maybe is the float calculate problem?

knotty ruin
#

then subtract by 10

#

20 - 10 = 10, 19 - 10 = 9, 18.5 - 10 = 8.5

covert bluff
analog inlet
#

Add a if

#

if (health < 10) return health

eternal oxide
#

or set a health scale

young knoll
#

Or just round the output

#

Using String.format or DecimalFormat or whatever

covert bluff
#
public static double round(double value, int places) {
        if (places < 0 ) throw new IllegalArgumentException();

        long factor = (long) Math.pow(10,places);

        value = value * factor;
        long tmp = Math.round(value);
        return (double) tmp / factor;
    }
#

This is pretty much what I did, but I'm not sure if it made a difference or nah

#

It's still showing things like 6.531

#

If it's 6.531, I want it to only show 6.5

young knoll
#

Or just round the output
Using String.format or DecimalFormat or whatever

covert bluff
#

And if it's 6.003, I want it to only show 6.0

analog inlet
#

use String.format

#

or you can times it by 100 then mod 10

covert bluff
#

How do I round it with String.format?

heavy mason
#

Can someone assist me on how I would use CompleteableFutures. I'm using MySQL and have a save method that returns a boolean that I need to obtain for a check. So far I have something like:

public void saveMyObj(MyObj myObj){ 
    CompleteableFuture<Boolean> future = CompletableFuture.supplyAsync(() -> database.save(myObj))
    if(future.get()){
      //Do something
    }
}

Would I just surround it all in a try-catch?

analog inlet
young knoll
young knoll
covert bluff
#

So String hp = String.format(health,"%.2f"," "); or something?

#

Hang on let me view string format docs, kind of forgot to use that thing

silver shuttle
#

https://paste.md-5.net/miwezesore.java
I'm just trying to make a command that opens a GUI for the player (using the example GUI code from Spigot), everything works properly (the GUI opens and the events are working fine, but for some reason the condition to cancel the events (e.getInventory() != inv) is never true in that command
I tested the events by removing the line and it worked fine

heavy mason
young knoll
#

Sending a message is fine to do async

#

But thenAccept should run sync anyway

heavy mason
#

Ah okay

#

Thank you ๐Ÿ‘

covert bluff
#

I honestly have no idea how to round off the stuff

young knoll
#

String.format("%.2f", health)

covert bluff
#

Let me try that out

#

Oh, that works, thanks!

white obsidian
#

Hello I'm using the net.minecraft.server library for the first time and I'm a little confused why all the methods and variables have strange names like bV bP etc. Have I added it wrong and if not, how am i meant to know what each one is? Also really sorry if this isn't the right place.

young knoll
#

It's obfusicated

silver shuttle
#

https://paste.md-5.net/miwezesore.java
I'm just trying to make a command that opens a GUI for the player (using the example GUI code from Spigot), everything works properly (the GUI opens and the events are working fine, but for some reason the condition to cancel the events (e.getInventory() != inv) is never true in that command
I tested the events by removing the line and it worked fine

white obsidian
eternal oxide
#

compare to top inventory from teh view or clicked inventory

silver shuttle
#

well that's where the problem is

#

top one is the one it's comparing to, bottom one is the one it has open

#

but I don't see why it is null, it wrote something to inv earlier

vivid lily
#
package org.jade.plugins.lifesteal.Commands;

import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class TestKill implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player player = (Player) sender;
        if (!(player == null)) {
            if (args.length >= 1) {
                if (args[0].equalsIgnoreCase("add")) {
                    AttributeModifier modifierAdd = new AttributeModifier("generic.max_health", 2.00, AttributeModifier.Operation.ADD_NUMBER);
                    player.getAttribute(Attribute.GENERIC_MAX_HEALTH).addModifier(modifierAdd);
                    player.sendMessage("test");
                    return true;
                }
            }
            AttributeModifier modifier = new AttributeModifier("generic.max_health", -2.00, AttributeModifier.Operation.ADD_NUMBER);
            player.getAttribute(Attribute.GENERIC_MAX_HEALTH).addModifier(modifier);
        }
        return false;
    }
}

When I try to add more hearts... it wont. Whats going on?

young knoll
#

I assume the test message gets printed?

silver shuttle
vivid lily
#

no error

vivid lily
young knoll
#

Interesting

vivid lily
#

also when i use attribute command to set it to 10

#

20

#

it does nothing

young knoll
#

The vanilla one?

vivid lily
#

ye

young knoll
#

Do you have other plugins that may be interfering?

vivid lily
#

this is only plugin

young knoll
#

Is your spigot up to date?

vivid lily
#

yep

young knoll
#

Weird client that might be messing with it?

vivid lily
#

wait one second

#

when i use

#

the /testkill add command

#

than try to add attribute vanilla way it does add one heart

#

and that is what the testkill command does...

#

why isnt it updating than? and why cant i change it to lower or higher

young knoll
#

What do you mean lower or higher

vivid lily
#

like testkill add only adds 1 heart and when i use vanilla after that it shows that one heart but when i try to use vanilla to set it to 10 hearts it just doesnt

#

nvm now it is working..

#

wierd

quaint mantle
#

public void onInventoryClick(InventoryClickEvent event) {
if (!event.getInventory().getName().equalsIgnoreCase("asdasd")) {
return;

#

No

#

thats unreliable and dangerous if anither plugin interferes

#

if you want it to be impossible to pick up and put items in the gui - event. setCancelled(true);

quaint mantle
silver shuttle
#

also it needs to support multiple players

quaint mantle
#

cleaner, expandability, abstractation, yours should work

quaint mantle
silver shuttle
quaint mantle
#

is it registered?

#

what if another inventory is created in another plugin called inv?

silver shuttle
#

I am currently trying to add all inventories created by the custom gui command to a list and check if they are in the list in those events, but that gives me weird behaviour

quaint mantle
#

someone else will help ill brb

#

public class GUI implements Listener {

public static void openGUI(Player p) {
    Inventory inv = Bukkit.createInventory(null, 27, "Name");
    inv.setItem(0, ItemUtil.create(Material.STONE, 1, (byte) 0, "Name-item", "null", null, null, null));
    
        p.openInventory(inv);

}

@EventHandler
public void onInventoryClick(InventoryClickEvent event) {

    Player player = (Player) event.getWhoClicked();
    ItemStack clickedItem = event.getCurrentItem();

    if (!event.getInventory().getName().equalsIgnoreCase("Name")) {
        return;
    }

    if (clickedItem == null || clickedItem.getType() == Material.AIR || !clickedItem.hasItemMeta()) {
        return;
    }

    event.setCancelled(true);

    if (!event.getCurrentItem().getItemMeta().getDisplayName().equals("Name-item")) {
        return;
silver shuttle
#

?paste

undone axleBOT
quaint mantle
silver shuttle
#

no, that is not a unique identifier

quaint mantle
#

in sense