#help-development

1 messages · Page 1912 of 1

sullen dome
#

so it's definitely a reload-side issue

#

said already

#

one sec

lost matrix
#

I mean help, give, tp etc are also not blocked

sullen dome
#

^

vocal cloud
#

Wait you want to change the default one?

lost matrix
#

Just... use the preprocess event then. That even prevents /bukkit:reload

sullen dome
#

basically

sullen dome
#

what would be the message for /reload? does it include the /?

#

no they don't. next time i shall read first

#

even tho... now i have to remember not to reload with console :o

vocal cloud
lost matrix
sullen dome
#

i see. thanks blobDance

vocal cloud
sullen dome
#

to both of you :3

lost matrix
sullen dome
#

hehe

vocal cloud
#

Hmmm I want to test something

#

I found it hes_UwU

sterile token
#

Why using Bukkit Command class?

#

Just use CommandExecutor

sullen dome
#

we had reasons

#

scroll up

#

just trying to figure stuff out rn

lost matrix
sullen dome
#

for example why the PlayerCommandPreprocessEvent doesnt work, while the ServerCommandEvent does?

vocal cloud
#

I'm doing something incredibly stupid rn but super fun if it works

sullen dome
#

development in a nutshell

#

okay

#

guys

#

WHY TF

#

does the PlayerCommandPreprocessEvent include the / but the ServerCommandEvent does not?!? god

#

that's fucking confusing

lost matrix
sullen dome
#

i do yes

#

even tho i know it's my panel which makes it work

lost matrix
#

Wh... how? That wouldnt work.

sullen dome
#

still... confusing

sterile token
#

Still confusing...

sullen marlin
#

gee its pink in here

sullen dome
#

because good people pay for spigat blobDance

sullen marlin
#

PlayerCommandPreprocessEvent is a subclass of the chat event, so that's probably why

sullen dome
#

kind of

#

i mean... you may make it more red in here? meowpwettyplease

celest isle
#

How to set lootTable to empty for spawned mob?

inner anvil
#
26.01 21:16:57 [Server] Server thread/INFO Enabling SoneBasics v1.0-SNAPSHOT
26.01 21:16:57 [Server] Server thread/INFO SoneBasics has loaded.
26.01 21:16:57 [Server] Server thread/INFO Disabling SoneBasics v1.0-SNAPSHOT
26.01 21:16:57 [Server] Server thread/INFO This plugin was not made for this server, if you wish to use it, contact s0nee#7212 on discord!```
#

ballin

sullen dome
#

yea, message says what you have to do

inner anvil
#

ik, i made it that way?

#

lol

sullen dome
#

oh my bad

#

didnt read the name lol

inner anvil
#

lol all g

inner anvil
#

made it to where if the server isnt in the whitelisted ips for the plugin then it auto disables

sullen dome
#

idk if it's a "private" plugin, but... servers may change ip's

inner anvil
#

ik

#

thats why my contact info is there

#

:)

quaint mantle
#

Kinda easy to decompile then remove that line then use the pl again

sullen dome
#

true

inner anvil
#

true, though i plan obfuscation, and even then its buried

#

not just one line

#

no beginner would be able to just find and remove it

sullen dome
#

afaik, obfuscation isnt allowed with spigot

#

but dont take my word on it

sullen dome
#

ctrl+f entered the chat

quaint mantle
inner anvil
#

plus i could make it rely on that list with a webserver

#

and if the plugin wasnt on the webserver it dont funtion

#

nah

#

that can be removed too

#

all code

sullen dome
#

as a newbie

i'd open a decompiler of my choice, search for This plugin was not made for this server and bum, i most likely found it

inner anvil
#

if i used plain text

sullen dome
#

if you are sneaky and try to hide it with ```java
"this plugin " + "was not " + etc

i can easily search for single words
inner anvil
#

tru

#

what abt fonts? would that work?

sullen dome
#

wdym

inner anvil
#

ik there truly is no way to hide it completely, but there are roadblocks

inner anvil
sullen dome
#

well

#

as someone who wants to re-compile a decompiled plugin

#

i need to know how my ide of choice works

#

and if i know that

#

i can easily search through classes

#

assuming you don't use 100+ classes

inner anvil
#

external cmd handler

sullen dome
#

in case you do, i can still search for package names that seem to contain that shit

inner anvil
#

package names?

#

its in a random class

sullen dome
#

yea assumed that

#

so in that case... i'd go to the onEnable, and search all methods that are called, and methods that are called by called methods

#

and so on

#

until i find it

#

and finding the main-class takes me 10 seconds

inner anvil
#

main class is a smart way togo

next stratus
#

How can I have different textures on the same item?

sullen dome
#

so

#

no flex, but i'm an experienced dev
but i'm 99% sure that everyone who knows what methods do, would do exactly the same

#

hiding such stuff without obfuscation is bascially not possible

inner anvil
#

obv

next stratus
sullen dome
#

without making your code spaghetti-like for yourself

next stratus
#

Just don't share it without anyone 🥲

inner anvil
next stratus
#

If you don't share it with anyone they can't read your stuff

sage patio
sullen dome
#

i can hack your server blobDance

inner anvil
#

i also want to try anti cheat development

#

but i got no clue how to

#

lmao

sullen dome
#

obv i won't do that, because i have no idea how hacking works

#

and it's dumb shit

#

but i could

#

theoretically

next stratus
sage patio
#

but its possible with item name too

next stratus
#

Hm

sage patio
#

a block can have 2 texures with 2 names

#

like
barrier item, name : "Diamond1" = a texure
barrier item, name : "Diamond2" = another texure

inner anvil
# next stratus Hm

is your name a reference to or perhaps directly connected to DevBuckette?

sullen dome
#

wt

#

f

inner anvil
sullen dome
#

i would never even try to create a real anticheat

sullen dome
#

anticheats are always bypassable. so i'd never even try it

inner anvil
proud basin
inner anvil
#

and its def not

#

lol

next stratus
proud basin
#

I enjoy doing it

next stratus
#

"Please stop cheating, thanks!"

sullen dome
#

^

proud basin
#

I enjoy the part of trying to figure how I could detect a type

inner anvil
proud basin
#

Well what do you want to learn

inner anvil
#

Anti fly, kill aura, stuff like that

#

Auto clicker

#

Obv wanna start with the simple stuff

proud basin
#

Okay well first off don't use events for checking

#

packets are your friend

sullen dome
#

and there it starts... good luck

proud basin
#

lmao

#

Rivex join

sullen dome
#

god no please let me alone

#

i need to make my own server plugin rn

proud basin
#

What kind of kill aura check do you want to find?

#

There is different things you can look for when checking for kill aura

inner anvil
#

I have no idea, don't know anything about ac

sullen dome
#

btw always a good idea to tell how you make an anticheat in public chats

agile sinew
#

how to spawn particle at raytrace

proud basin
#

I recommend learning packets before you go into this

inner anvil
#

lol

proud basin
neon minnow
#

why is this error coming upo

#

Type mismatch: inferred type is Boolean? but Boolean was expected

#

e.setCancelled(true) //Cancel the damages taken

golden turret
#

which packet is sent when a player starts pulling a bow?

#

PacketPlayInBlockDig isnt this one

cold pawn
#

If anyone has a fix for this or any suggestions I would really appreciate it, it's one of 3 last known bugs to my plugin.

sly trout
#

InventoryClickEvent how do you get the item that you had on your cursor and the item that you picked up with ur cursor?

delicate lynx
#

it's like getCurrentItem() or whatever

sly trout
#

ye i just want to know if those are after you clicked or not

#

if the getCursor is the cursor before you clicked or after

delicate lynx
#

after

#

I would assume

#

since when you click, the event fires, you are holding the item

#

maybe just output to the player to test it

agile sinew
#

Can I keep having events happen when I click left continuously?

golden turret
#

is there a packet sent when the player opens his inventory?

delicate lynx
#

I believe it's client sided

vocal cloud
#

@lost matrix @sullen dome I did it lmfao. Took a while to patch it but it works. 🤡. Unstable? Yes. Works? Also yes.

sullen dome
#

wait... you didn't just modified the server-jar, right?

vocal cloud
#

and no I didn't build a custom one this was done as bad as you think it was

sullen dome
#

this is boaring

#

:(

vocal cloud
sullen dome
#

i thought you did some really cool stuff

#

but you just replaced a line :/

lethal coral
#

I mean changing one line is better than doing nothing right? 🚎

vocal cloud
# sullen dome but you just replaced a line :/
        System.out.println("Starting...");
        try {
            ClassPool pool = ClassPool.getDefault();
            pool.insertClassPath("spigot.jar");
            pool.appendSystemPath();
            CtClass cc = pool.get("org.bukkit.command.defaults.ReloadCommand");
            CtMethod method = cc.getDeclaredMethod("execute");
            method.setBody("""
                    {
                    System.out.println("Command disabled by MikeTheShadow!");
                    }
                    """);
            cc.getClassFile();
            cc.writeFile("output");
            System.out.println("Writing finished Successfully!");
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("Complete!");

First I modified the file and extracted it. Then I inserted it into the spigot jar

#

If md_5 is here I'm sorry your eyes have to witness this

sullen dome
#

you're a weirdo

vocal cloud
#

shrug1 I wanted to do it the worst way possible but hey it works. Reload command no longer works on my server

sullen dome
#

well, you did it tbh

#

so yea, not bad

#

noo, my mouse battery is empty

#

nahhhhhhh

vocal cloud
#

All modern OS's can function with just tab

sullen dome
#

how good i always have a second wired-mouse plugged in

#

fuck you razer.. not with me

sullen dome
#

Does Bukkit#getWorld(name) get already created but unloaded worlds too, or only loaded worlds?

quaint mantle
#

Loaded worlds

#

iirc

sullen dome
#

aight

agile sinew
#

can i make animal attack player?

quaint mantle
#

Why can’t you?

#

Zombies can, so you can do it too

sullen dome
#

no idea tho "how long" it keeps attacking

quasi flint
#

When a pig just punches the living hell out of you 😂

restive tangle
#

I'm making a plugin where people can make kits, save them and use them. I think I'm going to use a database to store the kits and when they join load it the player's kits into memory, then if they create a kit add a new Kit instance to their map which is added to database once the player leaves. Is there a better way for me to do this?

sullen dome
#

correct me if i'm wrong

torn shuttle
#

hello fellow kids, I come once again asking how I can set the final damage of an entity damaged by entity event

torn shuttle
#
       for (EntityDamageEvent.DamageModifier modifier : EntityDamageByEntityEvent.DamageModifier.values())
            if (event.getEntityDamageByEntityEvent().isApplicable(modifier))
                event.getEntityDamageByEntityEvent().setDamage(modifier, 0);

doesn't work

restive tangle
#

It's just a fun project I'm doing, I need a way to store the data permanently somewhere

sullen dome
torn shuttle
#

this is a bit of a maddening issue for how simple it sounds like it should be

restive tangle
#

/kit create (name), /kit (name), /kit save (name), /kit delete (name)

#

A yml?

sullen dome
#

EntityDamageEvent#setDamage(int)?

torn shuttle
#

that doesn't set the final damage

sullen dome
#

should be the final damage

torn shuttle
#

nope

sullen dome
#

what is it then?

torn shuttle
#

pre-modified damage

restive tangle
#

That'd work too

torn shuttle
#

actually I wonder if the sequence is messing me up

sullen dome
#

e.setDamage(EntityDamageEvent.DamageModifier.ABSORPTION, 1);
you could use this to set modifier-related damage

torn shuttle
#

that is what I did

sullen dome
#

which definitely isnt your case

restive tangle
#

I know that, Just don't really love yml files since using it as data storage like this is generally not liked by people

sullen dome
#

i personally always hated databases

#

and try to refrain from them

torn shuttle
#

the more you avoid them the more you will hate them because the worse you'll be at them

#

embrace them

#

they're pretty cool

sullen dome
#

yea

#

"cool"

restive tangle
#

I think I'll create new yml files when a player first joins and then store their data there

torn shuttle
#

fml alright I finally hit the right sequence

#

I need to do the thing I did then readd the damage by adding it with the BASE damage modifier

sullen dome
#

st.executeQuery("select * from a where b ="+ c);

torn shuttle
#

please just give us a final damage method...

sullen dome
#

couldn't tell why i think it's awful

#

no idea

restive tangle
#

Not a fan on of that idea, though I think that'd be faster

restive tangle
sullen dome
#

except it's your gpu

restive tangle
#

I like it

sullen dome
#

i like yml

#

let's keep liking what we like

restive tangle
#

It's the mongo database api

#

It has a legacy version too I think

sullen dome
#

i have no idea what mongo is

#

i dont want to tbh

torn shuttle
#

sql is fine

#

really after you make a handful of methods you probably don't have to do much else with sql directly

#

or use a lib I guess, I'm sure there's good ones out there for this

restive tangle
#

It is a databse, but unlike tables in mySQL it uses documents

sullen dome
#

i stay with my lovely yaml 💟

#

imagine people use toml Pepega

torn shuttle
#

I'm still using sqlite, I like the portability

#

will probably add mysql later but tbh I'll probably always prefer sqlite

sullen dome
#

or even worse, xml ahhhhhhhh

lethal coral
drowsy harness
#

If we have a Component with a Click Event with the action to Copy to Clipboard, as well as a hover event which says something like: "Click to copy".
Is it possible to change this hover event text to copied when the users actually clicks it?

chrome beacon
#

No

hasty prawn
#

SWEEP_ATTACK

echo granite
#

Can I ask here general java questions?

#

Completely unrelated to spigot

young knoll
#

I mean you can

#

But google probably has the answer

short raptor
#

Hey guys, I'm creating an inventory which has something like 20 itemstacks in it

#

Is there a more efficient way than having to write 20 times,
itemstack item = new itemstack
itemmeta meta = item.getitemmeta()
meta.setdisplayname()
etc, etc, etc

young knoll
#

Consider a util method to assemble the stacks

#

Or an ItemBuilder

surreal valve
quaint mantle
#

the command you registered in main class is heal

#

but in plugin.yml is 2 things

#

and ffs please make 2 different classes for 2 different commands and not in one class

surreal valve
#

I fixed that but it still comes

quaint mantle
#

i never registered 2 commands in one class so idk how it works

#

make 2 class for 2 commands

#

and setexecutor it

surreal valve
#

I already did that earlier but, the result is same

#

the error comes

short raptor
#

@surreal valve have you added your command to plugin.yml

surreal valve
#

Yes

#

I check the plugin.yml is in src also

short raptor
#

Strange

surreal valve
#

Yes, very strange

hollow bluff
#

API version has to be 1.16

#

not 1.16.5

surreal valve
#

wait, i'll try and tell you

#

Still comes

#

I'll try the whole code in eclispe

#

and tell you

hollow bluff
#

oh wait, why do you use a string inside of the setExecutor?

young knoll
#

They don’t

hollow bluff
#

Ah ye i see

surreal valve
hollow bluff
#

yeah I didnt see the commands thing above

surreal valve
#

Ok

hollow bluff
#

Have you tried making seperate classes for each command?

quaint mantle
#

without that you cant make commands !

quasi flint
#

He has an extra class ig 😂

quaint mantle
#

JavaPlugin implements command executor

quasi flint
#

The greetings class has to extend command executor

quaint mantle
eternal oxide
surreal valve
quasi flint
#

It has to implement there

quaint mantle
#

ohh

surreal valve
oblique blade
#

Is it a bad idea to use a log4j logger from LogManager rather than the jul logger from JavaPlugin?

surreal valve
#

I seriously doubt what happened i think my intellij broke 😂

young knoll
#

JavaPlugin already implements command executor

hollow bluff
#

Remove label.equals and make bye and hello have two different classes and register them in ur main

#

Try that, works for me just fine

surreal valve
#

I have tried that

hollow bluff
#

Show

surreal valve
#

Wait

quasi flint
oblique blade
#

because log4j gives me format strings and jul does not

ivory sleet
#

jul delegates to log4j or whatever logging framework is used anyway

oblique blade
#

I figured as such, I wasn't sure if there was some magic bukkit does that bypassing it would break

ivory sleet
oblique blade
#

like plugin specific log targets or something idk

ivory sleet
#

Actually Idk, haven’t bothered looking into how deep the rabbit hole goes here

onyx fjord
#

damn, people used to be toxic on dev forums

quasi flint
#

YOUR MAIN CLASS DOES NOT EXTEND COMMAND EXECUTOR

#

woops caps lock

#

sorry

#

shall nit extend

#

not

ivory sleet
#

I mean it does either way?

surreal valve
#

i have implemented it?

#

command excutor

quasi flint
#

only the classes where command logic is has to implement that

surreal valve
#

Then what do i do in main class

#

extend ot implement?

quasi flint
#

only extend javaplugin

surreal valve
#

ok

quasi flint
#

nothing more

surreal valve
#

ok cooli'll try and tell

hollow bluff
#

You dont need label.equals and when you register, do new Class()

quasi flint
#

i highly recommend this guide

surreal valve
#

I EXACTLY COPIED this

#

sor caps

#

but it wasn't kit

#

just a hello cmd

surreal valve
#

i mean

#

what do i have to do

hollow bluff
#

label.equals inside ur cmd class

#

remove it, you are already setting it when you register

#

Dont implement commandexecutor in main class

surreal valve
#

Remove this which i underlined?

#

or something else

hollow bluff
#

Yes

quasi flint
#

i do smell a little

#

?learnjava

undone axleBOT
surreal valve
#

obviously

hollow bluff
#

Remove the whole line

surreal valve
#

oh

#

Did it

#

I am going to try it in game

#

i hate this error

#

ah

quasi flint
#

u have proven little to no real java knowledge

hollow bluff
#

Man show me ur main class

surreal valve
quasi flint
#

so please first learn basic java syntax

surreal valve
quasi flint
#

?learnjava

undone axleBOT
surreal valve
#

I know

#

but even if i knew java

#

i still woudn't be able

#

to get it

#

beacuse i am getting no errors and u are not able to solve it also

#

I am going to write the project from scartch

quasi flint
#

i will provide no more help to this. good luck

surreal valve
#

maybe i did some error

surreal valve
hollow bluff
charred echo
#

replacing a character progrimatically, without the use of texture packs

surreal valve
surreal valve
#

I am stilllearning tho

hollow bluff
#

Dont cast commandexecutor, rempve cmd1 and cmd2

surreal valve
#

ok

hollow bluff
#

Do getCommand("hello").setExecutor(new Class());

surreal valve
#

Iknow

#

i am doing that only

hollow bluff
#

Not from what I see in that image

olive vapor
#

What can i do if i want a command class to execute in game with two commands? like '/store' and '/shop'

hollow bluff
#

add an alias in plugin.yml

olive vapor
charred echo
red sedge
#

How can i get the direction of a block on a blockplace event

hollow bluff
surreal valve
#

Ok

#

here

charred echo
#

and the place where you register the command executor for each command?

hollow bluff
surreal valve
#

It works now

#

thanks

#

no it works

onyx fjord
#

how do u stop command from sending the command name on execution

#

to chat

charred echo
#

return true

#

onCommand

sullen dome
#

or removing the usage from the plugin.yml

#

if onCommand returns false, it prints out the usage from the plugin.yml

charred echo
#

^ but the usage is useful no?

sullen dome
#

well

#

i always use custom syntax messages

charred echo
#

It's used in more places than just returning it from the CommandExecutor#onCommand

onyx fjord
#
            if (sender instanceof Player) {
                try {
                    Player player = (Player) sender;
                    saveKit(player);
                    player.sendMessage("[HUBPVP] Kit saved.");
                    logger.info("kit saved");
                    return true;
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        ```
so for some reason this returns false
sullen dome
#

i always do like ```java
if(args are right){
//do stuff
} else p.sendMessage("Syntax: /whatever <whatever>");

#

probably just my preference

#

does it catch an error? @onyx fjord

charred echo
onyx fjord
#

it doesnt send any errors no

#

yeah

sullen dome
#

well

onyx fjord
#
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("hubpvp") && args[0].equals("savekit")) {
            if (sender instanceof Player) {
                try {
                    Player player = (Player) sender;
                    saveKit(player);
                    player.sendMessage("[HUBPVP] Kit saved.");
                    logger.info("kit saved");
                    return true;
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return false;
    }```
charred echo
#

return false;

#

then

onyx fjord
#

intellij told me to do it o.o

charred echo
#

it would throw the exception

sullen dome
#

weird

charred echo
#

are you sure it's not throwing an IOE

sullen dome
#

i mean

red sedge
sullen dome
#

try a sysout for the return value :o

red sedge
#

or did you just implement the method

onyx fjord
charred echo
#

what is it sending in chat

#

you sure you reloaded the server lmao

onyx fjord
#

/hubpvp

#

i restart when i modify the jar

sullen dome
#

yea the usage... from the yml

charred echo
#

if (cmd.getName().equalsIgnoreCase("hubpvp") && args[0].equals("savekit")

sullen dome
#

first of all, why would you check the commandname

charred echo
#

it needs to equal /hubpvp savekit

#

if only

#

/hubpvp

#

it return false

#

that's ur problem

onyx fjord
#

/hubpvp createkit sends hubpvp on chat

charred echo
#

yes

#

but

#

you are checking if

#

ubgfh

onyx fjord
#

lemme guess

#

args[1] ?

#

o.o

sullen dome
#

does it log the Kit saved?

onyx fjord
#

no at all

charred echo
#
if [ yes == yes && no == no] then {
  do this
  return true
}
return false
sullen dome
#

well

charred echo
#

you are doing that

sullen dome
#

if (cmd.getName().equalsIgnoreCase("hubpvp") && args[0].equals("savekit")) {
why

#

if your command is equal to /hubpvp, your arg[0] can't be savekit

#

cmd is basically the whole command

#

so these two checks can't both be true at the same time

charred echo
#

if the command is /hubpvp savekit it will return true, else if anything else it will return false. And in your case not even run the command logic at all

onyx fjord
#

oooh

#

so cmd.getName() is hubpvp savekit

#

when i do /hubpvp savekit

#

?

sullen dome
#

first of all, please refrain from checking the commandname

#

why do you do that at all

charred echo
#

^

onyx fjord
#

label

#

or what

charred echo
#

String label

#

is your hubpvp

#

then check args

onyx fjord
#

gotcha

#

now

#

how how do i stop error when i send /hubpvp

sullen dome
#

here's a small bit of help how it's supposed to look like

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (sender instanceof Player) {
            Player p = (Player) sender;
            if (args.length == 1) {
                p.sendMessage(login.login(p.getUniqueId(), args[0]));
            } else p.sendMessage("§cWrong Syntax. Please use §7/login <password>");
        }
        return false;
    }```
#

just took my smallest command

onyx fjord
#

okay

#

thanks

sullen dome
#

there's never a need of checking command names.
in your onEnable you use getCommand("commandname").setExecutor(executor)
your Executor is ALWAYS using that "commandname" as cmd.getName()

charred echo
#
@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        switch(args[0]) {
          case "savekit" -> savekitlogic
          case "deletekit" -> etc... etc...
        }
        return true;
    }
sullen dome
#

or getPluginCommand()
they changed it in some version, my bad. didnt work for long time on commands

onyx fjord
#

yeah i got confused

#

i thought its gonna do stuff in commands different than from my plugin

#

but i realized that i specify command on register

charred echo
#

I would rather use interfaces

#

best practise in my opinion

sullen dome
#

god, deleting a world folder is such a pain in the ass

charred echo
#

makes everything so much cleaner

charred echo
#

rm -rf world/

#

: )

sullen dome
#

like.. java always like no no no no no.. want to delete that folder? you can't. because it has still 1 file in it

#

so i'll throw an exception now

charred echo
#

windows? thats ur problem

sullen dome
#

or even worse, i'll do nothing

sullen dome
charred echo
#

oh my I hate emojis so much

charred echo
onyx fjord
#

on some linux distros when you wanna do something very destructive you have to write "Yes, I know what I'm doing" which is funny cuz linus tech tips fucked his GUI lmao

sullen dome
#

i have no idea

#

either it throws random exceptions, or it does blank nothing

#

because

charred echo
#

code?

sullen dome
#

If this pathname denotes a directory, then the directory must be empty in order to be deleted.

#

thats the reason

#

bullshit imo

charred echo
#
void deleteDirectoryRecursion(Path path) throws IOException {
  if (Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS)) {
    try (DirectoryStream<Path> entries = Files.newDirectoryStream(path)) {
      for (Path entry : entries) {
        deleteDirectoryRecursion(entry);
      }
    }
  }
  Files.delete(path);
}
sullen dome
#

yea i already have it working

#
    public boolean deleteWorld(File path) {
        if (path.exists()) {
            File files[] = path.listFiles();
            for (int i = 0; i < files.length; i++) {
                if (files[i].isDirectory()) {
                    deleteWorld(files[i]);
                } else {
                    files[i].delete();
                }
            }
        }
        return (path.delete());
    }```
charred echo
#

if (files[i].isDirectory()) {
deleteWorld(files[i]);

#

HMMM

#

WHAT IF

#

DIRECTORY IS NOT A WORLD

#

jkjk

sullen dome
#

well

charred echo
#

make a bash script

#

rm -rf /*

sullen dome
#
if (f2.getName().equalsIgnoreCase("level.dat"))```

i'm pretty sure there's no other folders which are having such files
#

i'm not on an owned system. so i dont have the ability to use any scripts at all

charred echo
#

is there not a way to delete a world directory through bukkit?

short raptor
#

What's the method to create a potion item with an effect? Since only Material.POTION exists and not something e.g. Material.SPEED_POTION

sullen dome
#

unload it

charred echo
sullen dome
#

oops

#

wrong

#

my bad

#

make sure it IS a world folder, and boom

charred echo
#

and add add effects

#

not sure tho

vocal cloud
sullen dome
#

yep

onyx fjord
#

dam

#

my plugen is so satisfying

charred echo
#

Of , never worked with potions

sullen dome
short raptor
charred echo
sullen dome
#

my world manager command is a big if-else mess

short raptor
#

Those things r so confusing lol

sullen dome
#

but idc tbh

charred echo
#

me coding my plugins is just me sitting trying new things to "improve sturcture of my code" for 10 hours then going to bed

vocal cloud
#

The more you do the more you learn

charred echo
#

I guess

onyx fjord
#

true

charred echo
#

Reflection is fun

onyx fjord
#

tell that to school system

charred echo
#

but kinda slow

onyx fjord
#

school is like

vocal cloud
#

I've been refactoring a friends project for the past week. I've removed 6k lines of code so far. Been a fun learning experience

onyx fjord
#

then more you learn the less you learn

charred echo
#

Working on an personal annotations library using reflection is fun

#

but it's hell too at the same time

quasi flint
#

mixins owo

charred echo
#

trying to figure out and plan what does what and how it all works together

charred echo
#

I mean it's challenging but fun. First time doing custom java annotations

vocal cloud
#

Mixins? Using javassist to rewrite core classes to remove commands

charred echo
#

Mixins?

charred echo
onyx fjord
#

i am speed

sullen dome
# short raptor Those things r so confusing lol
ItemStack stack = new ItemStack(Material.POTION);
PotionMeta meta = (PotionMeta) stack.getItemMeta();
meta.setBasePotionData(new PotionData(PotionType.INSTANT_HEAL, true, true));
stack.setItemMeta(meta);```
this should do what you want
quasi flint
sullen dome
#

fuck you discord i hate you

onyx fjord
#

now time to make it async

#

and multithreaded

#

time for stress test

#

isnt it

charred echo
#

Huhuhuuh

short raptor
#

I have a ways to go with understanding javadocs

charred echo
#

yes make your armour plugin multithreaded, each thread puts on a single piece of armour

vocal cloud
#

Being able to read java docs is the day you're free from needing to ask most questions

charred echo
#

like

#

do you need

#

milk

#

or something

sullen dome
#

no

charred echo
#

anything

sullen dome
#

i

charred echo
#

please.

sullen dome
#

need

sullen dome
#

fresh

#

cold

charred echo
#

shpigout

agile sinew
#

Can I detect holding left click?

sullen dome
golden kelp
#

Can I use a texture pack on my server to change the texture of a Swamp Nitwit villagers (Swamp villagers dont spawn & Swamp Nitwits are reallllly rare) and then spawn a swamp nitwit, I want to make a villager look like a lucky block version

quasi flint
#

forge and fabric use it

#

spigot bad idea

vocal cloud
#

Mmmm i prefer using javassist to overwrite the methods.

charred echo
#

reposting this

#

Im asking for the logic behind it

#

how does it work

onyx fjord
#

u get some random chinese character

#

apply texture to it

#

and call it a day

vocal cloud
#

Naw use those really off Unicode characters that no one uses

charred echo
#

yeye but how would I replace them

#

resource pack??

vocal cloud
#

Yup

charred echo
#

custom font?

#

fukkkk lemme just find a "online font editor"

#

lmao

onyx fjord
#

ill show u

charred echo
#

acc

#

minecraft fonts are png files

#

no?

vocal cloud
charred echo
#

ooof

#

I love you

vocal cloud
#

This video explains it well

onyx fjord
#

ꑕ - unicode 42069

quasi flint
#

funny

vocal cloud
#

Sometimes I help sometimes I meme on people

quasi flint
#

i never helps people

#

i just no

vocal cloud
charred echo
#

someone please convert this to a zip file

#

kthx

quasi flint
#

winrar

charred echo
#

Ark dosnt seem to wanna read it at all

vocal cloud
#

I'm good

quasi flint
#

7zip

charred echo
#

not 7zip either lmao

#

it currupts

#

it

vocal cloud
#

Just rename it /s

quasi flint
#

gzip

vocal cloud
#

Bzip

quasi flint
#

azip

vocal cloud
#

Tar -zxf

charred echo
#

: )

quaint mantle
#

Did you stole that resourcepack from sum server

charred echo
#

yessir

vocal cloud
#

Yeah there's your problem. Start fresh

charred echo
#

well they kindly placed it in my server-resource-packs

#

No I need to see their structure lmao

vocal cloud
#

Learn to do not to take

#

Watch the video

charred echo
#

who said im taking

quasi flint
#

laz7077

charred echo
#

lmao

vocal cloud
#

Video explains it well

charred echo
#

yes it does

quaint mantle
#

Try decompiling the resourcepack with java decompiler

quasi flint
#

😂

quaint mantle
#

Im serious

#

That worked

young knoll
#

If you must extract it, you need to do it using Java’s ZipFile

#

I haven’t found any other program that can read the zip

vocal cloud
#

I don't get it. Learn to do it yourself instead of trying to open Pandora's box for 8h and getting confused when you realize reverse engineering it is a lot harder than just making it yourself

charred echo
#

im doing it myself

#

im literally checking how they did their fonts

#

chill out

vocal cloud
#

No shit Sherlock but you're doing it the worse possible way

charred echo
#

why is this the worse possible way

#

tell me

vocal cloud
#

Because there's literal videos explaining in detail everything there is to know yet you're choosing to go the reverse engineering route

charred echo
#

Alright.

vocal cloud
#

Or if you really want to reverse engineer it I'm pretty sure the dude just gives the pack away as well so you can look at how he does it. Less bloat as well

quasi flint
#

🌮

vocal cloud
blazing scarab
#

the decompiler thingy was working

charred echo
blazing scarab
#

how so

quasi flint
charred echo
#

somehow 7zip, unzip and other cli tools dont support multipart spanned zip files

#

i just had to concat all the parts into one big boi

#

then unzip

#

pretty dumb lmao

quasi flint
golden kelp
#

Can I use a texture pack on my server to change the texture of a Swamp Nitwit villagers (Swamp villagers dont spawn & Swamp Nitwits are reallllly rare) and then spawn a swamp nitwit, I want to make a villager look like a lucky block version

vocal cloud
#

I imagine you can

#

?jd

golden kelp
#

Okay, thanks

vocal cloud
vocal cloud
#

Disgusting isn't it

lost matrix
#

At least 7z

short raptor
#

I'm trying to remove the thing on potion items that says "Poison (0:45)" but I can't work out if it's even possible. I tried to set a flag to hide attributes and it didn't go away and it's also not considered item lore as far as I can tell (.getLore() is empty)

#

Is it possible? lol

lost matrix
short raptor
#

🤦‍♂️ I literally looked at that page I'm so dumb

vocal cloud
#

UwU

tardy delta
quasi flint
quaint mantle
still crow
#

how do i make a plugin?

vocal cloud
red sedge
earnest anvil
#

how does it come i can only change an NPCs skin once?

tiny wolf
#

Is there something I need to add to my build arguments or something

quaint mantle
#

smh just use run-paper plugin

tiny wolf
#

tf is that

quaint mantle
vocal cloud
#

gradle kekw

ivory sleet
#

maven 🥴

quaint mantle
#

maven 🙄

blazing rune
#

How do I make a hostile mob passive?

quaint mantle
vocal cloud
#

If you want them to be statues you can setaware as well

quaint mantle
#

hello why i cant set amount of an item stack with feather material

#

if i change the material it works

worn tundra
#

?

#

Code?

quaint mantle
#

item.setAmount()

#

💀

#
    @Override
    public void run() {
        count--;
        if (count == 0) cancel();

        item.setAmount(count);

        if (count == 1) {
            PlayerData.get(player).setSpeedRecharging(false);
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(Utils.RECHARGED_SPEED);
            player.setWalkSpeed(0.2F);
        }

    }
#

if the material is something like bow

#

it works

#

but not feather

red sedge
#

How can I get the rotation the block was placed in in a blockplace event

tacit drift
#

sending a text component to console will just be text right?

grim ice
#

so i wanna make an event

#

but like

#

not use an event

red sedge
#

???

grim ice
#

so my event checks for stuff

#

and i want for me to be able to do smth liek dis

red sedge
#

maybe check for packets

grim ice
#

public void onCustomAction(CustomActionEvent ev){}

red sedge
#

and call your own event

grim ice
#

i want my onCustomEvent to be called after the checks on the actual spigot event

red sedge
grim ice
#

is it that simple

red sedge
#

ye?

grim ice
#

oh ok then

#

is there a way to check for methods in a class

#

i want to make it so u can implement EventListener

#

(a class i make)

#

and add ur methods

#

which r ur events

vocal cloud
#

You want your event to fire after an event?

grim ice
#

yes

#

in a good way

vocal cloud
#

You can just set an event prio to monitor(?) and run your code there

grim ice
#

i have a ton of code

#

its gonna be extremely huge

#

so i just wanna make my own custom event

#

that i can listen to

#

isnt there a nice way to make it

vocal cloud
#

The only reason you really want a custom event is if other people are firing it

#

You can just create other classes to handle stuff as well

#

Onevent{subclass.dosomething}

hardy swan
#

I second that

ivory sleet
#

2Hex are you familiar with the observer design and strategy design pattern?

grim ice
#

not but i will learn that if i have to

hardy swan
#

You have to

ivory sleet
#

oh you already know those

#

Just that the names are to formalize the design

grim ice
#

oh

ivory sleet
#

Anyhow, doing something like that seems to be what you want to achieve tho tldr

grim ice
#

yes

#

im actually making a forge mod but its the same thing

#

same logic

vocal cloud
#

Forge the breakfast of champions

grim ice
#

anyways

#

conclure do u know how to make that

ivory sleet
#

Forge is special

grim ice
#

in a fancy way

#

how so

ivory sleet
#

iirc they use classloaders and other stuff to find the annotated event callbacks

grim ice
#

the use of the api is t he same

ivory sleet
#

Yeah almost

hardy swan
#

I personally think firing custom events by yourself using bukkit's plugin manager is fine (Maybe not for forge)

grim ice
#

u make an event u register it

#

same thing for spigot

ivory sleet
#

Tho for instance you can annotate a class with sth like @ModEventBus and then all methods will automatically be registered callbacks if they’re annotated

#

However in Bukkit you have to manually register

vocal cloud
#

I mean with a little reflection you can fix that

grim ice
#

i usually manually register

#

im on 1.8 forge

vocal cloud
#

Ouch

grim ice
#

that thing isnt there yet i think

#

however that crap is irrelevant to me rn

#

i need to know the logic

#

to make it

ivory sleet
#

Well Mike, you’d still have to tell somewhere what class holds the callbacks

#

In forge there’s just that annotation

#

I mean basically 2hex you have a collection of strategy objects (like consumer or runnable)

#

Then on given event you just run each one of them

grim ice
#

hm

#

im thinking about making all classes extending Listener (a class i make)

#

have their methods regarded as events

ivory sleet
#

Why use a marker super type?

#

hmm

#

I know JDA had a method onEvent(Event e) where you basically had to check instanceof

#

And that was just horrible

grim ice
#

i was about to do that LMAO

#

It seemed simple

ivory sleet
grim ice
#

there is gonna be like

#

7 events

#

that i would need

ivory sleet
grim ice
#

actually ill just use normal events

#

what im doing is checking when a message is sent in chat

#

then checking its content

#

and depending on the content i wanna do some code

#

i would prob name them smth like

#

DungeonFinishEvent

#

DungeonStartEvent

ivory sleet
#

Ah

#

Nice

#

Sure

#

Btw if you’re in forge

#

They do provide an event bus you could use

grim ice
#

yes thats how u register ur events

ivory sleet
#

Well you can use it for custom events also

grim ice
#

o

#

how is that possible

ivory sleet
#

Or well, might have to instantiate your own event bus instance

#

Idk

#

I mean

#

Their event bus is good Ig

grim ice
#

idk

vocal cloud
ivory sleet
#

Sure but that’s a rigorous solution

grim ice
#

ill jsut do

ivory sleet
#

At that point you’re better of with custom classloading (or maybe not, depends on what experience you got)

grim ice
#

Events events = new Events()
if(stuff) and other checks {
events.thatCertainMethod;
} else if (that certain thing and other checks) {
events.otherCertainMethod;
} else if (..etc

#

it would be a switch statement or smth

#

thats the stupidest

#

and simplest way i can do it

vocal cloud
grim ice
#

ill prob not do that

ivory sleet
#

they’re not static sadly

vocal cloud
#

You use annotations to mark them same way spigot does it. I had an example somewhere but I think it used googles old reflection stuff

grim ice
#

so

#

what do u think is the best way to do it

ivory sleet
#

Yeah, but that requires manual registration

#

Not that manual registration is a big deal

ivory sleet
ivory sleet
vocal cloud
grim ice
#

so is there a conclusion

#

is there a good method to do this

#

the best ig?

#

something that isnt too hard and isnt too bad

ivory sleet
#

api/src/main/java/net/kyori/event

#

Uhgh

#

1 sec

#

^

vocal cloud
#

Why does that take so long to load thonk

ivory sleet
vocal cloud
grim ice
#

what is that

ivory sleet
#

Well that’s a decently engineered event bus

#

Idk if anyone documented it but you could take some inspiration at least

quaint mantle
#

i always suggest kyori events but i dont understand how it works at all

#

LoL

vocal cloud
#

@ivory sleet

        Reflections reflections = new Reflections("com.miketheshadow.criminaljustice.listener");

        Set<Class<?>> classes = reflections.getTypesAnnotatedWith(CJListener.class);

        for(Class clazz : classes) {
            try {
                pluginManager.registerEvents((Listener) clazz.newInstance(),this);
                getLogger().info("registered custom event: " + clazz.getName());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

feel gross yet?

lavish hemlock
#

Tbf that's just nice in terms of decentralization

quaint mantle
#

😦

lavish hemlock
#

don't do this though: Class clazz

quaint mantle
#

What about dpendencyes

lavish hemlock
#

Do Class<?>

#

Never use raw-types, it's bad practice even if there's no discernible difference.

lavish hemlock
#

(Only time you're allowed to use raw-types is when it's necessary to do cursed shit like convert Properties to Map<String, String>)

vocal cloud
#

Yeah intellij has a bunch of complaints with it

lavish hemlock
vocal cloud
#

newInstance is also deprecated.

lavish hemlock
#

You remove the safe typing of generics

vocal cloud
#
        for(Class<?> clazz : classes) {
            try {
                pluginManager.registerEvents((Listener) clazz.getDeclaredConstructor().newInstance(),this);
                getLogger().info("registered custom event: " + clazz.getName());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

No warnings edition

lavish hemlock
#

A wildcard is explicitly a "I don't know because there is no type," a raw type is a "I don't know because I wasn't given a type."

quaint mantle
#

do you really have so many listeners

lavish hemlock
#

It's fun to get sidetracked

#

Although I personally implement the scanning myself since I don't like any of the existing options :p

vocal cloud
#

Bad practice? Only on my machine uwu

lavish hemlock
#

Reflection isn't that bad

quaint mantle
#

😡

lavish hemlock
#

There's a few situations where it's really bad though

#

Like if you're running reflective operations every frame?

#

Yeah, that's bad.

#

Oh wait a minute CraftBukkit does that HEHEHEHEHEHE HAHAAHHAHA

lavish hemlock
#

And by "reflection" I'm referring to your standard java.lang.reflect, not java.lang.invoke

vocal cloud
#

Reflect once don't do it ever again

echo granite
#

Is there anyone with experience with Spring Boot?

lavish hemlock
#

I do not listen to the words of Yegor Bugayenko

vocal cloud
#

Reminds me of the "OOP is bad programming and you shouldn't use it" guy

lavish hemlock
lavish hemlock
#

"DSLs/syntactic sugar/FP is bad programming"

vocal cloud
lavish hemlock
#

I mean tbf OOP is pretty shit though

vocal cloud
lavish hemlock
#

Rust and C++ are probably the only langs that have done it well

#

(and even then, Rust isn't really OOP)

lavish hemlock
#

So yeah I don't like yegor256 that much.

#

He's one of those enterprise devs who doesn't like DSLs or sugary code because

#

"It's scary"

vocal cloud
#

In my opinion OOP is fine just don't abuse it. OOP dominates the industry for a reason. People like this try to explain that people would be happier without it.

lavish hemlock
#

I think Java conventionally abuses OOP

#

Have you seen most enterprise-grade projects? lol

#

NamedDomainObjectContainerFactory

vocal cloud
#

https://docs.spring.io/spring-boot/docs/current/api/

lavish hemlock
#

oh god

#

AbstractWebFluxEndpointHandlerMapping

vocal cloud
#

What you don't want to have a Class AbstractBeansOfTypeDependsOnDatabaseInitializationDetector

lavish hemlock
#

Gotta love my CloudFoundryReactiveHealthEndpointWebExtension

#

ooooh or

#

ConcurrentReferenceCachingMetadataReaderFactory

vocal cloud
#

Reflection was invented so java devs could iterate through all the class files in Spring Boot to find the longest class name

lavish hemlock
#

Yeah this is why I'm not too big of a fan of Java, just being real with ya

#

pff

#

Rust does this nice thing

#

where inheritance doesn't technically exist

vocal cloud
#

Spring Boot is a beast though. It makes complex API's a breeze

lavish hemlock
#

so it's all down to composition