#help-development

1 messages · Page 2205 of 1

eternal oxide
#

serializable

tender shard
#

basically desetializing in spigot is nothing more than

Class<? extends ConfigurationSerializable> clazz = Class.forName((String) map.get("=="));
return clazz.getDeclaredMethod("deserialize").invoke(null, map);
#

well of course it's a bit different but this is basically the whole idea lol

eternal oxide
#

yep

tender shard
eternal oxide
#

Most Bukkit objects are ConfgurationSerializable

#

Not Entity nor Block though

tender shard
#

that's how it works internally

#

don't worry about it

#

getDeclaredMethod is a declared method in the class Class

#

lmao

eternal oxide
#

That wasn;t for you @kind patrol

tender shard
#
Class.class.getDeclaredMethod("getDeclaredMethod", ...);

lol

shy forge
#

Every time I try and build a jar file for this project, for some reason the plugin.yml gets replaced by the plugin.yml of one of the plugins being used an external library. Like IntelliJ seems to be just created a duplicate of that plugin and I can't get it to not do that

eternal oxide
#

you are shading the other plugin

#

<scope>provided</scope> on any dependency you don;t want included

shy forge
#

No. I really don't understand shading. Is that what it does? Tells the compiler to ignore it?

tender shard
#

are you using maven?

#

if not you'll have a bad time compiling ANYTHING that's using any libraries

shy forge
#

Gradle

tender shard
#

oh ok

#

yeah gradle's shadowJar plugin is preeeetty weird

shy forge
#

Yh I was worried

tender shard
#

send your build.gradle

shy forge
#

plugins {
    kotlin("jvm") version "1.5.31"
    id("com.github.johnrengelman.shadow") version "6.1.0"
}

tasks.compileJava { options.encoding = "UTF-8" }

group = "com.jaoow"
version = "1.0"

repositories {
    mavenCentral()

    maven("https://jitpack.io")
    maven("https://libraries.minecraft.net/")
    maven("https://repo.aikar.co/content/groups/aikar/")
    maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
    maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
}

dependencies {

    compileOnly(fileTree("libs"))
    compileOnly("com.mojang:authlib:1.5.21")
    compileOnly("me.clip:placeholderapi:2.10.9")
    compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT")

    implementation("co.aikar", "acf-paper", "0.5.0-SNAPSHOT")
    implementation("com.github.Jaoow", "sql-provider", "1.3")
    implementation("com.github.ben-manes.caffeine", "caffeine", "3.0.4")

    compileOnly("org.projectlombok:lombok:1.18.22")
    annotationProcessor("org.projectlombok:lombok:1.18.22")

}


tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "11"
}

tasks.withType<JavaCompile> {
    options.encoding = "UTF-8"
}```
ivory sleet
#

Kotlin 😌

tender shard
shy forge
tender shard
#

but you didnt even define that as dependency?

shy forge
#

It's a plugin hard dependency

#

I didn't write this but the jar worked before, I'm just fixing a bug for a server

eternal oxide
#

hard dependency? you mean you added it manually? as its not in your gradle

tender shard
#

are you actually even using gradle to compile, or are you doing some weird stuff in your IDE to compile it?

shy forge
#

Yes, I added it manually. I haven't touched the original code, which had buycraft in the code but not in gradle

tender shard
#

you cannot just add add some .jar file "manually" and then use your IDE to compile o0

shy forge
#

Building artifact in intellij

tender shard
#

you are using gradle, so you should actually USE gradle

shy forge
#

Oh I figured it was. I'm used to maven which works with the IDE build thing

tender shard
#

you should always only use maven or gradle instead of the ide

shy forge
#

I'm just confused tho. Like the original plugin worked and didn't mention buycraft in gradle

tender shard
#

?notworking

#

oh yeah the bot is down

#

okay let me rephrase

#

"dont work" is the most useless description ever

#

all I can reply do that is "yes work"

#

and what is not working?

#
    public static boolean affectsTopInventory(final InventoryDragEvent event) {
        int minSlot = 999;
        for (final int i : event.getRawSlots()) {
            minSlot = Math.min(i, minSlot);
        }
        return minSlot < event.getView().getTopInventory().getSize();
    }
    
    public static boolean onlyAffectsPlayersInventory(InventoryDragEvent event, Player player) {
        if(!event.getView().getBottomInventory().equals(player.getInventory())) return false;
        return !affectsTopInventory(event);
    }
#

no, it works 100% fine

#

yes

#

whut

#

how are you creating the "invsee" inventory

#

and did you test that on yourself?

#

then create a new inventory and copy the stuff from their inventory into that, and show that instead

#

or show your full code that you're using in the drag event

#

well you didnt say that it should automatically update

#

after all you said "invsee" and now "invopen" or sth

#

invsee sounds like "read only"

#

the FULL code

#

okay and what exactly are you trying to achieve now?

tender shard
#

bro i'm tired. you have not even once mentioned what you are actually trying to do. do you want to prevent the player from putting stuff into their own inventory? do you want to prevent them from putting stuff into the others inventory? all you say is "I want to make it working" and "xyz is not working" but you simply don't tell what you want it to do exactly

kind hatch
#

Sounds like you need a better armor equip check.

#

Cause it should only fire when, ya know, you actually equip the armor piece instead of dragging it in the inventory.

tender shard
#

and why are you calling the event manually then?

dusk flicker
#

could delete the file

quaint mantle
#

sigma

tender shard
#

tamron

obtuse crane
#

a doubt how you can upload a plugin as a dependency in intellij in eclipse it only uploads in properties but here I have no idea haha

#

maven

silent vigil
#

Im having a problem, I am looping through blocks in an arraylist, and for each itteration i select a random number, then get the corresponding color for it from the list, except instead of each block being different colors, its all the same, anyone have ideas? (code below)

crisp steeple
#

what is plugin.colorsDropper?

silent vigil
#

ArrayList with strings of colors

tranquil viper
#
       for (ItemStack i : rewardContents) {
            if (i == null) continue;
            chest.getBlockInventory().addItem(i);
            chest.update();
        }

Anyone know why this does not actually add an items? The i is not always null

crisp steeple
silent vigil
#

i get it from config as a list

#

so any ideas?

tranquil viper
#

It looks like you only generate the random one time, try moving the Random generation into the else statement, probably inside of if (block.getBlockData().getMaterial() == Material.DROPPER)

#

@silent vigil ^

topaz hawk
#

Hey Guys i have a problem: When i generate a new End World there is no ender dragon. If i spawn one right after generating the world no DragonBattle will be created, regardless of the Phase the Dragon is in

tranquil viper
#

How are you generating the end world?

topaz hawk
#
MVWorldManager.addWorld(name + "_the_end", Environment.THE_END, null, WorldType.NORMAL, true, null);

or without Multiverse:

World theEnd = new WorldCreator(name + "_the_end")
            .environment(World.Environment.THE_END)
            .generateStructures(true)
            .createWorld();            
tranquil viper
#

And neither work?

topaz hawk
#

I have a listener for the PlayerPortalEvent and when it fires i use event.setTo(new Location(Bukkit.getWorld(group.getName() + "_the_end"), 100.0, 50.0, 0.0));

tranquil viper
#

Do you have essentials installed?

topaz hawk
#

The world generates and i can use the Portal to get there, but the Ender Dragon wont spawn and if i spawn him with the plugin and set his Phase to CIRCLE he spawns and flys around but no DragonBattle will be created

#

No just my Plugin and Multiverse

tranquil viper
#

Let me know if that works

topaz hawk
#

Ill try thx

tranquil viper
#

Actually looking a little more into it that won't work, you'll have to use NMS to simulate the dragon battle

topaz hawk
#

using setAI does nothing to the dragon

#

To let him Fly i have to give him a Phase

tranquil viper
#

Yea I was reading more and realized it doens't actually work

topaz hawk
#

Ah okay

#

For some reason when i use paper spigot 1.18.2 it creates a dragon battle for me, but not on paper spigot 1.19 or any other normal spigot version

#

And since it should run on 1.19 im kinda stuck

tranquil viper
#

1.19 isn't very stable right now anyways

#

Chances are if you make the plugin for 1.18.2 it will be compatible with 1.19

#

So you should be fine realistically

topaz hawk
#

It only works on 1.18.2 because of paper spigot, they have a config flag named "scan-for-legacy-ender-dragon" and it creates a Dragon Battle when a Ender Dragon and a Player are in the same World. But it doesnt work on 1.19 anymore

tranquil viper
#

Hm, maybe ask in paper's support discord. They may be more help.

topaz hawk
#

I tried they also have no idea how to make this work :c

tranquil viper
#

Hm

#

Your best bet is probably NMS then

topaz hawk
#

I hate reflections ;-;

quaint mantle
#
public static ItemStack recipeHolySword() {
        ItemStack holySword = CustomItemsT2.holySword();
        ItemStack magicPowder = CustomItems.createMagicDust();
        ItemStack magicBlock = CustomItems.magicDustBlock();
        ItemStack magicSword = CustomItems.magicSword();

        ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("holyswordt2"), holySword);
        sr.shape("BWB",
                 "WSW",
                 "BPB");
        sr.setIngredient('B', new RecipeChoice.ExactChoice(magicBlock));
        sr.setIngredient('W', Material.WITHER_SKELETON_SKULL);
        sr.setIngredient('S', new RecipeChoice.ExactChoice(magicSword));
        sr.setIngredient('P', new RecipeChoice.ExactChoice(magicPowder));

        Bukkit.getServer().addRecipe(sr);

        return holySword;

    }```

is there something wrong with this code? the recipe doesnt get registered in game and i dont get any errors either
humble tulip
#

'W'

#

i think

#

one sec

#

nvm

quaint mantle
#

wdym

humble tulip
#

i was wrong

#

did u call the method?

dapper harness
#

I didn't know you could make custom recipes with exact choices like that I thought it was only with materials

quaint mantle
quaint mantle
humble tulip
#

seems abt right

#

maybe u cant add to the minecraft namespace

#

not sure

#

unless u did that before and it did work

quaint mantle
dapper harness
#

can you show others that worked ?

quaint mantle
#

sure

#
public static ItemStack magicSword() {
        ItemStack magicSwordItem = CustomItems.magicSword();
        ItemStack magicPowderItem = CustomItems.createMagicDust();
        ItemStack magicBlock = CustomItems.magicDustBlock();

        ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("magicswordt1"), magicSwordItem);
        sr.shape("DBD",
                 "BGB",
                 "DBD");
        sr.setIngredient('D', new RecipeChoice.ExactChoice(magicPowderItem));
        sr.setIngredient('B', new RecipeChoice.ExactChoice(magicBlock));
        sr.setIngredient('G', Material.WHITE_STAINED_GLASS);
        Bukkit.getServer().addRecipe(sr);

        return magicSwordItem;
    }```
humble tulip
#

sure there are no errors?

quaint mantle
#

yeap, checked multiple times, no errors

dapper harness
misty grail
#

Hello. I am trying to use Protocollib and I cannot figure out why this happens. I was guessing that this server would help. I did some research and I find out that you need Spigot and Spigot API, which I dont know what spigot API is and I cannot find where to download it.

#

It wont let me upload image

dapper harness
#

first line

quaint mantle
# dapper harness first line

ah well, this magicSword() method is in a class called ItemRecipes, that one is the actual item in the CustomItems class

dapper harness
#

oh okay

quaint mantle
dapper harness
#

also are you sure that methods are called in the right order for the thing that doesnt work ? you're not trying to make a recipe for an item that is not yet defined ?

#

otherwise i have no idea

quaint mantle
#

if that were the case, my other recipes wouldnt work\

dapper harness
#

if (playerHealth <= 18) {
player.setHealth(playerHealth + 4);

#

18+4=22 max is 20

arctic moth
#

how would i set durability now that its deprecated

quaint mantle
#

which is why there is an else

dapper harness
#

I think you meant 16 not 18

quaint mantle
#

oh shoot you're so smart

dapper harness
#

you can also do player.setHealth(Math.min(playerMaxHealth,playerHealth+4));

#

instead of the if else

#

@quaint mantle

#

Hey I'm trying to make a plugin that respawns the dragon egg if it is destroyed but I'm having issues detecting when it's destroyed
I have no idea if there's a way to know when an item dies from void in the end for example

    @EventHandler
    public void dragonEggDestroyed(EntityDamageEvent event) {
        if(event.getEntity() instanceof Item) {
            Item item = (Item) event.getEntity();
            if(item.getItemStack().getType()==Material.DRAGON_EGG) {
                Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> {
                    if(item.isDead()) {
                        Bukkit.broadcastMessage("§cDragon egg destroyed");
                    }
                }, 1);
            }
        }
    }```
Also for some reasons I get the message twice when the item is burnt in fire but only once for every other death reason
quaint mantle
#

brutha i couldnt tell ya either ngl, im still very much new to java

dapper harness
#

it's okay I @ you just for the message with math.min

humble tulip
#

Is the dragon egg an item?

#

Items are the stuff you drop on the ground

#

Can u destroy the egg? I thought it tps away

quaint mantle
#

Is there a way to set custom nbt in 1.19 with nms? I've searched for tutorials but they dont seem to work in newer versions

dapper harness
#

yes I'm taking about the dragon egg item

dapper harness
quaint mantle
dapper harness
#

yes I guess i'm gonna have to do that

dapper harness
#

but it doesn't solve the fire issue

quaint mantle
#

thats true

dapper harness
#

also if you're crazy enough you could throw the egg in the void, wait for it to be below y-64 and then fly and get it with your elytra to dupe it

#

would be extremely risky and difficult but theoricaly you could

hasty prawn
#

You can kill it when you detect it's too low

dapper harness
#

true

#

thanks

#

smartge

humble tulip
#

cant u listen to entitydeathevent?

hasty prawn
#

Thats only for LivingEntities

humble tulip
#

not sure if it's called when an item is destroyed

#

ah

dapper harness
#

why tho

humble tulip
#

wont work nvm

dapper harness
#

but why can't we get the health of an item in spigot

#

like

#

an item has a health value in minecraft

#

so there must be a way to get it right ?

river oracle
#

Items have health?

#

this is new to me

dapper harness
#

yes

#

they have 2.5 hearts

#

that's why it doesn't die instantly in fire

#

if I can access the health of items I'm done but idk how

river oracle
#

check out NMS

#

as longa s you have a healthy layer of abstraction it should be easy to update too

dapper harness
#

I have no idea how that works

quaint mantle
#
public static void recipeHolySword() {
        ItemStack holySwordItem = CustomItems.holySword();
        ItemStack magicPowderItem = CustomItems.createMagicDust();
        ItemStack magicBlock = CustomItems.magicDustBlock();
        ItemStack magicSwordItem = CustomItems.magicSword();

        ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("holysword"), holySwordItem);
        sr.shape("BWB","WSW","BPB");
        sr.setIngredient('B', new RecipeChoice.ExactChoice(magicBlock));
        sr.setIngredient('W', Material.SAND);
        sr.setIngredient('S', new RecipeChoice.ExactChoice(magicSwordItem));
        sr.setIngredient('P', new RecipeChoice.ExactChoice(magicPowderItem));

        Bukkit.getServer().addRecipe(sr);

    }```
why doesnt this get registered as a recipe? no errors either
dapper harness
#

did you try to put sysout everywhere thunder ?

quaint mantle
#

nope

dapper harness
#

you should

#

90% of the time it helps you understand what's happening

quaint mantle
#

well, the recipe is being registered, i added a sysout right after the .addRecipe

dapper harness
#

and if you do /recipe give @s * do you not get the recipe in the book ?

quaint mantle
#

i have to manually add a bit of code to each method to register it in the recipe book no?

dapper harness
#

idk I thought that NamespacedKey.minecraft("holysword") did that

quaint mantle
#

fixed it by friggin restarting my server lol

#
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:poisonblock removed now.
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:thunderdustblock removed now.
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:magicpowerblock removed now.
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:poisonblock removed now.
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:thunderdustblock removed now.```

https://paste.md-5.net/owagewuxiq.java

wtf
slate mortar
#

so.. apparently the 1.19 removed commons lang? sad :(

upper vale
#

you should switch to guava

#

or shade in a more recent ver of commons lang3

#

i believe they announced that it would be removed in 1.18

slate mortar
#

in 1.18.2 it was still there

upper vale
#

yeah they announced planned removal in 1.18

humble tulip
#

😮

#

yeah one of my plugins broke cuz of that

#

gonna release an update now

gloomy scarab
#

Hello am I the only one since the 1.19 that has issues with colors in the server console or does this also occur to others just trying to find the issue at the Time?

quaint mantle
humble tulip
#

try using your own plugin namespace

#

not a minecraft namespacedkey

solid sigil
#

anybody know how I could run player.getNearbyEntities() in a thread? getting an exception b/c it's async

#

18.2 btw

humble tulip
#

dont

#

just run it on the main thread

solid sigil
#

i dont know how i'd be able to do that

humble tulip
#

why are you running it async?

solid sigil
#

I'm writing a plugin that checks every second for creepers

#

so I thought to use a timertask

crisp steeple
#

?scheduling

vocal cloud
#

Why though

crisp steeple
#

bot down :(

humble tulip
#

you mean checks around a player every second for creepers?

solid sigil
crisp steeple
humble tulip
#

dont schedule it async

#

do it sync

vocal cloud
#

The question is why do you want to find creepers around the player

humble tulip
#

but yeah why

vocal cloud
#

Can't even ?xy 😭

humble tulip
#

lol

solid sigil
#

cuz i get bombed without hearing it

humble tulip
vocal cloud
#

Minecraft has the deaf mode that ads stuff for that

solid sigil
#

lol sorry

solid sigil
#

oh the chat thing

earnest forum
#

subtitles

#

in bottom right

solid sigil
#

yeah but that has a lot of extraneous stuff

subtle folio
vocal cloud
#

I mean its not particles but it let's you know what's going on. If you really want to do particles whenever a creeper is nearby scheduling it would probably be the best way to do it.

solid sigil
#

so use BukkitScheduler & BukkitRunnable?

humble tulip
solid sigil
#

I thought it'd be a fun project to try, kinda like sting from LOTR/hobbit with orcs

humble tulip
#

gluck

#

use a repeating task

#

that is not async

solid sigil
#

can you reccomend the name of a specific class

#

so i can look up the documentation

subtle folio
#

BukkitScheduler?

humble tulip
#

how did you do your async task?

solid sigil
humble tulip
#

Bukkit.getScheduler().scheduleSyncRepeatingTask

#

^^

solid sigil
crisp steeple
#

scheduler & bukkitrunnables are the same its just preference

subtle folio
#

What is the difference between new BukkitScheduler and Bukkit.getScheduler().blah blah?

subtle folio
#

yes

vocal cloud
#

Well if the creeper is about to explode isn't there an event for that?

subtle folio
#

brain damage

crisp steeple
#

they are basically the same

humble tulip
#

one returns a BukkitTask and theother returns an int

#

basically the only difference

#

the int is the id

subtle folio
#

so it doesnt matter if I use one or the other

humble tulip
#

so both can be used to cancel the task

#

no but usually, i use the bukkitrunnable when i wanna cancel

#

and scheduler when i dont care

subtle folio
#

based

solid sigil
humble tulip
#

since BukkitTask has a cancel method

vocal cloud
#

Yeah, then just schedule every 20 ticks

solid sigil
#

awesom thanks

subtle folio
#

imagine not having a tick conversion method

humble tulip
subtle folio
#

yes

vocal cloud
#

Why though. Math ain't that hard

subtle folio
#

its more time conversion but one of the methods is ticks 😛

humble tulip
#

if i wanna schedule every 15 mins i do 15*60*20

subtle folio
#

15 * 60 * 20 😓

#

oh lmfao i thought u knew what that was off the top of ur head

humble tulip
#

huh?

#

you mean the num of ticks?

#

thats 1800

#

thats easy to multiply

humble tulip
#

this method has been waiting to be written for 3 days

#

well the else statement

#

still not feeling like it

subtle folio
#

minion why

#

not using the { looks stupid

humble tulip
#

it's a 1 liner

subtle folio
#

ya

humble tulip
#

idk how the code looks just abt how well it runs

subtle folio
#

if () { then; }

#

all one line

humble tulip
#

that else statement requires so much logic i swear

#

that's why ive been putting it off

subtle folio
#

haha

#

just do it

#

snd then don’t test it

humble tulip
#

i probably need to plan it out

subtle folio
#

if it’s too much to think abt in ur brain

#

write pseudo code

humble tulip
#

yeah

subtle folio
#

unironically helpful

humble tulip
#

too lazy tho

subtle folio
#

get motivation

humble tulip
#

i'd rather just work on storing the data or something

subtle folio
#

why are you doing what ur doing for that else

#

who’s it for

humble tulip
humble tulip
subtle folio
#

self love my friend

#

you’ll love yourself after you make it

humble tulip
#

nah frick that

subtle folio
#

ok never mind

#

make more scoreboards Troll

humble tulip
#

lmao

#

this plugin doesnt need a scoreboard

subtle folio
#

yes it does

humble tulip
#

someone today was having the same issue u were and i copy pasted the code to them

subtle folio
#

oh man

humble tulip
subtle folio
#

what’s ur spigot mc

humble tulip
#

mc?

subtle folio
#

imma make a tutorial and credit you

humble tulip
#

that method is stupid

#

i can write a better one

subtle folio
#

never mind ig

#

i made colors works

humble tulip
#

i mean it's hard to use

subtle folio
#

and prefix’s

#

to sync with vault

solid sigil
#

ok I got a new issue lol

#

so my current solution is that I have a PlayerJoinEvent listener which then schedules the sync task, passing in the player to the method that checks for creepers

#

the error i'm getting is Could not pass event PlayerJoinEvent to SoD_Plugin v1,1.0
org.bukkit.event.EventException: null

hasty prawn
#

?paste the full error

#

oh

solid sigil
#

i pasted to that link

#

am I supposed to generate some sort of share link or

earnest forum
#

yea

#

in the top right press save

#

and then copy the url

solid sigil
humble tulip
#

can u paste ur code now?

#

@solid sigil

solid sigil
#

oh sure one sec

humble tulip
#

oh

#

that's a weird error

#

actually it isnt

#

change new BukkitRunnable

#

to new Runnable

#

and it'll be fixed

humble tulip
solid sigil
#

giving it a shot

subtle folio
humble tulip
#

only runnables

earnest forum
#

u can

#

i use it

humble tulip
#

u cant use it with bukkitrunnables

#

just regular java runnables

earnest forum
#

is that new or something because i always used it

#

and it worked

solid sigil
#

seems to be working, i think i set it to 1K ticks tho lol cuz i was thinking ms

#

so I'll try again

torn oyster
#

how would i format a time duration in milliseconds

#

like 62340 ms would be 1 hour, 2 minutes, etc.

humble tulip
#
public String format(long value) {
        int seconds = (int) (value / 1000) % 60;
        int minutes = (int) ((value / (1000 * 60)) % 60);
        int hours = (int) ((value / (1000 * 60 * 60)) % 24);
        int days = (int) ((value / (1000 * 60 * 60 * 24)));
        String time = "";

        if (days != 0)
            time = days + " day" + (days == 1 ? "" : "s");
        if (hours != 0)
            time = time + (time.equals("") ? "" : " ") + hours + " hour" + (hours == 1 ? "" : "s");
        if (minutes != 0)
            time = time + (time.equals("") ? "" : " ") + minutes + " minute" + (minutes == 1 ? "" : "s");
        if (seconds != 0)
            time = time + (time.equals("") ? "" : " ") + seconds + " second" + (seconds == 1 ? "" : "s");
        if (time.equals("")) {
            time = value + "ms";
        }
        return time;
    }
solid sigil
#

Lol formatting date/times gives me the ick

#

It's working! Just need to play with particle concentration & frequency til I'm satisfied

#

Thanks for helping! New to spigot plugins. Learned something new today

humble tulip
#

np

ornate patio
#

what 2 emojis do servers use to display progress bars

#

theres this one emoji which is like a shaded box and another emoji which is partially shaded

quaint mantle
#

#

ornate patio
#

thanks

humble tulip
#

it took me 10 mins

#

wasnt even hard i was jus toverthinking it

quaint mantle
#
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:poisonblock removed now.
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:thunderdustblock removed now.
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:magicpowerblock removed now.
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:poisonblock removed now.
[23:08:59] [Server thread/ERROR]: Tried to load unrecognized recipe: minecraft:thunderdustblock removed now.```

https://paste.md-5.net/owagewuxiq.java

wtf
#

its not an error

#

just do /rl

solid sigil
#

is that the same as reload

solid sigil
quaint mantle
#

well, it didnt register after reloading multiple times

gloomy scarab
#

Hello anyone can help me since 1.19 i don´t get any Color in my Console anymore - Not really a big issue but sad and a bit hard to identify Plugin info from other info in Console.

Using this tried also ChatColor but changes nothing.
The §4 and §b is getting removed but the Console stays Black and White except Warnings and Errors or do i do something wrong here with the new API?

Bukkit.getLogger().info("§4" + "-----------------------------");
Bukkit.getLogger().info("§4" + "|" + "§b" + " Started Plugin " + "§4" + "|");
Bukkit.getLogger().info("§4" + "-----------------------------");
upper tendon
#

Whats the best way to save data (like items and inventories)?

river oracle
#

long-term storage or shortterm

upper tendon
#

Long

#

To save between reloads/restarts

#

Sorry forgot to specify

river oracle
#

you could do config-serialization of Items in an inventory

upper tendon
#

Ok

#

Is that like the best way or are there others

river oracle
#

than just reiterate to put them back into the inventory

river oracle
upper tendon
#

Ok lol

#

Thanks, I'll look into it 🙏

quaint mantle
#

Kody Simpson has a solid video on it

tranquil viper
#

Anyone know how to cancel a Respawn Anchor's explosion?

quaint mantle
upper tendon
quaint mantle
#

nvm i thought you wanted something different :kekw:

prisma steeple
#
public void RightClick(PlayerInteractEvent event){
        if (event.getAction() == Action.RIGHT_CLICK_AIR){
            Player player = event.getPlayer();
            player.sendMessage("Air right clicked");

        }


    }
#

why does this not work?

vocal cloud
#

did you register it?

prisma steeple
#

in the main class?

vocal cloud
#

and annotate it?

prisma steeple
#

above it I have another method

#

and above that method I have

#

@EventHandler

vocal cloud
#

so it's registered?

#

Add some logging then.

prisma steeple
#
public class RandomFun implements Listener {
    @EventHandler
    public void BlockPlaces(BlockPlaceEvent event) {
        Player player = event.getPlayer();
        Material type = event.getBlock().getType();
        if(type == Material.DIAMOND_BLOCK) {
            int XCoord = event.getBlock().getX();
            int YCoord = event.getBlock().getY();
            int ZCoord = event.getBlock().getZ();
            player.sendMessage("X = " + XCoord);
            player.sendMessage("Y = " + YCoord);
            player.sendMessage("Z = " + ZCoord);

        }


        }
    
    public void RightClick(PlayerInteractEvent event){
        if (event.getAction() == Action.RIGHT_CLICK_AIR){
            Player player = event.getPlayer();
            player.sendMessage("Air right clicked");

        }


    }


        
    }
#

should be

#

first one works

#

second doesn't

vocal cloud
#

Still needs an annotation

#

The event handler annotation

prisma steeple
#

Oh, I need one per method?

vocal cloud
#

Try it and see

prisma steeple
#

still nothing

vocal cloud
#

tried logging?

prisma steeple
#

you mean checking logs?

#

i mean, it just tells me it loaded the plugin and thats all

#

no errors or anything

#
[08:10:32] [Server thread/INFO]: Using default channel type
[08:10:33] [Server thread/INFO]: [Plugin1] Loading Plugin1 v1
[08:10:33] [Server thread/INFO]: Preparing level "world"
[08:10:33] [Server thread/INFO]: -------- World Settings For [world] --------
vocal cloud
#

adding logging to your method to see if it's firing.

prisma steeple
#

Huh. I fixed it in a way

#

I need to right click with an object in my hand

#

if i right click the air, with nothing my hand it won't work

#

pretty interesting

vocal cloud
#

Probably because the client doesn't send a packet unless you're attempting to right click with an item.

prisma steeple
#

That was my thought too

#

right clicking with nothing, into nothing has an output of nothing

#

but if you right click with an object in your hand i guess you're doing something

terse raven
#

how do i check for these tags

near crypt
#

how can i reset a config file?

humble tulip
#

Delet it

near crypt
#

how?

humble tulip
#

Then save it back

#

Or this.saveResource("config.yml",true)

#

^^that's better

near crypt
#

ok this single line?

humble tulip
#

Yep

#

this refers to ur plugin

near crypt
#

does it has to be in the main class?

humble tulip
#

So if it's outside ur main class replace with plugin instance

near crypt
#

ye okay

#

i have a get instance method in the main class this should also work

humble tulip
#

Also when u save it back, u will have to reload the config

near crypt
#

so save it?

humble tulip
#

After calling saveResource

#

U need reloadConfig

near crypt
#

oh okay thx

humble tulip
#

And if you have the config variable stored anywhere update it with the new plugin.getConfig since the config instance it has is outdated

near crypt
#

okay

humble tulip
#

U can also test if it's needed

near crypt
#

this produces an error because it does not found the file why ever...

#

this is the error

#

Can i also give the exact path there?

sterile grotto
near crypt
#

no

#

it looks like this

#

i think i know what the problem is but should i just rename the jar file?

sterile grotto
#

if your config file is not in the jar file, rename your jar file may not work

near crypt
#

yes because it searches for a jar file in the path... this is the problem

#

but how could i change this?

#

okay i did it nevermind thx for the help 🙂

#

i have another little question why does the player.sendTitle() function not work sometimes... it is crossed out

#

check the event for a player getting damage

#

there you go...

tardy delta
near crypt
#

but do you know why i cant use the sendTitle() method sometimes it says it is deprecated

native falcon
#

How could I start making the following:
When you break a block, TNT spawns and launches itself upwards as a cool effect?

gilded tundra
#

how to use minepacks plugin command without op

near crypt
near crypt
#

how can i stop a specific bukkit runnable?

dapper harness
#

Any ideas on how to check for the health of an item?

#

You can't use gethealth on an item entity because it's not a livingentity

#

But it still has health

eternal oxide
#

its under Player not Entity

eternal oxide
#

e.getEntity() returns and Object, Cast to Player

#

((Player) e,getEntity()).spigot().sendMessage

eternal oxide
#

There is a damageable for Entities and for meta

#

put it in the correct place in yrou code

#

Which event are you using?

#

yes, but its ok, I looked at your code

dapper harness
eternal oxide
#

Works fine ```java
@EventHandler
public void test(EntityDamageByEntityEvent event){

    if (event.getDamager() instanceof Player player) {
        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Test"));
    }
}```
eternal oxide
eternal oxide
# dapper harness Item is not a subclass of damageable

for not Java 16 ```java
@EventHandler
public void test(EntityDamageByEntityEvent event){

    if (event.getDamager() instanceof Player) {
        Player player = (Player) event.getDamager();
        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Test"));
    }
}```
#

wrong ping sorry

prisma steeple
#

can you add direction for damage?

#

yes, because i have this right now which works

#
 @EventHandler
    public void BreakBlock(BlockBreakEvent event){
        Material type = event.getBlock().getType();
        Player player = event.getPlayer();
        if(type == Material.GRASS_BLOCK){
            player.damage(1, player);
            event.setCancelled(true);

        }

    }
#

is there a way to implement a sense of direction?

tender shard
#

apply a velocity to the player

eternal oxide
#

you want to push the player away from the block?

prisma steeple
tender shard
#

and what exactly didnt work?

eternal oxide
#

Then, yes as mfnalex said, calculate teh Vector from teh Block to teh Player and apply as a Velocity to the Player

earnest forum
#

teh

tender shard
#

blockVector.subtract(playerVector).normalize()

prisma steeple
#

Ohhh, thank you!

eternal oxide
tender shard
#

and then apply that to the player

dapper harness
earnest forum
#

twice though

eternal oxide
#

You mean a dropped Item? That has no health

dapper harness
#

when you drop the item

#

yes it has

eternal oxide
#

a Dropped Item is there or its not

dapper harness
#

a dropped item has 2.5 hearts

tender shard
sacred mountain
#

bit unrelated to spigot, but in java is there a way for the class to know what line that bit of code is running

#

it seems unlikely but you never know

earnest forum
tender shard
dapper harness
#

a dropped item doesn't have health in spigot but has health in minecraft

earnest forum
#

it does not have health

sacred mountain
#

so it wouldn't be viable as a debug message

#

?

#

to show the class and line of code

tender shard
#

you don't have to throw the error

#

just create it and get the stacktraceelements

#

not sure if [1] is correct

dapper harness
tender shard
#

it will be either [0] or [1] or [2]

dapper harness
#

an item has health

prisma steeple
#
event.getBlock().getLocation().toVector();

this changes the blocks location into a vector?

sacred mountain
#

ill search it

dapper harness
#

a dropped item doesn't have health in spigot but has health in minecraft

sacred mountain
#

nevermind lol

#

int lineNumber = Thread.currentThread().getStackTrace()[3].getLineNumber();

#

apparently it's 3

earnest forum
#

that vector is a position vector, it does not have direction or anything

tender shard
#

well just print out the stack trace and see for yourself

earnest forum
#

when you call toVector it gives you a vector object that has the x,y,z position

prisma steeple
#

so in that sense

#

the vector is just the position of the block

earnest forum
#

yes

prisma steeple
#

ok thx a lot

chrome beacon
dapper harness
#

I know

#

but how

sacred mountain
#

___8drrd3148796d_Xaf

tender shard
# sacred mountain yep

if you put it into a separate method, it's [2]

    public static void main(String[] args) {
        System.out.println("Current line number is " + getCurrentLineNumber());
    }

    public static int getCurrentLineNumber() {
        return Thread.currentThread().getStackTrace()[2].getLineNumber();
    }
#

if you "inline" it into your code, without a separate method, it's [1]

granite owl
#

does someone have a sheet which RGB values vanilla potions use?
because apparently vanilla potion's PotionMeta's getColor returns null

chrome beacon
dapper harness
#

1.19

tender shard
#

so yeah either [1] or [2] depending on how you do it

prisma steeple
#

can't seem to get a players vector

tender shard
prisma steeple
#

Ahh I see

#

thanks

sacred mountain
#

the difference?

#

im creating a debug logger but i'm not sure if bukkit displays these

#

without modifying the log4j2

#

isnt it info and above or something

true oak
#

Hello guys.
My question : I want to deploy 1.17+ NMS dependencies on a private artifactory (artifactory is a dependency repository like maven central, nexus, jitpack, ...).
Context :
I'm a benevolent in an association where 9 developers works mainly on spigot plugins.
Some projects of our association uses NMS version dependent code. In such case, we usually have to get all required dependencies.It means EACH developer have to locally execute buildtools on EACH NMS version for spigot. Then the same must be done for paper.

I want my association's developers not to have to locally install each paper/spigot versions required. I want them to be able to download those automatically from our private artifactory.

eternal oxide
#

Legally no

sacred mountain
#

mhm

tender shard
#

in a private repository, no problem

#

I do the same

#

just make it password protected lol

eternal oxide
#

Still legally No. As its not private, it is shared between your devs.

sacred mountain
#

is there a way to print [DEBUG] instead of [INFO] i the console

granite owl
#

any help on how i can get a vanila potions color based on the fact that PotionMeta returns null for vanilla potions?

eternal oxide
#

Really private is fine

tender shard
eternal oxide
tender shard
#

well hosting providers are even distributing spigot to all their customers and noone was ever sued for that

eternal oxide
#

If one of those devs has a hissy fit, he will be the one left in teh firing line for making it available.

#

Yeah, I'm not talking about what has happened. I'm talking about facts and what CAN happen.

earnest forum
#

everything is always spelt perfectly except "the"

true oak
#

Ok then, what should I do to make the installation process easier ?

eternal oxide
tender shard
prisma steeple
#
Vector blockvector = event.getBlock().getLocation().toVector();
            Vector playervector = player.getLocation().toVector();
            blockvector.subtract(playervector).normalize();
            player.setVelocity(blockvector);

this pulls in the player towards the block

chrome beacon
#

if you want the opposite flip the vector

prisma steeple
#

yes yes I know thank y

#

but my question is why do you subtract the players vector?

earnest forum
#

to get the difference

#

and normalizing it gets you the direction

#

from player to block

prisma steeple
#

difference as in distance ?

#

distance from block to player?

earnest forum
#

yes

#

you use magnitude instead of normalize to find the distance

tender shard
#

or multiply it with -1

eternal oxide
#

If you subtract one from the other and get teh wrong direct, reverse it and subtract the other way around

earnest forum
#

its getting worse

prisma steeple
#

you should sleep

#

no offense

prisma steeple
eternal oxide
#

This is my morning 🙂

#

Fingers still stiff and not awake

#

Comes with age

tender shard
#

oh yeah fuck mornings, I need coffee

#

I forgot to set my coffee machine to 11 am yesterday

#

now I have to get up and start it manually

sage patio
earnest forum
#

<> not ()

#

for String

sage patio
#

ow, yea thanks

tender shard
#

is the bot working again?

#

?bt

#

argh

#

?paste

tall dragon
#

shes sleeping

iron glade
prisma steeple
#

no

iron glade
#

damn

prisma steeple
#

the only vector i know is from my computing class

iron glade
#

I really liked the topic back in school

prisma steeple
#

which is an image used from a mathemetical formula

tall dragon
#

yea i didnt rlly get tought either

prisma steeple
#

where if u zoom in it stays good quality

tall dragon
#

very sadge

prisma steeple
#

oh and in physics

#

well yes kind of i guess then

#

it's similar to an MC vector but not exactly

#

it's a quantity with a magnitude and direction

iron glade
#

MC vectors aren't that hard tho

prisma steeple
#

Yes I understood them

#

it's the position of something no?

iron glade
#

position / direction

prisma steeple
#

direction in what sense?

#

a block can have a direction?

tender shard
#

a vector is a direction with a magnitude

prisma steeple
#

yes

tender shard
prisma steeple
#

however how can blocks have an direction

#

or is it used for signs?

iron glade
#

no

prisma steeple
#

eg

tender shard
#

50 | 100 and 52 | 102

#

then you can get the difference in those locations

#

which is 52 - 50 | 102 - 100 so it's 2|2

#

so to get from 50 | 100 to 52 | 102 you need the vector 2|2

prisma steeple
#

OHH

#

holy crap that makes a lot more sense

#

so seeing it at the literal sense

tender shard
#

yeah it's actually totally easy unless you try to learn it from wikipedia lol

earnest forum
#

theres a couple ways you can use a vector

#

position, direction and velocity

prisma steeple
#

you add 2 speed and 2 "direction"

#

and then you get pulled in

#

am i understanding it right

iron glade
#

I think you rather set his velocity to that specific direction

prisma steeple
#
blockvector.subtract(playervector).normalize();

so in this line

tender shard
#

normalize is to turn the vector to a length of 1

prisma steeple
#

why would you do thise

tender shard
#

normalize basically means "only the direction"

prisma steeple
#

if i didn't normalize what would happen

tender shard
#

then you would get faster the more distant the locatinos are

iron glade
#

the vector would have another length

prisma steeple
#

oh i see

#

so with normalize length theres a constant speed

regal carbon
#

hi, is there a way to get the server's jar file? something like spigot-1.19.jar , ive found

new java.io.File(SomeClassInYourJar.class.getProtectionDomain()
  .getCodeSource()
  .getLocation()
  .getPath())

online but it gets the plugin file

prisma steeple
#

that doesn't change

tender shard
#

let's assume the arrows were parellel. if that would be the case, then the lower vector would be basically "twice as fast"

#

but same direction

#

a normalized vector is a vector where the length of the arrow is one

#

so you can easily set a speed by multiplying the vector, without changing its direction

tender shard
tender shard
#

for example the direction from 0|0 to 2|2 is the same as the direction from 0|0 to 200|200. but the first vector has a small length and the second one has a huge length. normalizing both would return in the same vector, which would be roughly 0.7|0.7

regal carbon
tender shard
#

because sqrt(0.7^2) = 1 (pythagoras)

tender shard
earnest forum
#

for example if you are trying to move 5 units in the direction of the point

#

normalize the vector 1|1 (gives you about 0.5|0.5)

#

if you multiply 0.5|0.5 by 5 units

tender shard
earnest forum
#

you will move 5 units in the direction of the red point

tender shard
earnest forum
#

we love desmos

regal carbon
tender shard
#

nms starts with net.minecraft.server 😛

#

obc starts with org.bukkit.craftbukkit

earnest forum
#

hence why it is called nms

regal carbon
#

cant find it with spigot-api as dependency

tender shard
#

you have to use spigot

regal carbon
#

no idea whats obs lol

tender shard
#

as dependency

#

OBS is the CraftBukkit stuff

regal carbon
#

kind of like nms then i guess

tender shard
#

CraftPlayer, CraftEntity, CraftLivingEntity, ...

#

CraftBukkit provides the implementations for the BukkitAPI and wraps around NMS

#

CraftPlayer implements Player and wraps around NMS Player

#

it's basically the "middle thing" between vanilla MC and Bukkit API

regal carbon
#

so in a way bukkit is a fork of craftbukkit?

tender shard
#

vanilla MC is the cocaine farmer in south america, craftbukkit is the dude who smuggles it to your country and Bukkit API is your local drug dealer

tender shard
earnest forum
#

you farm cocaine?

prisma steeple
#

hmm i think i understood it better

tender shard
#

e.g. if my local drug dealer doesn't have it

earnest forum
#

no as in is farming of cocaine the correct verb of producing cocaine

tender shard
#

for example to send totem animations, I have to farm the cocaine myself

earnest forum
#

i thought it was like cooked

tender shard
earnest forum
#

like meth

regal carbon
#

honestly this flew over my head im just gonna remember the cocaine example lmao

prisma steeple
#

Now i'll try use what you told me into making it so when a hoe is rightclicked i fly upwards

#

not upwards

#

in the direction i'm facing

earnest forum
#

alex make blog post on vector

prisma steeple
#

yes you are a literal maths genius

tender shard
#

maybe when I'm bored lol

#

anyway to come back to craftbukkit and bukkit:

near crypt
#

how can i check the block a player is walking on?

tender shard
#

if you check out bukkit, you'll see that everything is only interfaces. it doesn't do anything. CraftBukkit provides the actual code that does something.

Player in Bukkit defines what a player can do.
CraftPlayer in CraftBukkit defines HOW exactly a player does something, by saving the NMS player in some field and basically translating the Bukkit calls to vanilla MC code

earnest forum
#

get the player's location, subtract it by 1 on the y axis and get the block from that

near crypt
#

is there no event for it?

earnest forum
#

what event

tender shard
#

makes no sense

earnest forum
#

yeah

tender shard
#

there is an event for when a player moves

earnest forum
#

unless you mean PlayerMoveEvent

regal carbon
trim creek
#

The code the error is facing to:

getData().set("Players." + player.getName() + ".Rank", "default");

The error:

java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.file.FileConfiguration.set(String, Object)" because the return value of "neonowlgery.**************.core.managers.SQLiteManager.getData()" is null

Question: I am the upmesser, or did the API got autism or something? I mean... it actually should be correct, because on other projects, it worked fine, but now, for some reason it just doesn't wants to work, while the codes are the same.

tender shard
near crypt
#

this was my question

tender shard
#

then subtract one from the player's location's Y and get the block

sage dragon
#

Hey,

Does anyone know what ProfilePublicKey is for?

Found this in the consturctor of EntityPlayer

tender shard
#

so make getData() return sth else than null

trim creek
#

it returns cuudconfig in the code

earnest forum
#

Player p = event.getPlayer();
Location loc = p.getLocation();
Block below = loc.subtract(0,1,0).getBlock();
trim creek
#

Like in every other one

tender shard
trim creek
#

And what can cause it?

#

Cause the file itself is created

tender shard
#

idk, I can't magically see your code

prisma steeple
#

to detect right click with hoe we use playerinteractevent in the method?

#

or is there something else i can use

tender shard
#

then check if the action is RIGHT_CLICK_BLOCK or RIGHT_CLICK_AIR

#

and if the item in use is a hoe

near crypt
prisma steeple
trim creek
#
public static void setup() {
        file = new File(Bukkit.getServer().getPluginManager().getPlugin("pluginname").getDataFolder(), "Data/CUUD.yml"); // this is where the file is saved, which is successful
        
        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        cuudconfig = YamlConfiguration.loadConfiguration(file);
        }
    }

    public static FileConfiguration getData() {
        return cuudconfig;
    }

    public static void save() { // this saves the file, and after that, it needs a reload, which is competed by the static reload event
        try {
            cuudconfig.save(file);
        } catch (IOException e) {
            System.out.print("§cA plugin nem tudta menteni a CUUD fájlt.");
            e.printStackTrace();
        }
    }

    public static void reload() {
        cuudconfig = YamlConfiguration.loadConfiguration(file);
    }
earnest forum
#

yes put that code inside PlayerMoveEvent

near crypt
#

okay

#

thx

tender shard
trim creek
#

idk xDD

#

anyway i wont rename it

#

it is not a public plugin anyway

tender shard
trim creek
#

yup

#

the file is always created

tender shard
#

no

trim creek
#

the data inside it cannot be modifyed for some reason

tender shard
#

you only set cuudconfig if the file didnt exist

#

when the file already exists, you never assign any value to cuudconfig

#

your code:

        if (!file.exists()) {
            ...
            cuudconfig = YamlConfiguration.loadConfiguration(file);
        }
trim creek
#

thats how i load it, isnt it?

#

i told, the other projects are working fine

tender shard
#

as I said

trim creek
#

with the same code.-..

tender shard
#

you only load the file if it didnt exist

tender shard
#

you should also load the config when the file existed

final monolith
#

How i can reactivate a inactive entity? (entity-activation-range) with code?

tender shard
#

cuudconfig = YamlConfiguration.loadConfiguration(file); should be OUTSIDE of the if(!file.exists()) body

trim creek
#

it is outside of it

#

actually

#

but since my account is not activated here, i cant send images

tender shard
#

it's not

#

I have literally copy pasted your code

#

and replaced the try / catch with ...

tender shard
trim creek
#
if (!file.exists)) {
    ...
}
cuudconfig = ...;

thats how it something looks like

tender shard
#

no...

trim creek
#

...

tender shard
trim creek
#

ayowtf xd

#

thats what you mean

#

now i get it

tender shard
#

yes lol

tender shard
trim creek
#

next time i guess i should use the save and the reload event when creating that file...

tender shard
#

Ctrl+Alt+L automatically fixes the intendation, then it'd be easier to see

#

in intelliJ

trim creek
#

toosad i use eclipse

compact cape
#

Since PLAY_ONE_MINUTE is returning ticks... Does TIME_SINCE_DEATH return ticks as well?

trim creek
#

i guess thats fine for me

#

anyway thanks 😄

tender shard
#

np

prisma steeple
#

what do i find an item as?

#

Material.WOODEN_HOE

tender shard
#

but just try it out

#

oh wait

#

it's TIME_SINCE_DEATH

#

yeah then it's probably ticks

compact cape
#

Lots of changes!!!

tender shard
#

well you could just do a tiny plugin that prints the TIME_SINCE_DEATH every second in the chat

#

to find out

compact cape
#

I assume it is ticks and after I finished I'll check it while debugging

tender shard
prisma steeple
#

nevermind

compact cape
#

Just have to add a todo

prisma steeple
#

I can just use material

stoic vigil
#

i wanna set an itemframe with an item in it and some more nbt, how can i do this? ^^

granite owl
#

if i have an arraylist in a local scale like this ```java
ArrayList<UUID> targets = new ArrayList<UUID>();

harsh totem
#

does anyone know why it lets me use elytras? it should prevent me from equipping elytra

    public void noElytra(InventoryClickEvent event){
            if (event.getClickedInventory() instanceof PlayerInventory){
                if (event.getSlot() == 6){
                    Bukkit.getScheduler().runTaskLater(plugin, () ->
                    {
                        if (event.getWhoClicked().getInventory().getItem(6).getType() == Material.ELYTRA){
                            event.getWhoClicked().sendMessage(ChatColor.RED + "You can't use elytras!");
                            event.setCancelled(true);
                        }
                    },2L);
                }
            }```
tender shard
prisma steeple
#

how can i find the direction the player is looking at?

tender shard
stoic vigil
tender shard
harsh totem
tender shard
iron glade
#

Anyone knows why the first time I export my plugin after restarting my pc it's like it's not shading the gui library I'm using?

#

Caused by: java.lang.NoClassDefFoundError: me/minesuchtiiii/trollbossplus/gui/guis/Gui

ivory sleet
#

Depends timinator

tender shard
ivory sleet
#

If it gets passed to an instance field or returned and cached it might not be gc’d

iron glade
ivory sleet
#

But if you just use it as a temp list it will surely get enqueued once unreachable

granite owl
#

during the execution

ivory sleet
#

Mind showing me the code?

granite owl
#

sure but its still nasty

sacred mountain
#

any tips on how i could improve this>

#

or is it fine like so

ivory sleet
#

Well why is that plugin field static

#

And the prefix variable can be final

sacred mountain
#

well it doesnt really change and all i need it for is the getname ,ethod

harsh totem
ivory sleet
sacred mountain
granite owl
#

its too long so i dmd u the msg as file xD

ivory sleet
#

That’ll disclose whether you use it truly erroneously

#

That’s not the entire class?

sacred mountain
#

well its slightly broken rn

#

one sec

#

just undoing the changes and sending a paste

#

?paste

#

nvm

brittle lily
#

?paste

tender shard
brittle lily
tender shard
#

ArmorEquipEvent.registerListener

harsh totem
sacred mountain
#

most of it's from maximvmdw's logger class i'm just adapting it

ivory sleet
#

:/

sacred mountain
#

oh

ivory sleet
#

Id say it like this

#

Remove all the static

tender shard
sacred mountain
#

and make it a manage

#

manager*

ivory sleet
#

No

sacred mountain
#

oh

ivory sleet
#

What’s a manager?

sacred mountain
#

plugin.getCustomLogger().blahblah

ivory sleet
#

That’s a weird definition of a manager

#

Then an int could also be a manager technically xD

sacred mountain
#

true but

#

well yes

ivory sleet
#

But remove the static

kindred valley
#

?paste

prisma steeple
#

How do I increase the speed of the velocity ?

            Vector direction = player.getLocation().getDirection();
            player.setVelocity(direction);
sacred mountain
#

done, but how will i access it from nonstatic places now

kindred valley
#

?paste

sacred mountain
#

i mean

#

static

daring maple
#

nothing there should be static

kindred valley
#

paste is dead?

ivory sleet
#

Depends on what places

sacred mountain
#

is usnig it like this better

ivory sleet
#

Let me check the paste cmd rq limpeex

sacred mountain
#

so now i can just plugin.getLogger.blahablh

ivory sleet
#

The bot is dead

#

?ischocoreal

sacred mountain
#

rip

ivory sleet
#

Yep

harsh totem
ivory sleet
#

@sacred mountain but anyway if you need to access it statically then
MainPlugin.getInstance().getLogger() or sth should be fine

sacred mountain
#

ok

ivory sleet
#

where getLogger is an instance method of your main class

ivory sleet
#

This isn’t perfect

#

But it’s doable

sacred mountain
#

is it bad practise to have a static instance of your plugin defined on startup

ivory sleet
#

To some extent yes

sacred mountain
#

to only use in case of static needed stuff

daring maple
sacred mountain
#

i know how to dependency inject and avoid static abuse mostly now

#

so as long as i dont abuse that then i think it should be ok

ivory sleet
#

Static should by convention only be used for constants, stateless and arguably pure functions

#

(Utility functions, helper functions, factory functions)

tender shard
#

you have to do that, and then also register your own listener

#
    @Override
    public void onEnable() {
        ArmorEquipEvent.registerListener(this); // Registers MY listener that CALLS the event
        getServer().getPluginManager().registerEvents(yourOwnListener, yourPlugin); // Registers YOUR listener that LISTENS to the event
    }
#

you need to do both @harsh totem

humble tulip
#

i wanna learn kotlin

kindred valley
#

Hello, I am trying to make a duel plugin. When a player enters a command, they will enter a duel with another player and fight. If one of them dies, the match will be over, and if both do not die within the specified time, it will be a draw. However, in a way that I don't understand, sometimes some processes do not work, for example, if I use the command once and then use it again, it appears that it is a draw even though someone dies. Here is the paste. https://paste.md-5.net/wixicewata.java

ivory sleet
humble tulip
#

i'm done with npe's

sacred mountain
#

so my math classes and stuff can be static

ivory sleet
sacred mountain
#

true developing

ivory sleet
#

Minion well you can avoid npes in java as well by using good practices

stoic vigil
#

how do i create an itemframe object?

humble tulip
#

but sometimes it just happens

tender shard
sacred mountain
#

should i do INSTANCE = null; in the onDisable or is it redundant

ivory sleet
#

It is probably redundant

sacred mountain
#

aight

ivory sleet
#

Provided that the class that contains the static variable gets unloaded

#

Which it should if no other plugin keeps referencing that plugin instance

sacred mountain
#

yeah mk

ivory sleet
#

Like generally speaking, static doesn’t get garbage collected, but class loading makes it possible

sacred mountain
#

something like this?

stoic vigil
sacred mountain
#

lombok looks ugly for capitalized variables

#

imma make my own getter

ivory sleet
#

Yeah lombok sucks

harsh totem
#

@tender shard ok thank you

tender shard
tender shard
#

because it's not static final