#help-development

1 messages · Page 1443 of 1

pulsar zenith
#

Thank you to you both for helping me!

lofty mulch
#

np

somber hull
#

Ok

#

I give up

#
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getClickedInventory() instanceof PlayerInventory) {
            Player plr = (Player) event.getWhoClicked();
            Location loc = plr.getLocation();
            for (ItemStack item : event.getClickedInventory().getContents()) {
                if (item == null)continue;
                //ItemStack itemClone = new ItemStack(item.getType());
                //if (!(item.isSimilar(itemClone)))continue;
                if (NBTEditor.getBoolean(item, "ischecked"))continue;
                for(String key : plugin.getConfig().getConfigurationSection("blocks").getKeys(false)){
                    if(item.getType().toString().equalsIgnoreCase(key.toString())) {
                        plugin.getServer().getLogger().severe("d");
                        if (!(item.getAmount() >= config.getInt("blocks." + key)))return;
                        plugin.getServer().getLogger().severe("e");
                        sendWebhook(item, plr, loc, item.getAmount(), false);
                        punishCheck(item, plr, loc, item.getAmount());
                    }
                }
            }
        }
        }
#

help

#

for some reason this aint working

#

if(item.getType().toString().equalsIgnoreCase(key.toString())) {

#
blocks:
  sand: 12
#

this is the config section for blocks

#

if(key.equalsIgnoreCase(item.getType().toString())) { i changed it ot this and it still dont work

#

its just normal sand

#

no NBT

young knoll
#

Did you try like

#

Printing the two values to see how they compare

somber hull
#

no

young knoll
#

Maybe try that

somber hull
#

yea

#

will do

#

WHAT THE FUCK

#

why is the key == netherite_block

young knoll
#

Check the config file

somber hull
#

its only sand

young knoll
#

Evidently it’s not

somber hull
#

this is in my onEnable

#
public void onEnable() {
        loadConfig();
#
    private void loadConfig() {
        saveDefaultConfig();
    }
}
young knoll
#

And what is in the config inside your jar

#

And the one inside the server

somber hull
#
blocks:
  sand: 12
#

thats the one

#

inside the server config

#

It has nothing to do with netherite_block

#

the default config is

#
blocks:
  netherite_block: 64
#

but thats the defaULT CONFIG

#

not the one i have saved

young knoll
#

No idea

#

I don’t really use the built in config API so I’m not sure how default configs work

somber hull
#

ok

#

i figured it out

#

im dumb

cinder thistle
#

saveDefaultConfig should be enough

#

It’s all I do

somber hull
#

i fixed it

#

but

#

i have a different issue now

sage swift
#

no issues

somber hull
#
    public void punishCheck(ItemStack item) {
        
            
            item.setType(Material.AIR);
            plr.updateInventory();
        }
sage swift
#

fix them yourself

somber hull
#

i have this method

sage swift
#

dont setType air

#

setType null

somber hull
#

ok well i tried that

#

and it still doesnt work

quaint mantle
#

Is there a way w/o NMS/Packets to cancel a dismount event?

somber hull
#

that method is being called

#

and a item being passed to it

#

it should still change the items type right?

sage swift
sage swift
somber hull
#

ItemStack item

sage swift
#

:]

#

i know

somber hull
#

and i call it with method(item)

sage swift
#

it'll obviously change the item, but will it update in the player's inventory?

somber hull
#

i have player.updateInventory()

sage swift
#

a useless method

somber hull
#

it just odesnt effect the item still

sage swift
#

when changing an item, the inventory will update

somber hull
#

Oh ok

sage swift
#

again, how are you passing the item in

young knoll
#

Don’t setType to null

somber hull
#

what do you mean?

sage swift
#

where are you getting the itemstack from

young knoll
#

Set the slot in the inventory to null

somber hull
#

Im looping through every item in the inventory

somber hull
sage swift
#

could do item = null;, no?

somber hull
#

ill try it

sage swift
somber hull
#

Cause everything was working

#

IDK what changed

#

litterally nothing changed

sage swift
#
for (int i = 0; i < inv.getSize(); i++) {
  if (!(matches your criteria)) continue;
  inv.setItem(i, null);
}```
somber hull
#

yea no

#

thats not working

#

nor is it the issue

#
        if(config.getString("punishment").equalsIgnoreCase("delete") || config.getString("punishment").equalsIgnoreCase("both")) {
            item.setType(Material.AIR);
            plr.updateInventory();
        }
#

this is called through a method

#

in the config punishment is set to delete

#

and it was working before

#

so idk

sage swift
#

for like the fifth time, how are you passing the item into the method?

#

is it just player.getInventory().getItemInMainHand?

somber hull
#

What does that mean

#

oh

#

no

#

**for (ItemStack item : event.getClickedInventory().getContents()) {**

sage swift
#

now see

somber hull
#

im passing item

sage swift
#

getContents is a copy

#

so it doesn't actually have the references to the original items

somber hull
#

ok, then why did it work before?

sage swift
#

which is why you set it, it doesn't work

#

did it work with the same setup?

somber hull
#

Yea

#

i litterally changed the API version in plugin.yml and the plugin name

sage swift
#

or did you have for (ItemStack item : event.getClickedInventory())?

#

^ try that

somber hull
#

ok

#

yea, same thing

quaint mantle
#
@EventHandler
    public void cantdismount(EntityDismountEvent e) {
        if (e.getDismounted().getName().contains("sucks_cant_leave")) {
            e.setCancelled(true);
        }
    }

Tried this, but on my screen I dismount and can move around, but on others im there

sage swift
#

ah yes the classic desync

#

you could probably let it happen and then mount the player back on one tick later?

sage swift
#

i know

#

you just said that

somber hull
#

oh

#

sorry

sage swift
#

save getContents to an ItemStack[] and use inventory.setContents after you're done removing

young knoll
#

I would try cancelling the entity interact event instead

#

Might look a little funky but it may stop the Dwayne

sage swift
#

EIaE is called for dismount??

young knoll
#

What

sage swift
#

what are you talking about cancelling

young knoll
#

Ah wait it’s dismount

somber hull
#

@sage swift welp. Now i gotta figure out how to do the same thing, but for a chest

#

its not working

#

Like i trieds it already

young knoll
#

You’ll need to manually send a mount packet to the client

#

Or just mount them again a tick later I guess

somber hull
#
            item.setType(null);
            inv.setContents(items);
            plr.updateInventory();
sage swift
#

no need for the updateInventory

somber hull
#

ok

sage swift
#

and i believe you need Chest#update

#

not quite sure about whether it's needed for inventory manipulation

somber hull
#

I looked up the documentation

#

cant find it

sage swift
#

what do you mean by "i gotta figure out how to do the same thing, but for a chest"

somber hull
#

So, it should do the same thing. Remove the item

#

wait

#

ok, so does it matter if i put api version in the plugin.yml

sage swift
#

shouldn't change anything about the plugin, no

somber hull
#

cause thats the only thing i changed and this all stopped working

young knoll
#

Using setItem(slot, null) would work for any inventory

somber hull
#

it is the fucking API version

sage swift
#

did you set it to 1.12

#

you should definitely set it to 1.12

somber hull
#

you can only set ti to 1.13+

#

I just deleted the thing entirely

#

and the plugin works

#

theres a dumb message on startup

#

but it works

young knoll
#

That makes 0 sense

#

I guess removing it defaults you to legacy materials, maybe that somehow affects it

#

But please don’t do that

somber hull
young knoll
#

Because you shouldn’t be using legacy stuff if your plugin is meant for modern versions

#

Also the legacy material system is cursed

somber hull
#

im having issues with that right now

#

how do i fix it so im not relying on the legacy system

#

nvm

#

ill fix it tomorrow

wispy fossil
#

So I have an interesting question for any world gen junkies
is it possible to generate a new world with a custom generation starting point?

young knoll
sage swift
somber hull
#

Yea, but it breaks all ym code

#

i go sleap now

sage swift
#

without a certain starter

wispy fossil
sage swift
#

so why do you need to generate it from a starting point

#

he could look at the generation code and ore generation...

wispy fossil
#

and be able to locate specific veins of ore from that?
I have trouble wrapping my head around a way to do that

sage swift
#

simulate the generation, yes

wispy fossil
#

best of luck

sage swift
#

cannot for the life of me find the ore generation though

wispy fossil
#

doesnt ore generation rely on all passes of terrain generation though

#

it wont spawn just in mid air

#

it would, in the end, be basically the same as generating a full world - exclude block populators

#

still an interesting question

#

lmk if you find any resources

sage swift
#

yeah that's true it would depend entirely on other generation features

sage swift
#

EntityDropItemEvent isn't called when an entity dies

#

is there a different event for items from death?

summer scroll
vagrant stratus
sage swift
#

on 1.16.5, but i want to do stuff with the Items themselves, not the ItemStacks

summer scroll
#

ah okay.

#

what about ItemSpawnEvent?

sage swift
#

using that now, just comparing locations

quaint mantle
#

any1? 🙂 spigot

quaint mantle
#

you mean the Item entity right

worn tundra
wraith rapids
#

entitydropitemevent is for when they drop items without dying

#

like, uh

#

a zombie drops a tool after picking up a new one

#

or something

#

for the actual drops you need to use the entity death event and that only gives you itemstacks

#

and it doesn't even include all of the drops

#

wither roses f.e are not in the drops list

quaint mantle
#

can someone help me, I need to write a code for, logging the timestamp when a player joins, logging the timestamp of players when the server is closed or the player leaves, record both timestampsto know the playtime of player into seconds, minutes, hours and days
Log the data in to MySQL

What i have done: Linked the plugin with MySQL defined the player join event

lost matrix
quaint mantle
#

i need the entry and exit timestamps of player so that they can be turned into the play duration

lost matrix
#

Minecraft already tracks the time played...
But if you want to track it yourself:
Use the PlayerJoinEvent and the PlayerQuitEvent to track the time delta between joining and leaving.
Server stop doesnt need to be tracked as every player is kicked and the PlayerQuitEvent is fired.
@quaint mantle

wraith rapids
#

do a network request to the db every tick for every player to increment their ticks played by 1

#

remember to do it on the main thread

quaint mantle
#

is there a way to make one command to run multiple? 🤔 like replace %player% with player name and %kicked% for their kick reason? 🤔 i quite struggle with that xD 😅

lost matrix
#

Create a new table for every tick and add all players in there. Then you can later add up all tables that contain the UUID to know the total ticks played

lost matrix
quaint mantle
#

lets say we have this at the config

forwardcommand:
  commands:
    - kick %player%
    - staffmessage %player% got kicked for %reason%
#

has something to do with hashmap xD

worn tundra
#

.replace.replace.replace

lost matrix
#

So from your config -> List<String>
Then iterate over that list and execute each command after replacing all possible placeholders

quaint mantle
#

ty

#

what a weird system

quaint mantle
#

or is there an more efficient way?

outer sorrel
#

im using packetevents plugin for this
with WrappedPacketInBlockPlace how could i get if they actually placed a block or if they just right clicked a block? also im using PacketType.Play.Client.USE_ITEM because PacketType.Play.Client.BLOCK_PLACE didnt work

coral sparrow
quaint mantle
#

what happened to simply using the interact event @outer sorrel

quaint mantle
coral sparrow
#

ok ty

coral sparrow
worn tundra
#

Item in hand is null

coral sparrow
#

it works fine

#

but

worn tundra
#

do a null check

coral sparrow
#

ok

worn tundra
#

or it's itemmeta

#

or display name

coral sparrow
#

it works fine lol

#

console just spams

quaint mantle
#

simple null checks should fix it

worn tundra
#

works fine?

#

try using an empty hand in your event

coral sparrow
worn tundra
#

or a vanilla item from creative

lofty mulch
#

It worked only when you have ITEM ON YOUR HAND

worn tundra
#

when does it spam?

lofty mulch
#

It spammed because you dont have any ITEM ON YOUR HAND

coral sparrow
#

when plugin enables

lofty mulch
#

wait

#

wot

worn tundra
#

What are you even doing lol

outer sorrel
coral sparrow
worn tundra
#

Main is a very vague way to name a class

coral sparrow
#

I used plyjoinevent xd

worn tundra
#

What does your plugin do son

outer sorrel
#

or is that for other person

coral sparrow
outer sorrel
#

so many people

lofty mulch
#

the error you pasted doesnt relate to onEnable

coral sparrow
#

the skill*

worn tundra
coral sparrow
#

um

#

wdym

lofty mulch
#

the error is found on onInteract

#

not onEnable

coral sparrow
#

i never mentiond onenable

worn tundra
#

Check if the errors are different

lofty mulch
coral sparrow
worn tundra
#

YES

#

SO

#

THE ERROR

#

IS

#

IN THE ONENABLE

lofty mulch
#

ON ENABLE

worn tundra
#

lol

lofty mulch
#

but the error is NOT IN THE ONENABLE METHOD

coral sparrow
#

ik dud

#

idk why it doesnt spam later

worn tundra
#

ok dud

lofty mulch
#

DO A NULL CHECK

coral sparrow
#

OK

#

xd

lofty mulch
#

lol

#

just do a simple null check like they told u

#

I dont remember exactly it returns null or return air

worn tundra
#

Check both

lofty mulch
#

ah yes

#

air doesnt have meta iirc

#

xd

coral sparrow
#
``` On interact event
lofty mulch
#

yes but you have to check player.getInventory().getItemInHand() is skull or not

#

it's better than null check

coral sparrow
#

lmao

#

and it works fine

worn tundra
#

itemstack lol

lofty mulch
#

so it returns air if player has nothing in main hand

coral sparrow
#

f

coral sparrow
#

ik

lofty mulch
#

i dont know

#

xd

coral sparrow
#

the player has a stuff

worn tundra
#

Yes

lofty mulch
#

so can you show me the spamming error?

coral sparrow
#

if the plyer tries to click on the block on the 1 slot

coral sparrow
#

spams the same thing over and over again

worn tundra
coral sparrow
#

until it stops xd

coral sparrow
worn tundra
#

Bro

lofty mulch
#

can you check null: player.getInventory().getItemInHand().getItemMeta()

worn tundra
#

no

#

that can't be spammed

lofty mulch
#

can you show us all the event class

coral sparrow
#

k

#
    public void onInteract(PlayerInteractEvent event) {
        Action action = event.getAction();
        Player player = event.getPlayer();
        
        
            if (player.getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.YELLOW + "Profile") ){
                if(action.equals(Action.RIGHT_CLICK_AIR)){
                Inventory inv = Bukkit.createInventory(player, 9, ChatColor.YELLOW + player.getName() + "'s Profile");
                ItemStack lol = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
                stuff hapemns

            }```
#

leave the inv part

worn tundra
#

k

coral sparrow
#

forpgot to delete

lofty mulch
#

are you sure that:

if (player.getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.YELLOW + "Profile") 
#

is the line 70?

worn tundra
#

Show proof

lofty mulch
#

lol

quaint mantle
#

literally put before the if (player.getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.YELLOW + "Profile") ){

if (player.getInventory().getItemInHand() == null)
return;
lofty mulch
#

getItemInHand cannot be null

coral sparrow
quaint mantle
#

sry meant meta

#

bcz like hes getting npe bcz the item is null

worn tundra
#

this has become so messy

#

he didn't care about the npe

#

"it works"

coral sparrow
#

ye

#

wait

#

xd

#

i did a null check

#

xd

#

no consol,e psam

#

Spam*

quaint mantle
#

whats the error?

coral sparrow
#

but i want it to only work when i right click the skull with name Profile
so i have to check xd

coral sparrow
#

fr xd

quaint mantle
#

sorry i wasnt here from the start

#

then just get type and check it to skull

coral sparrow
#

ik

quaint mantle
#

why e.getEntity().setBedSpawnLocation(e.getEntity().getLocation()); throws Your home bed was missing or obstructed

#

do you check if the entity is player?

quaint mantle
#

could you show the code

worn tundra
#

;DDD

quaint mantle
#
@EventHandler
    public void OnDeath(PlayerDeathEvent e) {
        if(plugin.getConfig().getBoolean("showDeathScreen"))
        {
            Location loc = e.getEntity().getLocation();
            Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
                @Override
                public void run() {
                    e.getEntity().addScoreboardTag("death-event");
                    deaths.put(e.getEntity().getName(), e);
                    e.getEntity().setBedSpawnLocation(e.getEntity().getLocation(), true);
                    e.getEntity().spigot().respawn();
                    e.getEntity().setGameMode(GameMode.SURVIVAL);
                    e.getEntity().setGameMode(GameMode.SPECTATOR);
                }
            }, 1);

        }
    }```
#

(basically it respawns the player where he died and puts into spectator mode)

#

did you check if the location isnt null?

coral sparrow
#

null

quaint mantle
#

@quaint mantle ?

#

i dont think if player is dead then the location is null

quaint mantle
#

try setBedSpawnLocation(loc, true)

chrome beacon
#

Yeah it might actually look for a bed before respawning

#

I would teleport the player

quaint mantle
#

yw

quaint mantle
#

is there a value for what is displayed above the player's head, and can i edit it?

wraith rapids
#

that is the player's name

#

it is rendered by the client

#

to change it you need to change the player's actual name

#

you may be able to change it with protocol hacks without touching the actual userprofile but i'm not sure if that has weird side effects

quaint mantle
#

i know there's customName and displayName but are those separate?

quaint mantle
#

ok, ill try it, thanks!

turbid grove
#

as far as I know it can be done without protocol hacking

#

you can set prefix and suffix to scoreboard teams

#

then you can join the player of your choice to this team

wraith rapids
#

yeah but that can only append and prepend things to the name

#

it can't actually change the name

#

customName isn't used for players and displayName isn't shown in vanilla, it is used by plugins like chat formatters and whatnot

brittle igloo
#

Hey, I'm a starter in Java and Spigot and I hope you guys can guide me in the right direction.
In my main class i got:
if(args[0].equalsIgnoreCase("add")){
AddItem.AddItemHolding();
}
And in AddItem.class:
public class AddItem {

public static void AddItemHolding(){
    Player p = (Player) player;
    PlayerInventory inv = p.getInventory();
    p.sendMessage(inv.getItemInMainHand()+" added to configuration.");
}

}

But i have no clue how to make it so that i can declare player.
The function will be if somebody types pluginname add it adds the item the player is holding to the config.

young knoll
#

Pass it as an argument to addItemHolding

wraith rapids
#

there is probably no reason to have that in a static util method

lilac dagger
#

do you guys know if sending a plugin message to bungee will be interpreted at the moment of sending it or it can take some time after it?

wraith rapids
#

well it's a network request so

#

it's not gonna be instant

lilac dagger
#

i'm trying to kick players from a server if it takes longer

#

but if i kick a player from the server

#

after i sent a message

#

how would that work

#

would bungee first read the message and then handle the kick?

cold field
#

Is there a wiki that tell me all the possible datawatcher object id with their values?

wraith rapids
#

depends on the impl, i'm not sure

#

safest would be to have bungee respond with an "ok" once it's done with the data you've sent

#

and only kick the player then

lilac dagger
#

alright, thank you

wraith rapids
#

it's a few extra doodads but makes for a more robust protocol

cold field
#

😦

wraith rapids
#

write me a good crates plugin

cold field
#

?

wraith rapids
#

i need a good crates plugin

cold field
#

I think that you are a better developer then me...

wraith rapids
#

i don't have the effort

#

or time

cold field
#

XD

grizzled estuary
lilac dagger
#

i could do a simple crate plugin

wraith rapids
#

i'm too busy raving about dumb shit here

#

it'd have to not lag to shit

lilac dagger
#

of course

wraith rapids
#

and it'd have to support PDC values for the items it spawns in

lilac dagger
#

that's my way of looking at it

wraith rapids
#

fancy particles and maybe some shitty animation for rolling the loot is a plus but probably not necessary

#

i've looked at all of the popular crates plugins and either they don't support items with pdc values or they're "1.8-1.16" nms reflection nightmares

lilac dagger
#

would this support pdc?

#

it should

#

🤔

wraith rapids
#

yeah

lilac dagger
#

i think

wraith rapids
#

most crate plugins use some shitty essentials-like item syntax

#

which supports jack shit

#

and is gay

lilac dagger
#

lol

#

i had to look a bit on this problem

#

myself

#

even the bukkit serializer api wasn't cutting it

#

for my shulkers into shulker approach

wraith rapids
#

paper has a proper item serializer these days

#

not sure if spigot has one yet

lilac dagger
#

but then i don't wanna limit my plugin to paper

wraith rapids
#

well

#

it's not much of a limit

lilac dagger
#

still

wraith rapids
#

like two thirds of the userbase

#

plus there's also the argument that plugins built against paper generally perform better on the majority of servers

lilac dagger
#

well

wraith rapids
#

so the +60% of serburs that actually do run paper would rather have a paper-specific plugin than one who is just generally written for splögget

lilac dagger
#

i had my share of problems with paper

wraith rapids
#

i have plenty of problems with them too

lilac dagger
#

when i designed a minigame

wraith rapids
#

they banned me for being hitler

wraith rapids
#

and then banned me again for supporting 1.8

#

and then banned me a third time for being shrek

warm mica
#

You're so cool

eternal night
#

Tbh the shrek ban seems valid

lilac dagger
#

@warm mica nice bedwars plugin :3

warm mica
quaint mantle
#

How can I remove hit sound?but no dmg hit sound. so i meant, how to remove entity.player.attack.nodamage sound

wraith rapids
#

easiest is probably to drop the playsound packet

#

but if the sound is clientside, as some sounds are, there isn't really any way to do it

quaint mantle
#

i have not changed my plugin.yml at all and now this happens?

#
[13:26:36 ERROR]: Could not load 'plugins\main.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.space.App'
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:81) ~[patched_1.16.5.jar:git-Paper-669]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:137) ~[patched_1.16.5.jar:git-Paper-669]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:397) ~[patched_1.16.5.jar:git-Paper-669]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:305) ~[patched_1.16.5.jar:git-Paper-669]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:389) ~[patched_1.16.5.jar:git-Paper-669]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:252) ~[patched_1.16.5.jar:git-Paper-669]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1066) ~[patched_1.16.5.jar:git-Paper-669]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:290) ~[patched_1.16.5.jar:git-Paper-669]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]
Caused by: java.lang.ClassNotFoundException: com.space.App
        at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_291]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:182) ~[patched_1.16.5.jar:git-Paper-669]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:111) ~[patched_1.16.5.jar:git-Paper-669]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_291]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_291]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_291]
     at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_291]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:79) ~[patched_1.16.5.jar:git-Paper-669]```
young knoll
#

What is your main class

quaint mantle
#

com.space.App

eternal night
#

Well I guess you wanna make sure the file actually made it into the jar

#

You could open it with your favourite archive manager

quaint mantle
#

i just use eclipse to compile it into a jar and the whole folder goes in

spice juniper
#

I have a plugin with the 1.16.5 jar and the api version and I want that you can also use this on other versions

#

how can I do this

eternal night
#

Yeah I see that but concerning that the plugin yaml exists it seems to be to the jar that has an issue

#

If you wanna support older versions (why tho lmao) you will have to code against the lowest version

#

A plugin with API version 1.16 will not work on 1.15. you'll have to set it as the lowest version you wanna support

quaint mantle
eternal night
#

Look inside the jar

#

See if the class is missing in there

quaint mantle
#

oh damn

#

it is

#

lol

#

META-INF and plugin.yml

#

why is that

spice juniper
eternal night
#

Well there seems to be your issue huh

spice juniper
#

so i have to use the 1.13 api version?

eternal night
#

Yes

spice juniper
#

okay thank you

quaint mantle
#

ok ty its fixed now

eternal night
#

👌

cold field
#

Which datawatcher obj do I need to modify to enable second layer skin?

quaint mantle
#
public static FileConfiguration CitizensFile;
    public static File file = null;

    public void gogo() {
        file = new File(Bukkit.getServer().getPluginManager().getPlugin("totoServerPlugin").getDataFolder(), "Citizens/saves.yml");
        CitizensFile = YamlConfiguration.loadConfiguration(file);
        CitizensFile.getConfigurationSection("npc").getKeys(false).forEach(Bukkit::broadcastMessage);
    }

```Hello ![spigot](https://cdn.discordapp.com/emojis/728421352721088542.webp?size=128 "spigot")! How can I get config file from datafolder? It doesn't work : ( (NPE)
obsidian tree
#

how can i make FallingBlock won't disappear?

#

it disappears after about 10 sec when I summon

spice juniper
# eternal night Yes

But do I also need to use the 1.13 jar? or can I use the 1.16.5 jar that I'm using right now

eternal night
#

You will have to develop against 1.13

#

Using a 1.16 only method would break

spice juniper
#

so I have to change the 1.16.5 jar in my external libraries to 1.13?

chrome beacon
#

You don't have to but it's recommended so you don't use any new methods

spice juniper
#

okay and if I use the 1.16.5 jar in my library and put the api version to 1.16 can I use the plugin on any version of 1.16?

#

or only on 1.16.5

chrome beacon
#

All 1.16 versions

cosmic fjord
#

how can I wait for a answer from a player?

vagrant stratus
#

The Conversation API might be worth using, depending on what you're trying to do

tacit drift
#

not your plugin

cold field
tacit drift
#

file = new File(Bukkit.getPluginManager().getPlugin("Citizens").getDataFolder() + "saves.yml");

#

this is what you need to have

lilac dagger
#

do you guys know if the player count can be modified?

plain quest
#

what is the event for the packetplayinupdatesign?

vagrant stratus
#

There's no built-in events for packets them selves, you'll need to get protocollib or something, then it's just a matter of going through their documentation otherwise sign updates are SignChangeEvent

#

When it comes to ProtocolLib, iirc it's just a matter of listening for that specific event

pulsar zenith
#

Hi, I am trying to return a list but it is throwing a NPE.
What I am trying to do is use a dependancy injector to try to have a list that is the same in all of my classes.
But attempting to pull the list causes a NPE.

Class that stores the list: https://paste.md-5.net/ikepanofuh.java
Class that attempts to pull the list (causes NPE): https://paste.md-5.net/ogademaciw.java
Stacktrace: https://paste.md-5.net/ucajupowov.sql

Line 42 is ```java
if (speedrunnerTeam.contains(event.getPlayer().getName())) {

vagrant stratus
#

chances are speedrunnerTeam is null, which means manhuntGameManager isn't getting the list properly

#

ah

#

you're not setting the lists

glass sparrow
#

oop

pulsar zenith
#

How? I have tried that but it sometimes just doesn't work.

glass sparrow
vagrant stratus
#

^

pulsar zenith
#

Yea I have tried that

#

Still causes a NPE

#

I have tried to put a new ArrayList<>(); in both of my classes

ivory sleet
#

😔

#

Damn NPE

vagrant stratus
#
    public ClearInv(Main main) {
        this.main = main;
    }

If you call this then it'll throw an NPE as well, since it's not initializing the list

cold field
#

?paste

queen dragonBOT
vagrant stratus
#
public ClearInv(ManhuntGameManager manhuntGameManager) {
        this.manhuntGameManager = manhuntGameManager;
        this.speedrunnerTeam = this.manhuntGameManager.getTeam(Team.HUNTER);
    }

Is the only constructor that properly initializes everything

pulsar zenith
#

oh ok

#

so I also need to initialize it in my other constructor?

vagrant stratus
#

Ye

pulsar zenith
#

ok

vagrant stratus
#

calling a constructor creates a brand new class

ivory sleet
#

Does it tho

vagrant stratus
#

new ClearInv, yea

ivory sleet
#

Oh u meant like that

vagrant stratus
#

Ye

pulsar zenith
vagrant stratus
#

manhuntGameManager isn't initialized

coral sparrow
#

How to check if player is holding a Custom item

pulsar zenith
#

you could use Itemstack#isSimilar

#

and compare that to the custom item

coral sparrow
#

ok wait

#

xd

glossy barn
#

Could use player inventories and check the item meta

#

Check if item meta matches the custom item meta

coral sparrow
#

yea

#

ok thakns

glass sparrow
spice juniper
#

Is it possible to delete a standard minecraft recipe?

opal juniper
#

Does the EntityChangeBlockEvent get called when it goes from solid -> entity

earnest junco
chrome beacon
opal juniper
#

ok... it seems to be but idk

tacit drift
#

Called when any Entity changes a block and a more specific event is not available.

tacit drift
opal juniper
#

yeah

tacit drift
#

but like

#

what

#

a shulker?

opal juniper
#

sand

tacit drift
#

oooooh

#

i was thinking at a shulker

#

:)))))))

opal juniper
#

haha, no

lyric grove
#

how do i fix this not working?

#

the message still says link

cold field
glass sparrow
#

does that even work you have too many brackets

lyric grove
#

oh ill remove that

glass sparrow
#

just an fyi that last replace is outside of the CC.translate() brackets

chrome beacon
cold field
#

?paste

queen dragonBOT
cold field
lyric grove
#

my only issue is the args[1]

glass sparrow
#

did you add the bracket back at the end

#

why args[1] not args[0]

lyric grove
glass sparrow
#

you should be getting an error on that call tho

wraith rapids
#

protip

#

put each .replace on a new line

#

that way you don't fuck up the parentheses as horribly

dusk flicker
#

I hate that formatting

cold field
lyric grove
chrome beacon
#

Also I'd recommend making your life easier by using Citizens

cold field
#

This only for personal education porpoises.

glass sparrow
#

citizens kinda buggy

chrome beacon
#

That's the skin not layers

cold field
#

The skin works, it just not shows the second layer

#

Oh.

chrome beacon
#

Yeah you're not setting the layer data

cold field
#

ahaha

#

wow

#

How I do that?

chrome beacon
#

You're on your own with NMS

cold field
#

What do you mean?

chrome beacon
#

Find that yourself I don't feel like spending time to decompile and look through NMS

cold field
#

Ohhh

#

ok

chrome beacon
#

Well the data is in the Entity Metapacket and is in a byte

cold field
#

What I don't get it here is that the second layer is inside the skin data

chrome beacon
#

That's from what you sent earlier

lyric grove
#

how does this look?

glass sparrow
#

free promo

#

looks good

lyric grove
#

thanks xd

sleek pond
#

is that for youtube ranks or something?

opal juniper
#

So, i am trying to make a plugin that makes the tnt explosion look more realistic, however i have hit a bit of a wall. I want to make it so that when the FALLING_BLOCK hits the ground it persists for a bit. I am spawning these blocks by looping thru every affected block in the ExplodeEvent and then making a block with its texture. The problem is that, in order to stop them from despawning i have to use packets to intercept the ENTITY_DESTROY packet and cancelling it.

I am using the EntityChangeBlockEvent and then , if the id of the entity is in the set i cancel the event, causing it to destroy the entity but i then just cancel the event.

Then, the problem was that the falling blocks' velocity persists so i am now sending a packet to cancel their velocity when they land:

    @EventHandler
    public void onBlockChange(final EntityChangeBlockEvent event) {
        final int id = event.getEntity().getEntityId();
        if (this.blockIDs.remove(id)) {
            event.setCancelled(true);
            cancelVelocity(id);
        }
    }


    public void cancelVelocity(int id) {
        final PacketContainer veloctiyPacket = new PacketContainer(Server.ENTITY_VELOCITY);
        veloctiyPacket.getIntegers()
                .write(0, id)
                .write(1, (int) (0 * 8000.0D))
                .write(2, (int) (0 * 8000.0D))
                .write(3, (int) (0 * 8000.0D));
        Bukkit.getOnlinePlayers().forEach(player -> {
            try {
                RealPhysics.this.protocolManager.sendServerPacket(player, veloctiyPacket);
            } catch (final InvocationTargetException e) {
                e.printStackTrace();
            }
        });
    }

Which works for most of the entities, it is just that not all of them obey this new vector. I will attach an example

lyric grove
sleek pond
#

nice

opal juniper
#

Most of them work, just not all of them. Also, as a test i added some debugging output when i make, and when they land and i found these Discrepancies:

#

Where the left are the ones i made and the right are the ones detected

wraith rapids
#

define detected

opal juniper
#

by the listener

#

EntityChangeBlockEvent

#

I can't even think of a jank way to fix it tbh

#

you got any of the ideas @wraith rapids

#

ik you have some great ones

#

oh, and btw i tried to tp the blocks donw by 0.1, but it just caused a lot of issues of them rubber banding everywhere

#

oh i just realised that i overlooked sommin

wraith rapids
#

so the ones missing on the right are the ones that you spawned but never cancelled the destroy packet for and never heard the event for

opal juniper
#

umm, no

#

I did cancel the packet

sharp bough
#

i have a big proyect and so far i have been dragging and uploading files to github, but now it says try with less than 100 files, how can i upload it without having to slipt it into more parts

wraith rapids
#

but you said the event doesn't fire

opal juniper
#

but didn't detect on the listener

wraith rapids
#

you cancel the packet on the listener, yes?

opal juniper
#

yea

cinder thistle
sharp bough
#

do i create a new file and upload each part?

wraith rapids
#

i mean, you add the eid to the set of to-be-dropped destroy packets

cinder thistle
#

unless that's ids idk

opal juniper
cinder thistle
#

ah

opal juniper
#

i overlooked that if another tnt goes off next to them, they move anyways

#

cause it induces a velocity in them

wraith rapids
#

so the issue isn't that the packet doesn't get sent or applied properly

#

it's that the event isn't being fired for the entity

#

if you use paper, listen to entity remove from world event

opal juniper
#

I never detect it landing

cinder thistle
opal juniper
#

yeah

cinder thistle
#

I'm out

#

packets are not my specialty

opal juniper
#

<

wraith rapids
#

hook the cancel velocity logic into the packet listener

#

rather than the event listener

#

that way it'll fire no matter how the entity is destroyed

#

event or otherwise

opal juniper
#

true

#

soo, lemme get this straight

#

i dont use paper

#

so

#

i could add to the packet listener

#

to cancel the velocity

wraith rapids
#

my guess is that the ones that aren't caught by your event like die and drop an item or something

#

which won't fire the entity block shit event

#

because no block would form

opal juniper
#

true

wraith rapids
#

test it by blowing something up over a floor of torches

#

all of the entities should then fail to get the velocity applied

#

because none of them fire the event

sharp bough
#

i was looking at an open source code and found this

        OutlinePane background = new OutlinePane(0, 0, 9, gui.getRows(), Pane.Priority.LOWEST);
        background.addItem(new GuiItem(createGuiItem(material, "" + ChatColor.RESET, false)));
        background.setRepeat(true);

        gui.addPane(background);
    }```
could someone explain what 
OutlinePane
setRepeat
addPane
is?
#

thanks

#

cant find it in the docs

opal juniper
#

What is this for

young knoll
#

They aren't in the docs

sharp bough
young knoll
#

Looks like some kid of third party api

#
import com.github.stefvanschie.inventoryframework.gui.type.ChestGui;
import com.github.stefvanschie.inventoryframework.pane.OutlinePane;
import com.github.stefvanschie.inventoryframework.pane.Pane;```
sharp bough
wraith rapids
#

creditable guy

sharp bough
#

so i could import that and use it?

wraith rapids
#

you should ping him in the paper discord repeatedly

sharp bough
#

if i add it in the maven dependency

wraith rapids
#

yes

opal juniper
#

ur exactly correct @wraith rapids

#

none would form

#

Wow your genius shocks me

#

do you know if there is anything i can do about it?

cinder thistle
wraith rapids
#

hook the velocity shit into the packet interceptor

livid tundra
#

does getServer().getWorld(getServer().getName()) work in the onEnable method to find the main world of a basic server.pro server?

wraith rapids
#

might want to cancel the events that fire when the entities die on top of torches and shit

opal juniper
#

i have no clue

wraith rapids
#

as they will be dropping items

opal juniper
#

fallingBlock.setDropItem(false);

young knoll
#

You can setDropItems false on the entity

#

Yeah ^

opal juniper
#

😄

#

So, when i get the destroy packet in, i need to send a velocity packet?

#

surely there needs to be a delay though?

young knoll
#

Try it and see

opal juniper
#

<

#

point

sturdy elk
#

Hi!, how can I get the players of a certain server, what I mean is: I have a ServerSelector that when I put %online% it shows the players of the indicated server

cinder thistle
#

pretty sure that's some plugin messaging stuff, hold on a sec

opal juniper
#

it works! !!!!

#

Im so happy!

cinder thistle
#

pog

wraith prawn
#

Hi everyone. I have a bungercord servers. My issue is: if I add a player tag with team, others can see it in others servers? (as TabList and player displayed name)

cinder thistle
#

can't find it nvm

#

scroll down to PlayerCount

chrome beacon
#

Well I doubt your world has the name of the server implementation

maiden thicket
eternal oxide
#

getWorlds().get(0)

delicate fractal
#

Can anyone help me send private msg

eternal oxide
#

?ask

#

Wakeup bot!

split panther
#

?ask

#

even my bot is more reliable than this 😦

delicate fractal
#

what

eternal oxide
#

?jd

#

all asleep

sharp bough
#

whats a fancy way of making a debugmode? i currently have a

if(Main.getconfig.getBoolean("config.debugMode") sout("the info here")```
but i dont really like that its too long
#

so i have a

        return new Config().getDebugMode();
    }```
and use if(debugMode()) sout("info")
#

but theni have to add the debugMode() to every class where i want debug mode to be used

eternal oxide
#

add a getter to your main java public boolean isDebug()

sharp bough
#

ooh

#

so i would do

#

if(Main.isDebug) info here

eternal oxide
#

yep

sharp bough
#

ah thats such a simple solution thanks

radiant barn
#

Hello, how can I spawn enderdragon with bossbar?

sharp bough
#

you could make an entity enderdragon and a bossbar

wise heron
#

Hello, how can I create a new Item set?

sharp bough
wraith rapids
#

new HashSet<ItemStack>()

#

or Item if that's what you really want but that's probably not what you really want

wise heron
#

I want like an armor to be in the same set

#

and if you have all pieces you would have some extra powers

eternal oxide
#

Sound like you are looking for a plugin not some programming help

wise heron
#

no

#

in the mmoitems

#

you can create item sets

#

but i dont know how

eternal oxide
#

mmoitems is a plugin

wise heron
#

yeah i know

eternal oxide
wise heron
#

oh

#

sorry

#

thanks

eternal oxide
#

np

livid tundra
#

how can you make the interactive inventory screens pop up

#

such as, which class?

radiant barn
sage swift
#

and InventoryHolder

eternal oxide
sage swift
eternal oxide
#

<> around links and it does no inserts

sage swift
#

interesting

cold field
#

Guys, probably dumb question, but how much NMS stuff will not work on paper?

sage swift
#

nms is untouched by paper

#

should be

lilac dagger
#

it is touched

lilac dagger
#

recently they broke one of my hooks as they replaced the built in message components with a custom one of theirs

sage swift
#

is that nms though?

wraith rapids
#

that's not nms no

cold field
#

Ok, thanks.

wraith rapids
#

paper uses adventure for the component api

#

the underlying doodads are still almost entirely the same

#

most nms shit will work on paper but there are some differences

#

especially surrounding timings

sage swift
#

they should really stop forcing the adventure components though

lilac dagger
#

well it made me recompile with fixes

#

i had to replace a concrete class with theirs

ivory sleet
#

They don’t enforce the usage of adventure components

wraith rapids
#

idk it's about time for someone to unify the chat component shit in the api

livid tundra
#

is it an error for intellij to mark my main class(the one with the onEnable) as never used?

sage swift
wraith rapids
#

yeah they are definitely pushing towards adventure pretty hard

clear lagoon
#

hello where can i see what i buyed on spigot?

sage swift
wraith rapids
#

but imo there is no reason to stay with bungee components anyway

#

beyond like not having to update your code

livid tundra
lilac dagger
#

yup

ivory sleet
lilac dagger
#

that error is pretty annoying when designing apis and any other decoupled programs or libs

wraith rapids
#

can just ignore it

#

i've disabled the "x is not used" warning in ij because it's literally always useless

sage swift
#

according to the kid complaining it was lagging his server

wraith rapids
#

i can't see message links

#

but that sounds dumb

opal juniper
#
        private void moveDown(int id) {
            final PacketContainer testPacket = new PacketContainer(Server.REL_ENTITY_MOVE);
            testPacket.getIntegers()
                    .write(0, id);
            testPacket.getShorts()
                    .write(0, (short) 0)
                    .write(1, (short) -409.6)
                    .write(2, (short) 0);
            testPacket.getBooleans()
                    .write(0,false);

            Bukkit.getOnlinePlayers().forEach(player -> {
                try {
                    RealPhysics.this.protocolManager.sendServerPacket(player, testPacket);
                } catch (final InvocationTargetException e) {
                    e.printStackTrace();
                }
            });

        }

This packet moves a block down by 0.1, however it does it based on the position it was spawned at

#

which i hate - cause it stupid

wraith rapids
#

that's strange

#

although actually

#

it does make sense

#

it would be pretty strange if it worked the other way around

#

yeah you're kind of fucked i guess

#

i guess you could record the location where the sand lands at in a map or something

#

and just use absolute teleports

opal juniper
#

yeah

#

or i could just let them get removed with the random amount i already have - idk

wraith rapids
#

discrepancies from the multiple explosions most likely

opal juniper
#

yeah most likely

#

Hmmm

wraith rapids
#

i don't think tracking their location is feasible

#

probably just need to give up on the idea

opal juniper
#

Yeah, i think that is good enough

#

i would like to make some sorta curve

#

For their removal

wraith rapids
#

curve?

opal juniper
#

Like this

wraith rapids
#

gaussian distribution of thei lifespan?

opal juniper
#

so there is a low chance of a high or a low despawn time

#

i mean, thats a bell curve

#

but ig, idk what the gaussian looks like

wraith rapids
#

yeah but the distribution is called a normal or gaussian distribution

opal juniper
#

ah ok, yeah

#

idrk how to

wraith rapids
#

it makes a bell curve when you graph it as value vs probability

#

Random::nextGaussian

opal juniper
#

oohhhhhh that makes sense

#

ok

#

So does that return a value from 0-1

#

or what

#

i can google it tbh

#

Hmmm, the only thing is that the Gaussian function returns -

#

values

#

So ig i have to +1 to all

wraith rapids
#

it returns a random gaussian with a standard deviation of 1

#

meaning that the practical range of the values it shits out is from -3 to 3, more or less

opal juniper
#

ohhh

wraith rapids
#

if you want to make the range larger, you multiply the result

#

if you want to shift the range, you add/subtract

opal juniper
#

could i /3 + 1

#

to get 0-1

wraith rapids
#

if you want a random value between 20 and 60 seconds, you add 40 and multiply by like 10 or something

#

of course since it's a gaussian it doesn't really have a max or a min limit

#

it could be fifty billion

#

the probability is just low

opal juniper
#

ill show what i am doing rn

wraith rapids
#

so you'll want to throw some Math.min and max at it

opal juniper
#
            int delay = (int) (Math.floor(Math.random()*(80-50+1)+50));

            Bukkit.getScheduler().runTaskLater(this, pending::destroy, delay);
#

so i just need to provide a tick delay

#

Cause whenever i need to make a new block, i instanciate the PendingBlock

#

which has methods create and destroy

wraith rapids
#

Math.min(Math.max((ThreadLocalRandom.current().nextGaussian() * 20) + 60, 1), 300)

#

random value ranging from 1 ticks to around 120 ticks, mostly centered around 60 ticks

#

with a slight relative bump in probability at 1 ticks and 300 ticks but those are mostly negligible

opal juniper
#

oh i get it

#

nice

#

thanks 😄

cold pawn
#

dose anyone know why the console would return this as null?

wraith rapids
#

because it's null

opal juniper
#

<

#

I am sometimes having the blocks form

#

which is cringe

#

but i am considering labelling it a 'feature'

#

but idk

#

i don't like it

#

Basically, for whatever reason the EID isn't in the set

#

As in for a player ?

#

to their skin?

cinder thistle
#

You can just use !

#

In Boolean logic (in Java) it means not

opal juniper
#

what do you need?

#

to what?

#

Ummmmm

cinder thistle
opal juniper
#

i don't think that is how it works

cinder thistle
#

If you’re checking if the Boolean is true you don’t need ! or == true

opal juniper
#

do you know @cinder thistle

cinder thistle
#

I’m sure thread safety is stupid, I’m sure

#

So it must be possible to write async code without it

cinder thistle
opal juniper
#

it doesn't matter if you didn't get it

#

it was a joke

cinder thistle
#

It wasn’t a joke

opal juniper
#

well

cinder thistle
#

It was sarcasm

opal juniper
#

yeah

sage swift
#

async server when

#

no load on main thread!

opal juniper
#

omg wow!

sage swift
#

everything on one async thread

cinder thistle
#

Just because you think something must be possible, doesn’t mean it is

opal juniper
#

Does that satisfy you

young knoll
#

Have I gone crazy or is modifying a cloned item from a packet somehow modifying the original as well

sage swift
#

but arent you setting it back

young knoll
#

I should be setting it to the cloned item

somber hull
#

is there a way to grab the plugin version from plugin.yml?

wraith rapids
#

yes

#

get the plugin's description

somber hull
#

@wraith rapids thanks

young knoll
#

I must be doing a dumb here

quaint mantle
#

is there an egg for redisbungee on pterodactyl?

sage swift
#

i think you might have to boil the egg for it to be edible, unfortunately

opal juniper
#

Is it theoretically possible for an EID to change?

quaint mantle
#

lets try my luck

wild inlet
#

Hi, does anyone know how to do multi line placeholders (or variable number of lines rather) when setting up your own placeholder with Placeholder API

sage swift
#

\n?

wild inlet
#

So this can be a little weird

sage swift
#

you could just have %plugin_top_[1-10]%

sage swift
#

is depositing money via vault laggy on the server? or does it depend entirely on the economy provider?

ivory sleet
#

And also I believe there is a tutorial on how to install redis on their site

keen monolith
#

Anybody know how to work with WorldGuard?

sage swift
#

they have a discord

wild inlet
sage swift
#

where they are mean

ivory sleet
#

They have an api documentation also awesome dude

wild inlet
#

I'm assuming for people using featherbaord

keen monolith
#

I know

#

But it isn't really helping me

#

I need to disable block-place and block-break, except for a few items (wool, oak planks, that stuff)

cold pawn
somber hull
#

how do i save a config while keeping comments?

#

can i?

keen monolith
somber hull
#

... no shit

opal juniper
somber hull
#

How do i save it after adding changes while keeping comments

keen monolith
#

With world guard

opal juniper
#

don't copy defaults

#

oh idk

keen monolith
#

Lol, anybody you know I could ask?

opal juniper
#

the forums

#

or just come back in like a bit

keen monolith
#

kk

shy wolf
#

help plz

quaint mantle
shy wolf
#

how to get title of inv?

young knoll
#

event.getView

shy wolf
#

ty

keen monolith
#

PlayerDeathEvent

sage swift
shy wolf
#

so?

sage swift
#

someone could rename a chest to it and mess things up

#

foolproof way to do it

quaint mantle
#

also possible to give a colored name

sage swift
#

still very janky.

quaint mantle
#

(unless people got some sort of a /rename cmd on ur server)

#

yeah true, your method is probally better.

sage swift
#

same way you don't want to check for a custom item via the lore

young knoll
shy wolf
#
    public void clickEvent(InventoryClickEvent e){
//
        if(e.getView().getTitle().equals("plots menu")){
            Player player = (Player) e.getWhoClicked();
            switch(e.getCurrentItem().getType()){
                case DIAMOND_SWORD:
                    player.closeInventory();
                    player.setHealth(0.0);
                    player.sendMessage("You just killed yourself");
                    break;

            }
            e.setCancelled(true);

        }

    }```
#

is that ok?

#

some one?

quaint mantle
#

yeah it is but just check if the e.getCurrentItem() isnt null

shy wolf
#
                default:
                    e.setCancelled(true);
                    break; ```
quaint mantle
#

nope

shy wolf
#

so

#

?

quaint mantle
#

i meant before the switch

shy wolf
#

oh

sage swift
#

if currentItem is null it will throw an error if you try to getType

quaint mantle
#

if (e.getCurrentItem() == null)
return;

#

smth like that before switch

quaint mantle
# shy wolf oh
    @EventHandler
    public void clickEvent(InventoryClickEvent e){
//
        if(e.getView().getTitle().equals("plots menu")){
            Player player = (Player) e.getWhoClicked();

            if (e.getCurrentItem() == null)
                return;

            switch(e.getCurrentItem().getType()){
                case DIAMOND_SWORD:
                    player.closeInventory();
                    player.setHealth(0.0);
                    player.sendMessage("You just killed yourself");
                    break;

            }
            e.setCancelled(true);

        }

    }
sullen dome
#

Basically

wraith rapids
#

don't use the inventory title to compare inventories