#help-development

1 messages · Page 507 of 1

chrome beacon
#

why is plugin static

#

why do you have a constructor only accepting the plugin instance

cloud walrus
#

m new to codin plugins so ye

young knoll
#

Why getOrDefault with a default of null

cloud walrus
#

cant find proper guides so chatgpt helps me a bit

remote swallow
#

you dont really need the wait class you can just use ```java
Bukkit.getScheduler().runTaskLater(plugin, () -> {
player.setOp(true);
player.sendMessage(ChatColor.DARK_GRAY + "" + ChatColor.ITALIC + "You gained your OP permissions back.");
}, delay);

chrome beacon
#

?learnjava

undone axleBOT
cloud walrus
young knoll
#

get will already return null if there is no entry in the map

quaint mantle
#
public void async() {
    new BukkitRunnable() {
        @Override
        public void run() {
            Bukkit.getLogger().log(Level.INFO, "Log");
        }
    }.runTaskAsynchronously(Main.getPlugin());
}

public void run() {
    this.async();
}
public void async() {
    Bukkit.getLogger().log(Level.INFO, "Log");
}

public void run() {
    new BukkitRunnable() {
        @Override
        public void run() {
            async();
        }
    }.runTaskAsynchronously(Main.getPlugin());
}

I'm sorry if this is dumb but I'm new to spigot and java
Would both of these codes have the same performance and be called async? The difference is that in the 1st code, the runnable is in the function I want to call and in the 2nd code the function I want to call is inside the runnable

remote swallow
#

you dont need to worry about async for this

quaint mantle
#

Wouldn't be for this, it's just an example

chrome beacon
#

I don't think you're experienced enough to run things async

#

You're going to make your code slower and cause bugs

#

Keep it sync

#

Also read these

#

?main

chrome beacon
#

?di

undone axleBOT
cloud walrus
#

delay is in ticks right?

remote swallow
#

yeah

cloud walrus
#

alr ty

cloud walrus
#

Main?

chrome beacon
#

Your plugin instance

cloud walrus
#

also right after fixing this i think ill just follow some basic java guides as i immediatly skipped to plugin programming

cloud walrus
quaint mantle
chrome beacon
#

The instance of main

cloud walrus
#

oo alr ty

quaint mantle
remote swallow
#

that should be async

chrome beacon
#

IO should always be done async

cloud walrus
#

?learnjava

undone axleBOT
cloud walrus
#

they are free right?

remote swallow
#

should be

cloud walrus
#

alr ty

chrome beacon
cloud walrus
#

a hold on

quaint mantle
cloud walrus
chrome beacon
#

though you don't need to create annon classes

#

Just use the scheduler with a runnable

quaint mantle
#

Okay, thank you

wary mauve
#

Would looping through every player's inventory 6 times every 2.5 seconds be really taxing on the server?

young knoll
#

Probably not

#

But you could distribute it

#

?workdistro

wary mauve
#

Im using work distribution for certain things. Is it possible to have multiple? Like if I wanted to generate chunks super slowly, but have one that places blocks quickly?

young knoll
#

Sure

wary mauve
#

How does that work? Is it just two that run at different speeds?

young knoll
#

Yep

wary mauve
#

simple enough

#

For the searching thru the inventories, could I just do that asynchronously?

ivory sleet
#

technically yes

#

accessing can be done async

#

but u may not have an up to date state of the data

young knoll
#

Time for createInventorySnapshot to go with createChunkSnapshot

young knoll
#

Don’t worry about it

remote swallow
#

new pr for @worldly ingot to do

wary mauve
young knoll
#

I don’t think you can modify the inventory async

#

Could be wrong

ivory sleet
#

Why do u wna do it async

#

R u searching millions of inventories?

#

async does not imply better performance, better speed etc

wary mauve
#

It's to stop it from pausing a single tick, right?

ivory sleet
#

Its usecase is to do things async, like being able to run stuff whilst files are downloading

ivory sleet
#

But doing too much during a single tick can cause tps drop

#

Which may be a measurement of performance symptom

young knoll
#

Hence why instead of searching all inventories every 2.5 seconds you could search 20% of them every 0.5 seconds

#

Or 2% of them every tick

wary mauve
#

So what does asynchronous do?

ivory sleet
#

it means code wise

#

ur code runs non linearly in relation to declaration of flow

#

but thats a rather advanced definition

young knoll
#

Async does not mean faster, it just means you can avoid blocking the main thread for slow (web request) or intensive tasks (calculating all prime numbers…? Idk)

wary mauve
#

Okay, so I get that.

young knoll
#

Doing something async can even be slower as making new threads has overhead

#

(Some of that is alleviated here because Bukkit uses a thread pool)

wary mauve
#

So you're saying that searching through inventories is probably not what is causing tps issues? There are other things?

young knoll
#

Could be

#

Using timings to profile things

#

Or spark

remote swallow
# young knoll Async does not mean faster, it just means you can avoid blocking the main thread...
public class PrimeNumbers {
    public static void main(String[] args) {
        int n = 100; // set the limit of prime numbers to calculate
        boolean[] primes = new boolean[n + 1]; // create a boolean array to mark primes
        Arrays.fill(primes, true); // initialize all elements as true
        primes[0] = false; // 0 is not a prime number
        primes[1] = false; // 1 is not a prime number
        for (int i = 2; i <= Math.sqrt(n); i++) { // iterate up to the square root of n
            if (primes[i]) { // if i is a prime number
                for (int j = i * i; j <= n; j += i) { // mark all multiples of i as not prime
                    primes[j] = false;
                }
            }
        }
        System.out.print("Prime numbers from 1 to " + n + ": ");
        for (int i = 2; i <= n; i++) { // print all prime numbers
            if (primes[i]) {
                System.out.print(i + " ");
            }
        }
    }
}
``` prime numbers isnt that bad
young knoll
#

Did you write that

wary mauve
young knoll
#

Yes

wary mauve
#

Okay thanks! I'll give it a shot

remote swallow
rough basin
#

What should I do to detect player is holding mouse?

unkempt peak
#

Like left click?

#

Just use PlayerInteractEvent

brave sparrow
#

You can’t detect them holding left click

#

You can detect holding right click

unkempt peak
#

Yeah

#

Or if they left click once

#

Unless they are looking at a block then you could check if they are breaking it

nova quail
#

Hello how I can give to my player a sheep spawn egg in my plugin pls

full ruin
#

Question from earlier: if I install the Minecraft Development Plugin on intellij, will that get me set up with everything I need?

vocal cloud
#

Just add the item to their inventory?

vocal cloud
young knoll
#

In modern versions each spawn egg is its own item

#

On older versions iirc there was SpawnEggMeta

weak bear
#

I dont find how to have sheep spawn egg

young knoll
#

What version

weak bear
#

1.12.2

#

I know that's older

#

but

young knoll
#

All spawn eggs where the same material

weak bear
#

okay thx

young knoll
#

Idk what it was called, SPAWN_EGG maybe

fallow latch
#

i want to use JDBC sqlite driver, but where do i put the jar file that i downloaded? should it be in the plugin folder?

hazy parrot
#

you dont have to include it by yourself

young knoll
#

Might be outdated tho

#

If you want to include one in your plugin then shade it

hazy parrot
#
<version>3.41.0.0</version>
fallow latch
#

then do i still need Class.forName("org.sqlite.JDBC"); to load it?

echo basalt
#

yes

fallow latch
#

ok thank you :)

sullen marlin
#

It's also not really outdated, if at all

young knoll
#

You can’t shade the driver?

#

Sad

eternal oxide
#

the bundled one doesn;t have the getBoolean method so doesn;t play well with some things

hazy parrot
#

iirc sqlite driver doesn't really have boolean as an storage type

#

but more like 0 and 1

vocal cloud
worldly ingot
#

Neither does SQL

#

It uses a tinyint

vocal cloud
#

jump to 2.1

worldly ingot
#

BOOL and BOOLEAN are just synonyms

eternal oxide
#

yes but the driver has a getBoolean method

#

it auto translates

livid dove
#

So as a sanity check so I know im not being too overly critical here.

You ,as a developer, are working in the API of a lands plugin.

You find a method within the Land object called "delete()".

Asuming we live in a sane and reasonable world...
What does it do?

worldly ingot
#

Deletes that land, presumably. Or something contained therein

livid dove
worldly ingot
#

inb4 regenerates the land

livid dove
worldly ingot
#

Yeah I'm curious lol

livid dove
#

Then ask (its important)

worldly ingot
#

What does the Land#delete() method do?

livid dove
#

😡

worldly ingot
#

We love docs

livid dove
#

This entire guys api

#

is like...

#

"good luck chief"

worldly ingot
#

Based on the CF, I can only assume it removes data from SQL as well

#

The optional player may or may not send them a message

livid dove
#

Id like to think so... but then why the ever living hell does it have "LandPlayer" xD

gentle yacht
#

i am using the plugin.yml's library method to download a JNI dependency from maven, but since im loading the native libs from my plugin, i assume the bukkit classloader that loads the dependency cannot see the native library i loaded with the plugin's classloader. is there any way to get bukkit to load a native library?

worldly ingot
#

Some people like to include things in methods that should not be there, like sending messages

livid dove
worldly ingot
#

It do be

livid dove
#

omg this might be it xD

worldly ingot
#

Oh you tried that lol

gentle yacht
#

yeah

eternal oxide
#

add it to your libraries section of plugin.yml

gentle yacht
#

the classloader that loads the library is whichever classloader that belongs to the class that makes the call

eternal oxide
#

oh natives

gentle yacht
#

yes

#

i was hoping maybe bukkit might have a method like Bukkit.load(File nativeLib) or something of that sort...

eternal oxide
#

yeah, good luck on that

#

being that the lib will be platform dependent

gentle yacht
#

well yes

livid dove
gentle yacht
#

the only way i can get it to work rn is to shade(20mb) dependencies into my plugin

#

and i dont really like that option

brave sparrow
#

I just spent a bunch of time today getting outdated JNI stuff to work

#

Absolute nightmare

brave sparrow
gentle yacht
#

there is no method that lets me load the library as bukkit

brave sparrow
#

That might be helpful? @gentle yacht

#

I’ve never tried to mesh JNI with spigot so I’m not really sure

full ruin
#

aight

gentle yacht
#

well the problem lies with the classloader

echo basalt
#

something tells me you might need to fork spigot

gentle yacht
#

bukkit's classloader can't get classes loaded by the plugin's classloader

echo basalt
#

The plugin's classloader is created right after downloading the deps

gentle yacht
#

well, there is that, but ideally the simplest solution would be to have bukkit implement a Bukkit.loadNative() and Bukkit.load() method that call System.loadNative() and System.load()

brave sparrow
#

The problem you’re gonna run into is that what you’re doing isn’t particularly common

#

Lol

gentle yacht
#

maybe, but there's a lot of libraries out there that forces the user to load native libraries

#

it would be super nice

full ruin
#

Kinda jumping in, sorry. I'm trying to summon a block display and set what block it is... I can't really figure it out and would love a pointer in the right direction:

            Entity bd = origin.getWorld().spawnEntity(origin, EntityType.BLOCK_DISPLAY);
            bd.setBlock(Material.shape.get(i));```
#

setBlock is in red, it doesn't give me any of the methods for the BlockDisplay documentation.

gentle yacht
#

you need to provide a BlockData, which you can get from a Material

worldly ingot
#

Yeah, Entity is far too abstract for what you want

#
BlockDisplay bd = origin.getWorld().spawn(origin, BlockDisplay.class, display -> {
    display.setBlock(Material.shape.get(i));
});
#

(unsure what your Material.shape.get(i) is, but it does have to be a BlockData, not a Material. Something to keep in mind as well)

gentle yacht
#

choco is there any way to use the current packet bundle delimiters?

worldly ingot
#

No, and designing API for it is really hard because just exposing something like Player#sendDelimiter() is prone to misuse

worldly ingot
#

imho, the delimiter packet is something that should be used exclusively for implementation, not in plugins

sullen marlin
#

?xy

undone axleBOT
gentle yacht
# sullen marlin Why would it need to

i assumed that the maven libraries in the plugin.yml were loaded by bukkit's classloaders, but since i need to load the native libs from my plugin, the maven libraries can't access the jni methods since ithe native libs are loaded by my plugin's classloader

sullen marlin
#

Why would you make the assumption that a plugin library is loaded into the system classloader?

gentle yacht
sullen marlin
#

Not clear what issue you're facing

gentle yacht
#

i am trying to shade com.github.stephengold:Minie:7.5.0 into my plugin, but i need to load libbulletjme.dll/so since it doesn't come with or have any way to load the libraries itself

#

so in my plugin i call the system.load to load the native libraries in order to use the library

#

the error in particular is java.lang.UnsatisfiedLinkError: 'int com.jme3.bullet.util.NativeLibrary.countThreads()' at com.jme3.bullet.util.NativeLibrary.countThreads(Native Method) ~[?:?] at com.jme3.bullet.PhysicsSpace.<init>(PhysicsSpace.java:257) ~[?:?] at com.jme3.bullet.PhysicsSpace.<init>(PhysicsSpace.java:227) ~[?:?] at com.aaaaahhhhhhh.bananapuncher714.minietest.MiniePlugin.onEnable(MiniePlugin.java:74) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
which occurs after i load the native libraries

#

which i assume means that the class cannot find the specified JNI method

#

im not sure how the PluginClassLoader deals with the LibraryLoader

#

but i guess the library loader's parent is not the plugin's classloader

rough basin
#

aaaaahhhhhh

gentle yacht
#

so it doesn't go through stuff loaded by the plugin

#

aaaaaahhhhhhh

rough basin
wet breach
#

At least not typically

gentle yacht
#

im pretty sure every plugin has its own classloader?

wet breach
#

No they dont and that is why you get conflicts if you shade something in the same place as what another plugin has or the libs the server has internally

#

Hence it is recommended when shading something into your plugin you relocate it

young knoll
#

All plugins share the same classloader

#

So they can interact with each other easily

gentle yacht
#

no, im fairly certain every plugin has their own classloader

#

the reason for the conflicts is because whenever the plugin's classloader loads a class, it registers it with the JavaPluginLoader so that other plugin classloaders can access the class

full ruin
#

Am I on the right track here?

            bd2.setBlock(shape.get(i).getBlock().getBlockData());```
#

to spawn a display entity and then set it's block

gentle yacht
#

it should, have you tried it to see?

rough basin
#

?tryitandsee

#

bruh

young knoll
#

?tas

undone axleBOT
tall furnace
tall furnace
young knoll
#

Block display in this case

wet breach
gentle yacht
#

yes

wet breach
#

Anyways, as for your unsatisified link error, typically that only happens if you are using natives

#

Natives need to be on the path before your plugin loads. But if the library is only found out later then this cant happen and therefore the error and also why shading fixed the problem

sullen marlin
#

Plugins have their own classloader but resolve classes across all plugin loaders

young knoll
#

Interesting

wet breach
wise mesa
#

what's the easiest way to check if the item meta of two itemstacks is the same ignoring durability

#

and enchantments

livid dove
full ruin
wise mesa
#

well also you were casting it to Entity

#

which it is but Entity doesn't have any of the BlockDisplay specific methods

#

but choco also wanted you to use the consumer version of spawn

#

which is better for interfacing with other plugins

wise mesa
tall saffron
#

in my plugin.yml for my main command, what doesthe aliases do? commands: simpleserverrestart: description: Main Command usage: /simpleserverrestart aliases: "reload","version" permission: simpleserverrestart

wise mesa
#

other versions of the command they can type in to run the same code

#

in theory

wet breach
wise mesa
#

all meta

#

except for a couple things

#

would be nice if there was no except

#

because then I could just .equals

#

but alas

sullen marlin
#

You could clone them and clear the stuff you don't care about

#

Then compare

#

No other way I can think of

wet breach
tall saffron
wise mesa
#

ooh that could work

wet breach
#

Oh md beat me

wise mesa
#

unfortunate there is no more efficient way

sullen marlin
#

Aliases are not arguments..

wise mesa
#

if you want to make it pop up while they're typing you'll need to add a tab completer

#

or use a command framework like ACF or the 1.13 command one

tall saffron
#

Oh okay thanks!

wise mesa
#

upgrading referring to like changing the custom attributes we want all items of a type to have

echo basalt
#

haha command framework go brr

tall saffron
#

and whats the subcommands inside the commands: do, or what does it do?

wise mesa
#

especially trying to deal with old versions of items in chests

#

is inventory.forEach slow?

#

slower than like looping through each item

#

for i

full ruin
#

oh wow thanks so much @worldly ingot I've been a bit spacey today and missed your message. Yep that was exactly it but after digging a ton I found it on my own.

full ruin
wise mesa
#

yes

#

but try using the consumer version of spawn

#

it runs the function you pass in setting all of the entity's attributes before running like the spawn entity event

#

as opposed to running the event before you set all of your settings

full ruin
wise mesa
#

hmm let me take a look

full ruin
#

there was a suggested fix that worked. I'm not very experienced with consumers. Posting code in a sec

wise mesa
#

a consumer is really just a lambda

full ruin
#

not experienced with lambdas either

#
        for(int i=0; i<shape.size(); i++) {
            //Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "summon minecraft:block_display " + origin.getX() + " " + origin.getY() + " " + origin.getZ() + " {block_state:{Name:"+blocks.get(i).getType().toString().toLowerCase()+"},CustomName:'\""+i+"_"+ID+"1\"'}");
            shape.get(i).getBlock().setType(Material.AIR);

            int finalI = i;
            BlockDisplay bd = origin.getWorld().spawn(origin, BlockDisplay.class, display -> {
                display.setBlock(blocks.get(finalI).getBlockData());
            });

            //bd.setBlock(blocks.get(i).getBlockData());
            System.out.println(bd.getTransformation().toString());
            int x = origin.getBlockX()-blocks.get(i).getX();
            //System.out.println("x is " + x);
            Transformation trans = new Transformation(new Vector3f(origin.getBlockX()-blocks.get(i).getX(), origin.getBlockY()-blocks.get(i).getY(),origin.getBlockZ()-blocks.get(i).getZ()),bd.getTransformation().getLeftRotation(), bd.getTransformation().getScale(), bd.getTransformation().getRightRotation());
            bd.setTransformation(trans);
            System.out.println(bd.getTransformation().toString());
        }
#

The goal is just to take the two arraylists, which has the locations and the blocks, and turn it into a bunch of display entities in the same locations visually but all located in a single point.

#

aha ok yea actually it all works now. I may need to rethink how I'm storing blocks and how I'm replacing them, but whatever

wise mesa
#

wonderful

#

does javac compile a foreach loop with an array to a fori loop

#

is it smart enough to do that

full ruin
# wise mesa wonderful

xD was about to say exactly the same thing. I switched it out now, I think I'm keeping my pointers all straight now with replacing blocks.

The goal is to try to get something resembling contraptions in create, using display entities, their transformation animations, and invisible shulkers.

full ruin
wise mesa
#

no worries was more asking generally to anyone who knows

full ruin
#

But if I'm thinking of the same thing, I'd like to use the index for lots of things anyways so I just figured I wouldn't mess with it

wise mesa
#

how do I reset the damage of an item

#

i have the item meta and have casted to damageable

#

would set damage 0 be a broken item or a brand new item

wet breach
wet breach
wise mesa
wet breach
#

0 is broken

wise mesa
#

what is damage then

wet breach
#

Health for item

#

Which they have like 0.01 or something like that

wise mesa
#

so I can set it

wet breach
#

Attributes

#

Well actually there may be an api method

wise mesa
#

material#getMaxDurability

wet breach
#

Yeah that. On phone at work lol

sharp bough
#

recently found this code snippet in a project and i was wonder what is it and how could i use it?

#

i couldnt find anything about baseCommands, or using @ to register commands

tall furnace
echo basalt
#

and hella picky to code

tall furnace
#

I don't really have problems with them once I figured it out, just don't put it all in one method and it seems to go fine.

echo basalt
#

with tons of comments too otherwise you lose yourself

tall furnace
#

#commentsSaveLives

echo basalt
#

but hey at the end of the day you end up with a neat command system

#

mine's still being worked on but overall decent

tall furnace
#

I'd share my own snippets but I'm at my brother's house on my phone.
My code's a bit denser-looking though; I tend to only have whitespace between categories. Not sure if it's a good thing or not. But for now, it's kinda signature I guess.

#

Helps me keep track of where I am

echo basalt
#

up to each own

#

It's still compatible with my old simplecommand system

tall furnace
#

Nice

echo basalt
#

which is a lot more basic but still does the job

tall furnace
#

I tend to break up my command executor into methods based on the number of arguments used. Then I call classes for each major subcommand.
Though many of my projects use very few commands, if any.

echo basalt
#

well

#

my projects are a bit bigger than that

tall furnace
echo basalt
#

like quite a bit bigge

tall furnace
echo basalt
tall furnace
# echo basalt like quite a bit bigge

37k is a few O.o My only projects that size were standalone stuff. Made an ecosystem game one time, was experimenting with programming DNA. I deleted 16gb of code when I got rid of that project.

tall furnace
#

No shading?

echo basalt
#

like no shaded libraries

#

we just like

#

made a separate thing for that

#

to minimize upload times

#

because some of code on the go

#

with mobile data

tall furnace
#

Oh, I used no libraries for that project. Default JDK stuff only.

echo basalt
#

yea

tall furnace
#

Tbh though that was a few years ago. If I were more efficient I could have gotten it down to 4gb. I've learned alot since then.

echo basalt
#

mans writing android

tall furnace
tall furnace
echo basalt
#

it like

#

lets us make features without having to hardcode stuff like animations

tall furnace
#

animations are scary

echo basalt
#

So we just do a little model like this

#

make a little implementation like this

#

and my code does magic

#

not only reading the lines and converting them to params and all

#

but it also learns the syntax and lets you have an in-game editor

#

that can write valid objectives

tall furnace
#

Huuuuhhh, interesting

echo basalt
#

took me like 2 days to write this

tall furnace
#

It's gorgeous

echo basalt
#

and it even writes these lines

tall furnace
#

It's motivated me to fix and flesh out my Warps gui

#

Oh nice

echo basalt
#

the GUI part was the laziest part

#

I just did like 3 guis in half an hour

#

or well more like 5 but still

tall furnace
#

Yeah but you should see my garbage 7-years-old warps gui

echo basalt
tall furnace
echo basalt
#

yeah so there was a thing where like

#

you could do

#

if {played}={played} then set played to 123

#

and for some reason the right side was always parsed as a literal while the left side could be a var

#

and it's basically a way to see if a variable is unset

#

so that gave me the idea to make checkstyle warnings

#

but I never really followed through

regal scaffold
#
error: cannot find symbol
        if (getItemStackHelper() != null && getItemStackHelper().isStack(value)) {
            ^
  symbol:   method getItemStackHelper()
  location: class MemorySection
#

What does this even mean

#

I'm using the exact same code in other project working perfectly

cobalt thorn
chrome beacon
regal scaffold
#

Well it did

regal scaffold
#

Problem was I forgot to add annotationProcessor 'org.projectlombok:lombok:1.18.26'

#

....

tepid jetty
#

Wdym?

#

And why do you don't know this? You are the fricking developer from Spigot or not?

hasty prawn
#

?? He helps develop Spigot, yes. That does not mean he has every plugin that's ever been published memorized.

chrome beacon
vocal cloud
#

md_5

says something could be a security risk

entitled 16 y/o

How do you not know everything about everything

I love this discord

charred blaze
#

is these systems possible with mbedwars API and me as 'begginer"

chrome beacon
#

Try it and see

charred blaze
#

looks difficult

chrome beacon
#

It's not hard

#

If you find GUIs a bit difficult you can always use a GUI lib

charred blaze
#

not talking about GUIs

#

how do i implement features

chrome beacon
#

The most difficult part would be item prices

charred blaze
#

yeah

#

i may need to modify everything's price which shouldnt be good

tepid jetty
chrome beacon
#

Security risk does not mean there wouldn't be a way to do it

#

There's probably a plugin out there that can do what you want

#

for example you could whitelist certain placeholders

tepid jetty
chrome beacon
#

Placeholders can expose information you don't want

#

It could also trigger code that you might not want to run

topaz atlas
#

I added kotlin to my .pom in my maven project

#

Do I just build it normally?

#

How can I see that kotlin actually added to my project

#

I noticed a few jar files were downloaded somewhere in my libary

#

that means it was downloaded right?

chrome beacon
#

You will also need to shade the kotlin library

topaz atlas
chrome beacon
#

I'd stick with Java for now

topaz atlas
#

i tried adding this


                            // Get the name of the current class
                            val className = this::class.java.name

                            // Unload the current class from the class loader
                            (classLoader as java.net.URLClassLoader).close()
                            val cleanClassLoader = java.net.URLClassLoader(arrayOf(java.io.File(".").toURI().toURL()), this::class.java.classLoader)
                            val loadedClass = cleanClassLoader.loadClass(className)``` But val is undefined and stuff
chrome beacon
#

You don't need to switch Programming language

topaz atlas
wet breach
topaz atlas
#

its a smaller learning curve

chrome beacon
#

You barely know Java

wet breach
#

Lol

topaz atlas
#

yeah, but I have good enough reasons to try kotlin

#

Anyways, ima look up how to shade the libary

#

I was thinking more of this:

#

^ this seems really good

remote swallow
wet breach
#

Considering the majority use java and not kotlin

topaz atlas
#

In the same file too

#

I actually just need kotlin for one thing

#

Well actually a few

#

But the majority will be written in java

topaz atlas
wet breach
hazy parrot
#

I highly suggest against mixing java and kotlin

topaz atlas
hazy parrot
#

For what thing

topaz atlas
# hazy parrot For what thing

varibles, reloading class's. Things it's much better at than java, anyways, I already compiled it, its not like they'll mix up in the same class, let alone file, turns out

hazy parrot
#

Gl ig

warm mica
#

It's just a mess

#

Spaghetti code

queen lion
#

[10:47:30 WARN]: Exception in thread "Thread-9" java.lang.Error: java.util.zip.ZipException: zip END header not found
[10:47:30 WARN]: at PlaceholderAPI-2.11.3 (1).jar//Updater.a(:144)
[10:47:30 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
[10:47:30 WARN]: Caused by: java.util.zip.ZipException: zip END header not found

#

How can i fix this? a lot of plugins give this error. I tried to redownload but nothing.

topaz atlas
#
                    <sourceDir>${project.basedir}/src/main/java</sourceDir>```
#

Tells you where both libs will run

#

NVM

#

Sorry

chrome beacon
#

If you're in a container it should be fine to delete all jar files (including the libraries folder etc) and then reinstall them

queen lion
#

i already tried

#

i tried different host and is the same

rough drift
#

Is there a way to parse like hotbar.0 or armor.head to the correct slot index?

chrome beacon
wet breach
charred blaze
#
    public void onWaterWalk(PlayerMoveEvent e) {
        Location loc = e.getPlayer().getLocation();
        if (loc.getBlock().getType() == Material.WATER || loc.getBlock().getType() == Material.STATIONARY_WATER) {
            System.out.println(1);
        }
    }```
this isnt working when im walking in water. any idea why?
charred blaze
queen lion
#

ok i will redownload jar server and plugin again

chrome beacon
#

As I said you need to delete all jars

#

Including the libraries folder

#

Also the cache folder if you're running Paper

drowsy helm
#

the event is firing right

#

dont see a reason why it shouldnt work

chrome beacon
#

You can always print what getType is

charred blaze
#

ill try this instead player.getEyeLocation().getBlock().isLiquid()

#

it workd

charred blaze
#

can anyone tell me how can i spawn this particle with 1.12.2 api

#

particle: breaking redstone block

tender shard
#

all you need is a bit of math

#

imagine you have x0 and y0, x1 and y1, and z0 and z1

#

then you just loop over those and spawn a particle everywhere

charred blaze
#

no i just need name of particle

tender shard
#

for x = startX, x <= endX, x+= distance

charred blaze
#

i already know how to

tender shard
#

oh

charred blaze
#

thanks for explaining btw

tender shard
#

looks like blockdust or whats it called with REDSTONE as material data

charred blaze
#

i had problems months ago with material data and switched to 1.16.5 server but i need 1.12.2 now. can you provide me with some examples?

tender shard
#

oh I don't know anything about 1.12 code

charred blaze
#

:(

tender shard
#

I started doing minecraft plugins at 1.13

warm mica
#

new MaterialData(Material.REDSTONE_BLOCK)

peak gulch
#

How ddos attacks bypass anytbot systems? What payload could bypass this type of stuff?

chrome beacon
#

You just spam a bunch of data from hundreds of locations at once

#

That will overload the server

hollow dune
#

What’s up. I’m looking for the best way to filter console logs. Specifically stuff like xx issued server command: /. I have tried setting a custom filter for Bukkit.getLogger()/getServer().getLogger(), but even trying to prevent all log records has no effect. Thank you.

wet breach
# peak gulch How ddos attacks bypass anytbot systems? What payload could bypass this type of ...

Ddos is just data going to your server box. There is nothing you can do if it reaches the box software wise. You need to stop it at the network switch or at the entry for the datacenter. Otherwise you are just screwed. What can help though on the box if the bandwidth being consumed isnt the total bamdwidth you have, you can configure the box to just not respond and not do anything with the packets

#

But yeah not much hope if the attack reaches your box though except hoping the datacenter sees it and nulls route it

peak gulch
#

Okay , thx

topaz atlas
#

Does anyone know where I can download a 64 bit version of maven

#

Exception occurred executing command line.
Cannot run program "C:\Program Files (x86)\apache-maven-3.9.1\bin\mvn" (in directory "C:\Users(censored)\eclipse-workspace\onutillities"): CreateProcess error=193, %1 is not a valid Win32 application

#

this was wbat i tried to run

sullen marlin
# topaz atlas

Pretty sure you've just configured it wrong and you just need the maven folder

#

Otherwise you need to reference mvn.cmd or whatever

#

But tbh that just looks like you're doing something entirely weird

#

What tutorial told you to do maven like this

topaz atlas
#

thats a file right

#

?

sullen marlin
#

Idk look in the folder and see what's there

#

But if you want maven you should just be importing the project and m2eclipse which is installed by default handles it

topaz atlas
topaz atlas
#

I needed to run clean install because of the -U flag.. until I realized I could have added it to the clean package thing... so I sorted out my issue

hollow dune
#

Can you access Log4j's appenders from a plugin? Specifically to add a Filter to the existing console logger.

tender shard
tender shard
#

just use getLogger() and whatever you want with it

hollow dune
# tender shard yes

the appenders and filters are under the spi package, which when used results in a 'no class def found' error (at runtime)

#

so maybe I'm using the wrong maven dependency?

#

the "normal" one ive found doesn't include the appenders/filters at all

hollow dune
#

I just read, something changed with log4j at some point and the 'correct' solution appears to be to cast the logger to the "core" variant

#

which does expose the filters and appenders

#

so i imagine thats the solution

hollow dune
#

yeah thats literally what im doing

cobalt thorn
#

Hi, im having some problem with this code, it goes out of bounds. https://sourceb.in/rkA32mPjt8 even if the task cancel is called correctly
StackTrace:

[14:36:18 WARN]: [plugin] Task #24 for plugin v1.0-SNAPSHOT generated an exception
java.lang.IndexOutOfBoundsException: Index 24801 out of bounds for length 249
    at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?]
    at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?]
    at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[?:?]
    at java.util.Objects.checkIndex(Objects.java:359) ~[?:?]
    at java.util.ArrayList.get(ArrayList.java:427) ~[?:?]
    at net.rosamei.alixapi.animation.BlendCutscene$1.run(BlendCutscene.java:58) ~[Plugin-1.0-SNAPSHOT.jar:?]
tall dragon
# charred blaze :(

idk if its still the same in 1.12 but i used Effect.STEP_SOUND to create those particles back in 1.8

#

only problem might be that the sound of the block breaking will also be played

hollow dune
hazy parrot
#

cool, that is good to hear 👍

hollow dune
#

a random thought I had, are there any 'template' servers that people use to test their plugins in a more typical environment to check for conflicts and similar problems?

cobalt thorn
viscid fractal
#

How do I got about initializing the config file the first time the plugin is ran/if config file is deleted?

viscid fractal
#

like how do I put default options in the config

cobalt thorn
#

with saveDefaultConfig() it should be done

viscid fractal
#

ok but how do I set what goes in the default config

#

everytime I try to find it online it just brings me to custom configs

cobalt thorn
viscid fractal
#

oh... it just takes it from that?

cobalt thorn
viscid fractal
#

lol. thank you very much

cobalt thorn
#

no problem

jagged bobcat
#

Hello spigot, is it possible to make players own dogs attack the player who owns them

#
  • is it possible to have custom model data for a gui so I can make a chest which looks transparent
#

And still have the other guis look the old way

cobalt thorn
#

but for scoreboard works just fine

#

%img_offset_-500% with this

knotty meteor
#

https://sourceb.in/2A0ttlkU5v
Does someone know why if i run the updateBossBar() method it doesnt remove the old bossbar but just creates a new one and eventually i have my screen spammed with bossbars?

#

(I use 1.19.2)

eternal night
#

I mean

#
   for (Player player : Bukkit.getOnlinePlayers()) {
            if (bossBar != null) {
                bossBar.removePlayer(player);
                bossBar = null;
            }
        }
#

is pretty wrong if this aims to remove all players from the bossbar

knotty meteor
#

Yeah i tried removeAll and everything, same issue

eternal night
#

You then also create a new bossbar per player

#

What prevents you from just

#

calling setTitle

knotty meteor
#

That is actually not a bad idea

eternal night
#

on the bossbar

knotty meteor
#

Because then it thinks the bossbar doesnt exist

eternal night
#

I mean, obviously don't remove players then

knotty meteor
#

So i dont know what is happening but everytime it creates a new bossbar

#

But the issue is when i try to remove player from the bossbar it remains in your screen and it creates a new one, so i have many

#

And the bossbar is already created per player because of the for each

ivory sleet
#

which line is 58?

#

the get(int index) one?

cobalt thorn
#

wait i tell you better im opening intelli

cobalt thorn
ivory sleet
cobalt thorn
cobalt thorn
#

https://sourceb.in/zgVActp9Zo

java.lang.IndexOutOfBoundsException: Index 249 out of bounds for length 249 in line 6
my question is how is outofbound if is 249 on 249

brave sparrow
#

Java arrays/collections start from 0

#

The element at index 0 is the first element, the element at index 1 is the second element, and so on

#

If there are 6 elements in the collection, there can’t be an element with index 6 because that would be the seventh element

cobalt thorn
brave sparrow
#

That’s unnecessarily complicated

#

Just

#

this.frameIndex < animation.getFrames().size()

cobalt thorn
#

if (!(this.frameIndex < animation.getFrames().size())) cancel(); because i use the method to cancel

brave sparrow
#

if (this.frameIndex >= animation.getFrames().size()) {
cancel();
return;
}

#

You need that return, it’s missing in your code and that will cause additional problems

cobalt thorn
#

ok thanks, for the help

earnest wasp
#

Hello How I started Bungeecord Plugin in 1.19 and What I need?

#

I know for Spigot 1.19 but IDK for Proxy

subtle folio
earnest wasp
subtle folio
#

Right

#

so make a bungeecord plugin..

#

If you're using the IntelliJ minecraft development plugin, then you can specify you want to make a bungeecord plugin with that

earnest wasp
#

I use eclipse

subtle folio
#

Well 🤷 look up how to initialize one.

earnest wasp
#

If I add Bungeecord.jar in my java project and he send me error

chrome beacon
#

Use a build tool like Maven or Gradle

knotty meteor
knotty meteor
#

No, but that is not the issue it creates a bossbar when i add boost but it doesnt remove the old bossbar so it creates multiple

chrome beacon
#

Yeah you don't have any code removing the old one?

agile anvil
#

clearBossBars only clear your map

chrome beacon
agile anvil
#

I mean this code is meant to remove a bossbar and remove the bossbar from the list isn't it?

#

But it only does the second part

chrome beacon
#

It does remove the bossbar

#

That's not the issue here

#

They're not calling the method at all (since totalBoost isn't less than 1)

agile anvil
#

my god

#

really need not to code after work

pseudo hazel
#

what do you do at work

#

or is it just very tiring in general

slim wigeon
#

Is there a ShopGUI+ api doc somewhere?

wraith cradle
#

bump

granite olive
#

If a player is in a separately loaded world and quits/logs out. How should unloading that world be handled (I want to delete the file)?
Right now I have a listener for a player quit even which unloads the world using Bukkit.getServer().unloadWorld(world, false);
However, the response from that invocation is always false meaning the world does not get unloaded.
What needs to be done differently here?

knotty meteor
tall furnace
tall furnace
earnest wasp
river oracle
#

Use a build system like maven or gradle

agile anvil
pseudo hazel
#

I see

tall furnace
# earnest wasp Import no find

If eclipse isn't finding the import, normally it's because the imported file was moved. Can you provide additional information?

fresh imp
#

Hello I am trying to make my plugin add scalar without deleting the standard attributes

newMeta.addAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS, new AttributeModifier("generic.armourToughness2", upgradeVal, AttributeModifier.Operation.ADD_SCALAR));;

and after that I set meta of the item with new attribute
the newMeta is item.getItemMeta()
upgradeval is 0.075

So how I can just add an scalar without deleting standard values?

wary mauve
#

This is what I want to accomplish:

  • Have a thousand randomly generated "MicroWorlds" (5x5 chunk areas) that can be copy and pasted into a void world.

Is this possible, specifically, the copy and paste part? Is it feasible to have the server do this a bunch? What would be the easiest way to accomplish this?

grizzled mason
agile anvil
wary mauve
fresh imp
#

Nvm I found that I can .getAmount of modifier

rotund ravine
tall saffron
#

Can i make an update checker before i upload my plugin on spigot? 🤔

#

Ik it sounds dumb, but i want the first version to already have it, if it isnt possible or is too complex is fine

fossil apex
#

The mods I added using customplayermodels are conflicting with itemsadder. The model loads correctly when itemsadder is not present, but it gets distorted when itemsadder is loaded.

hazy parrot
wary mauve
#

Or a block populator?

granite olive
#

if I try to unload a world and delete its files but the unload fails, what can I do to make sure the files are deleted as soon as the unload is possible?

#

The problem only arises when the last player in a world quits and it tries to unload it

keen ferry
#

Hi! I'm iterating over blocks in a certain area, I don't know their types. I want to print their direction, then change it (I want them to face South, for example). How would I do that?

keen ferry
tall saffron
#

Hey, sorry its soo late, i tried this update checker and it seemed to work fine as i put my plugin on a version below the published one, so it was working, but then i putted it in a version greater and it stills sends the message saying a new update is available

remote swallow
#

most likely its being cached

kind hatch
tall saffron
remote swallow
#

sadly not

keen ferry
tall saffron
#

welp so you say i just upload it like this and hope for the best? lol

remote swallow
#

yeah

#

checking the api for latest version is giving me 1.0.1 atm

tall saffron
#

yeah mee too, but i putted as the plugin version 1.0.2 and it still sends the message for a new update

#

wait, can i pass the .jar for you if the update message appears to you?

orchid gazelle
#
                    } else if(line.contains("[main/INFO]: Connecting to ")) {
                        for(String domain : targetServers) {
                            if(line.split(" ")[4].replace(",", "").equalsIgnoreCase(domain)) {
                                onUC = true;
                                System.out.println("cnt");
                                System.out.println(line.split(" ")[0]); //why tf is this null?????
                                writer.write(format(line.split(" ")[0], Action.CONNECT, "Connected to Server ") + domain.split(".")[1] + domain.split(".")[2] + " \n");
                            } else {
                                onUC = false;
                            }
                            
                        }
                        if(!onUC) writer.write(format(line.split(" ")[0], Action.DISCONNECT, "Disconnected from Server" + " \n" ));
                    }

anybody having an idea why the hell the value is null(see comment)

#

I mean its not null, its " " or something lol

eternal oxide
#

correct

tender shard
#

dude I hast tocall 112 for overbosing on cklonaezepame

orchid gazelle
eternal oxide
#

its not null

orchid gazelle
#

well yes

#

but it should return a date lol

tender shard
#

they were extremely friendly, offered help, and stuff, they were not upset at all

eternal oxide
#

wthech is 112?

orchid gazelle
eternal oxide
#

some medical help line?

remote swallow
#

the german varient of 111 probably

eternal oxide
#

ah

tender shard
#

112 os nasoclly 911

orchid gazelle
#

112 in medical, 110 is police

eternal oxide
#

uk it's 999 or you can call 911

remote swallow
#

111 is the non emergancy number

eternal oxide
#

they added 911 becasae one group of people were too silly to know when in a different country your numbers many not work 🙂

tender shard
#

in germany 110 polisce. 112 = paremedics

eternal oxide
#

uk 999 is for police fire and ambulance service

tender shard
#

yeah uk it right

#

1 number = emergemcx

#

ing a

eternal oxide
#

a jumbled mess that you say is not null

orchid gazelle
#

that should give a context, what do you need?

tender shard
#

anyway tdo riendly prople shpwed up , measures my blood pressure and say "don't worry"

eternal oxide
#

you literally show us nothing

#

how many tabs you take and what strength?

orchid gazelle
#

thats the code where it prints " " for some reason, input string is a log-message in the pattern of: "[18:06:40] [main/INFO]: Connecting to [DOMAIN], 25565"

eternal oxide
#

then your string starts with a space

orchid gazelle
#

therefore the index 0 should return the date somehow

tender shard
#

I ocerdosedl on clonazepame

orchid gazelle
#

logs don't have spaces before the date, it must somehow do some garbage to the string

eternal oxide
#

you told it to split on space and your first element is either a space or empty. Your string starts with a space

orchid gazelle
#

thats very scuffed

eternal oxide
#

or it's an empty line 🙂

orchid gazelle
#

then the condition on this line: if(line.split(" ")[4].replace(",", "").equalsIgnoreCase(domain)) { would not trigger

#

if its empty, or if the first element is a space

eternal oxide
#

do a .length/size on [0]

orchid gazelle
#

aight

eternal oxide
#

it could have more than one element after it splits

orchid gazelle
#

gimme a hot minute it has gotta decompress 10 Gigs of Textfiles again

eternal oxide
#

but spaces will be removed if you split on space

#

so if the first char is a space your first element is going to be empty

kind hatch
eternal oxide
#

no always, if you split on space

orchid gazelle
#

cmon stupid CPU extract faster

#

uhm things are very very wrong rn

#

somehow my writer is doing shit

kind hatch
eternal oxide
#

yes

kind hatch
#

Meaning if there is content after the spaces, it will include them. Otherwise, it won't.

eternal oxide
#

the length 2 would be [0] = empty

#

AABB would be in [1]

#

trailing would be trimmed

#

I believe

kind hatch
#

It seems that is the case.

orchid gazelle
#

its still processing

#

I really gotta work on optimization once its working

#

uhmm lol

#
        at de.dafeist.unistats.UniStats.processLogs(UniStats.java:124)
        at de.dafeist.unistats.UniStats.main(UniStats.java:41)``` there we go
#

when printing, it shows it. When using it on the next line for the writer, it does not

#

wait, does line.split overwrite the existing string?

eternal oxide
#

no it returns a new string array

#

String are immutable

orchid gazelle
#

well then idk whats wrong

tall furnace
#

If you're splitting the entire line at the spaces, you should get an array with 6 elements, 0-5. Try printing the line, splitting to create an array, then printing the number of elements in the array right after.

orchid gazelle
#

wait nvm I think I found error 1

weak meteor
#

How it its called the player tag? (The name above the player entity)

wary mauve
#

Question from earlier.

This is what I want to accomplish:

  • Have a thousand randomly generated "MicroWorlds" (5x5 chunk areas) that can be copy and pasted into a void world.

Is this possible, specifically, the copy and paste part? Is it feasible to have the server do this a bunch? What would be the easiest way to accomplish this?

fallow latch
#
    public static void displayDamage(Entity victim, double damage, boolean crit) {
        Location loc = victim.getLocation();
        AreaEffectCloud display = (AreaEffectCloud) victim.getWorld().spawnEntity(
                new Location(...),
                EntityType.AREA_EFFECT_CLOUD
        );
        display.setParticle(Particle.BLOCK_CRACK, Material.AIR.createBlockData());
        display.setRadius(0);
        display.setRadiusOnUse(0);
        display.setDuration(DELETE_AFTER);
        display.setDurationOnUse(0);
        String nametag = COMMA_FORMAT.format(damage);
        display.setCustomName(nametag);
        display.setCustomNameVisible(true);
    }

im trying to use an invisible area effect cloud, but by setting the particle to air block crack it still sometimes spawn black particles. any way to fix?

sharp kayak
#

How do I display clickable links in chat?

echo basalt
#

components

sharp kayak
#

Tried using "TextComponents" but cannot display the message. It just gets displayed as [TextComponent{....}]

echo basalt
#

Show code

sharp kayak
#
TextComponent message = new TextComponent("Click here to view!");
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/viewchest " + p.getDisplayName()));

p.getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&a" + p.getDisplayName() + " &7has displayed their Ender Chest &3&l[&3" + message + "&3&l]&r"));
echo basalt
#

Yeah that won't work

#

YOu're concatenating the message object to your string

#

You gotta make it all a component

sharp kayak
#

should i convert it to a string?

echo basalt
#

And send a single component instead of sending a string

#

So like

#

TextComponent message = new TextComponent("this nerd is displaying their chest! ").append(clickableComponent).append(new TextComponent(" <- click this");

#

and send that entire component at once

sharp kayak
#

Oh

#

Lemme try

echo basalt
#

or use something like minimessage which does all the work for you

young knoll
#

Use the component builder for connecting a bunch of stuff

rough basin
#

How to detect player holding right click?

echo basalt
#

there's no easy way

#

the client sends an interact packet every 4 ticks

#

or 5 times per second

sharp kayak
echo basalt
#

Certain materials send more packets, like for shields and bows

echo basalt
#

I haven't used components in like 3 years

sharp kayak
#

"Lnet.md_5.bungee.api.chat.BaseComponent;@7872525" This is the text that is being displayed in place of the component

#

Btw i use p.getServer().broadcastMessage() to send the message

young knoll
#

getServer().spigot().broadcast

sharp kayak
#

The whole message is gonna have to be in the component?

young knoll
#

Yes

sharp kayak
tall saffron
#

Where can i learn the basics for plugin development and java, as i made 2 plugins but with lots of questions and strugles

echo basalt
#

?learnjava

undone axleBOT
tall saffron
#

Oh thanks

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
__**Admin:**__

selfrole Add or remove a selfrole from yourself.

__**Cleanup:**__

cleanup Base command for deleting messages.

__**Core:**__

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

__**Downloader:**__

findcog Find which cog a command comes from.

__**Mod:**__

names Show previous names and nicknames of a member.
userinfo Show information about a member.

__**ModLog:**__

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

__**Permissions:**__

permissions Command permission management tools.

tall saffron
#

?learnspigot

#

is there for plugin development

remote swallow
#

learning java is better to do first then the wiki can help

tall furnace
#

Is the method you want

tall saffron
weak meteor
#

idk whats the ticks for

#

or what they do

#

someone would like to explain me?

kind hatch
#

20 ticks = 1 second.

weak meteor
worldly ingot
#

Delay is the time (in ticks) until the task starts (say you want to wait 5 seconds before actually doing the first run) and the period is the time (in ticks) between each run

weak meteor
#

but

#

oh

#

thats why its lagging

worldly ingot
#

Yeah, it will wait half a second before running

weak meteor
#

i wanna check all players online inventory

#

how many ticks are ok for period?

#

im thinking about 10

worldly ingot
#

Up to you, honestly. 20 times/second is probably a bit much but it depends on what you want to do

#

Checking inventory, sure, but why?

weak meteor
#

Yeah, so if a player has a full armor of chainmail will apply x effects

#

and that way for other 4 diff types

worldly ingot
#

Then yeah, 10 or 20 ticks is probably fine

weak meteor
#

gotta try 10

#

still lagging

#

idk whats wrong

worldly ingot
#

Likely doing something crazy in your runnable

#

?paste and send here if possible

undone axleBOT
weak meteor
#

ye

#

maybe bc i have a thread.sleep

#

in the addeffects method

strange rain
#

How do I tell when any command was run from any plugin?

weak meteor
#

lemme try

worldly ingot
#

Yeah, a Thread#sleep() would definitely do that lol

weak meteor
worldly ingot
#

It will pause the main thread

strange rain
compact haven
#

yeah it's definitely because you have a Thread#sleep kekw

weak meteor
strange rain
#

So in theory

#

just onCommand in main class would execuate when any command is run?

compact haven
compact haven
weak meteor
worldly ingot
strange rain
compact haven
#

its not for every command

#

only commands from your plugin

weak meteor
#

its only you have getCommand in the onEnable method

strange rain
#

So is PlayerCommandPreprocessEvent the only way?

weak meteor
#

if you does not have it ig bukkit will not transmit that to the plugin

compact haven
#

@strange rain what in the world is your goal

#

I just joined chat and am not reading whole context, apologies for that

strange rain
#

I am making a small little plugin that lets you run a sound when you run a command

#

IDk

weak meteor
#

how to make infinite effects?

strange rain
#

Just for practice

weak meteor
strange rain
#

I got config and everything working beside the command

compact haven
#

@worldly ingot can you override the executor of a different plugin's command, then make the custom executor use the old executor?

weak meteor
strange rain
#

So what do I use?

worldly ingot
#

The constant is just the easy readability

remote swallow
#

For all commands you di

strange rain
compact haven
#

like does setExecutor require the invoker's class to be from the plugin that registered the command? and is there a getExecutor?

weak meteor
#

wrong link

remote swallow
#

If its another plugins command you need events

compact haven
#

are you positive?

strange rain
compact haven
#

if I find out that I can override the CommandExecutor I'll take a hack to you

#

and yes, that will definitely run CNK. you did something wrong if it didnt

remote swallow
weak meteor
strange rain
#
@EventHandler
    public void preprocessCommand(PlayerCommandPreprocessEvent e) {
        String cmdName = e.getMessage().split(" ")[0].replace("/","").toLowerCase();
        System.out.println("ADfkjlaslndgasdjg: "+cmdName);
        e.getPlayer().sendMessage(cmdName);
            String sound = getConfig().getString("default.sound");
            double pitch = getConfig().getDouble("default.pitch");

            if (getConfig().contains("specific."+cmdName.toLowerCase())) {
                sound = getConfig().getString("specific."+cmdName.toLowerCase()+".sound");
                pitch = getConfig().getDouble("specific."+cmdName.toLowerCase()+".pitch");
            }

            if (sound != "NONE") {
                try {
                    e.getPlayer().playSound(e.getPlayer().getEyeLocation(), Sound.valueOf(sound), 2f, (float) pitch);
                } catch(IllegalArgumentException l) {
                    l.printStackTrace();
                }
            }

I have listener implmented

weak meteor
#

Like do /meow and a meow sound reproduces

#

right?

strange rain
#

No

#

Like you could do /help from another plugin and it plays a sound

worldly ingot
#

Your != won't work ;p Can't compare strings like that

#

.equals()

strange rain
#

Still doesn't run

weak meteor
#

oh

worldly ingot
#

Just saving you a headache for later

weak meteor
#

misunderstand

strange rain
compact haven
#

there's too much nonsense

#

why is this not a forum channel Choco

remote swallow
#

And why do you tolowecase an already lowecase string

compact haven
#

it's called input processing

weak meteor
#

!!!!

strange rain
#

Just scrap

#

But it still should work

#

which it is not

compact haven
#

did you register it in the main class

remote swallow
compact haven
#

im sorry epic

worldly ingot
# compact haven why is this not a forum channel Choco

Because we have a forum on the website 😛 But you can open threads if you wanna. It's like a mini forum. Though in this case specifically there's nobody else asking questions that need to be taken to a more focused environment

strange rain
#

hjoSDfhiasjdfasd

#

Ty

compact haven
#

..? that is what I meant by my question earlier

#

but im glad u fixed that

remote swallow
#

Do you have any errors in console

compact haven
#

epic we just solved it

remote swallow
#

Oh

vocal cloud
#

Form bad. Long dialogue good

weak meteor
#

i think i got smth wrong

#

lol

worldly ingot
#

Which version?

weak meteor
#

1.19.2

#

gonna stay with -1

worldly ingot
#

That'd be why. Infinite potion effects were only added in 1.19.4

#

So you can just use Integer.MAX_VALUE instead

weak meteor
#

k

wet breach
#

Not everything can be done at once in just a single tick

#

Just some fyi

weak meteor
#

so

#

how would i do that

wet breach
#

You would use 2 tasks. The first one applies or unapplies and if the other is needed right after inside that task schedule a delayed task

weak meteor
#

okay

#

entiendo

#

i understand* sorry

#

lol

wet breach
hoary wing
#

Hello, how can I make the panel red?
this.setItem(new ItemStack(Material.STAINED_GLASS_PANE),49, LangConfig.Msg.InventoryItemRemoveBalloon.toString(), null);

weak meteor
#

oh, you talk spanish?

wet breach
#

Not really, just understand it enough though

weak meteor
#

that will apply the effects from getEffects() method in a loop

#

smth like

#

for (PotionEffect effect : kit.getEffects()){
new runnable(){
run
player#applyeffect(effect.gettype, -1, 3)}
Nao.getInstance, 120, 2;

#

or smth like that?

wet breach
#

Yes but it should be a task

#

I dont really have time to go over the layout. Maybe someone else here can. Currently at work uwu

weak meteor
#

okay

wary mauve
#

Question from earlier.

This is what I want to accomplish:

  • Have a thousand randomly generated "MicroWorlds" (5x5 chunk areas) that can be copy and pasted into a void world.

Is this possible, specifically, the copy and paste part? Is it feasible to have the server do this a bunch? What would be the easiest way to accomplish this?

strange rain
#

Am I doing something wrong or should this filter:

return Arrays.stream(completions.toArray()).map(String::valueOf).filter(
                s -> s.toLowerCase().startsWith(args[args.length-1].toLowerCase())).collect(Collectors.toList());
sullen marlin
#

Why are you converting to array only to stream

#

What are you even doing

#

StringUtils.copyPartialMatches

strange rain
#

It did not work

#

Btw

#

I got it working

#

Professional Newbie

wise mesa
#

kswapd0 is using 100% of my cpu

#

despite my memory only being halfway utilized

#

and I just doubled my swap file size

#

oops wrong channel

wary mauve
#

When world edit is copy and pasting large amounts of blocks, does it just take the block it copied and place the block in the new location, block by block? Is there an efficient and an inefficient way of doing that?

For clarity, I want to copy and paste chunks in the background while the server is running, so I'm looking to recreate what world edit does with copy and pasting, but with work distribution.

compact haven
#

i think i have this bookmarked

#

hold

wary mauve
#

Thank you! I'll look into this tomorrow

compact haven
#

however that program seems to not update lighting, as hinted by the todo list

#

I'd read the forum, albeit it's a tad old

#

then look at the posts, someone seemingly got it to work on new versions so

soft root
#

Jesus Is Amazing And He Loves You

wary mauve
#

Yeah the forum's 4 years old, but the github link is for 1.17-1.19

kind hatch
#

?workdistro can also be used.

restive mango
#

Anyone know what the sources of this error could be?

#
Caused by: java.lang.NoSuchMethodError: 'net.minecraft.world.level.block.state.BlockState net.minecraft.world.level.block.Block.stateById(int)'
#

The project builds in intellij, but that happens when I try to use net.minecraft.world.level.block.Block.stateById(5)

buoyant viper
#

mappings error

dreamy ridge
echo basalt
#

my first guess would be a packet

dreamy ridge
#

yeah i tried making it "die" and make it invisible but it didnt work

cobalt thorn
#

Hi, i didn't find any solution to this error and im thinking of suppresing the error because as a player you cannot see a difference
https://sourceb.in/NnNsKmUueP

java.lang.IllegalArgumentException: x not finite
    at org.bukkit.util.NumberConversions.checkFinite(NumberConversions.java:118) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.util.Vector.checkFinite(Vector.java:814) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity.setVelocity(CraftEntity.java:465) ~[purpur-1.19.2.jar:git-Purpur-1858]
    at net.rosamei.alixapi.animation.utils.MathUtils.corDir(MathUtils.java:13) ~[Plugin-1.0-SNAPSHOT.jar:?]
jagged monolith
#

It's somewhere in the setVelocity()

cobalt thorn
jagged monolith
#

You may not see a difference, but it may have performance issues later if left unchecked

cobalt thorn
#

how can i debug it, its just impossible

#

and some method are only on the location

jagged monolith
#

Double check the outputs from the math. It could be something is returning a 0, and then getting divided by 0 which can lead to that error

orchid gazelle
#

What about rounding the value of the vector?

cobalt thorn
#

and send it if one of the two send an error i will try round them

orchid gazelle
#

Okay

cobalt thorn
#

I found the problem, at the start of the animation the pitch and yaw are NaN how can fix that?

quaint mantle
#

How do I build this I click build and no plugin is made

#

I cant upload sses

jagged monolith
#

?img