#help-development

1 messages Ā· Page 2257 of 1

river oracle
#

Myes

tardy delta
#

charset broken

worldly ingot
#

PRs are always welcome šŸ‘€

#

You seem to be having fun with server internals lol

#

Inventories are notoriously messy

river oracle
#

Server internals are always fun

#

If I weren't under 18 maybe I'd start doing prs but when I get home I'll probably just fork and dig around fuck with some changes

tender shard
river oracle
tender shard
#

Does the CLA care about that?

#

Also why is everyone here underage lol

river oracle
#

Anyone under 18 in the US is not legally allowed to enter into a contract if any form without parental signing

tardy delta
#

lmao

worldly ingot
#

I believe that applies only to NDA

#

CLA should be fine

river oracle
#

Applies to any contract iirc

tender shard
#

Everyone here is so extremely young that I start worrying about what I say here lol

worldly ingot
#

There are generally specific clauses in the contract that states you require parental co-signatures

river oracle
#

Bruh im not 5 lmao

tardy delta
#

11

tender shard
river oracle
#

Holy shit if I could code this well at 6 I'd be so crazy good now

#

I'd be likely producing less shit code then I am now

worldly ingot
#

Ah, Spigot CLA does say parent signature if < 18

If You are less than eighteen years old, please have Your parents or guardian sign the Agreement

#

mbmb

#

Not all contracts have that clause

river oracle
#

No contributions from me for the next 2 years. Not like I have anything to contribute then my shitty code

tender shard
#

It probably depends on the countryā€˜s laws too. In germany you can sign contracts with 8, or 13 if its not a ā€žthis is only good for youā€œ contract. No idea on how to explain it in english lol

worldly ingot
#

Right, unless the contract says otherwise heh

old cloud
#

Hi, does someone know how the server tells the client to not e.g. take an item out of an inventory if the client clicks on a slot in an inventory?

river oracle
#

Nah but you could dig around the stash

#

?stash

undone axleBOT
river oracle
#

Check inventory click event implementation

old cloud
#

Could not find anything packet related in the stash yet, maybe im blind tho

river oracle
#

You need to go to implementation

visual tide
#

and its 7 or 14 iirc

tardy delta
#

how do i tell the stupid compiler that it wont be null lol

visual tide
#

make it final

#

and set in constructor

tender shard
#

Supressions

tardy delta
#

i cant

visual tide
#

surpress or Objects#requireNotnull

tender shard
#

Just do @SupressUntrueWarnings

tardy delta
#

ah wait java logic

#

ĀÆ_(惄)_/ĀÆ

quiet ice
#

Don't ask how I know

visual tide
#

c: i clicked this item
s: shit u put that back right this second

worldly ingot
#

Basically

subtle folio
#

i hate rust

#
fn i_do_not_like_snake_case() -> bool {
  true
}```
worldly ingot
#

Yo me too!

tardy delta
#

the only thing i hate is that you dont need ;

subtle folio
#

only for returns and other little things

#

most of the time u do lol

tender shard
tardy delta
#

u dont even need commas for switch branches

tardy delta
#

more stuff but i forgot

subtle folio
#

structs

#

šŸ˜

#
struct Rectangle {
    width: u32,
    height: u32,
}

impl Rectangle {
    fn square(size: u32) -> Rectangle {
        Rectangle {
            width: size,
            height: size,
        }
    }
    fn area(&self) -> u32 {
        self.width * self.height
    }
    fn can_hold(&self, rect2: Rectangle) -> bool {
        self.width > rect2.width && self.height > rect2.height
    }
}``` good code no cap
tardy delta
#
unsafe impl Rectangle for u32 {

}```kekw
subtle folio
#

lmfaoo

#

rectange

quiet ice
# tender shard Hm no

Yes, hence you are Not allowed to use discord in Germany If you are 15 or younger. Most disregard that, but that is the case

tardy delta
#

hehe i see youre following the guide thing

subtle folio
#

its very nice

quiet ice
#

You have a tough time registering for anything on the net If you are blow 16

tardy delta
#

the end thing is very nice

subtle folio
#

reading one chapter a day

tardy delta
#

multithreaded webserver lol

subtle folio
#

i saw a snak peack by accident

#

yeah

#

im very excited

#

didnt understand any of the code

#

so i jumped back to chpater 5

#

lmfao

tardy delta
#

i kinda stopped learning lmao

#

doing java now

subtle folio
#

imajin is making me

#

im profficient enough in java

crude loom
#

How do I remove tab completion from specific commands?

hushed pawn
#

How can i calculate Velocity in the same way as server does?

maiden briar
#

serverSocket.accept() does not return any Socket object, but calling new Socket(ip, port) on the client works fine. I can even send data to the client's outputstream. But on the server (BungeeCord) I never got any socket object from serverSocket.accept() so I cannot send / receive data. This method is running in a different thread. Waiting for connections... is printed

hushed pawn
#

I mean Velocity that applied to player when it gets hit

#

It didn't make sense what this thing return

#

Actually maybe it is, but it didn't help me anyway

fleet comet
#

its not very accurate i don't think

fleet comet
quartz basalt
#

how can i detect when a falling block turns into a regular block

quartz basalt
#

i did...

fleet comet
#

already found somethin

hushed pawn
worldly ingot
#

Oh it's FormBlockEvent

#

I was close :((

#

Read further down the thread. I'm right. Change block event

fleet comet
hushed pawn
fleet comet
#

and also push them a bit up cause of that w-tap

hushed pawn
fleet comet
hushed pawn
#

It should be pvp bot that standing still and hits players nearby

fleet comet
quartz basalt
#

how can i get the vector i need to get a fallingblock to go to a 2nd point from a 1st one kinda hard to explain but i have 2 entities one 5 blocks above the other and i want the falling block to spawn at the 1st entity (which i have) and i need it to have a velocity to go to the 2nd one i have fb.setVelocity(targetLocation.toVector().normalize().subtract(startingLocation.toVector().normalize())); but the blocks just fall

fleet comet
#

ive been here so long to ask 1 question lol

eternal oxide
#

you need to magnify the velocity its a unit length of 1 so its small/

tardy delta
#

thats what she--

eternal oxide
#
fb.setVelocity(targetLocation.toVector().subtract(startingLocation.toVector()).normalize().multiply (5));```
quartz basalt
#

ah thanks

pliant oyster
#

Which packets should I use to give a player a custom nametag

#

I cannot find the ones I want with protocol website

tardy delta
#

is it better for a vanish plugin to hide myself for all players or only for the players on the current world and listen for worldchange and do stuff?

fleet comet
#
public final class Cloud extends JavaPlugin {

    @Override
    public void onEnable() {
        Path addonPath = Paths.get(getDataFolder().toString() + "/addons");
        File dir = new File(addonPath.toString());
        if (!dir.exists()) {
            dir.mkdir();
        }
        Bukkit.getLogger().info(addonPath.toString());
        File[] listOfFiles = dir.listFiles();

        for (File file : listOfFiles) {
            if (file.isFile()) {
                getCall(file);
            }
        }
        // Plugin startup logic
        saveDefaultConfig();

    }

    public void getCall(File theJar) {
        try {

            URLClassLoader loader = new URLClassLoader(new URL[] { theJar.toURI().toURL() },
                    Cloud.class.getClassLoader());

            Class classToLoad = Class.forName("newJar.org.cloud.addons.test", true, loader);
            System.out.println(classToLoad);
            Method method = classToLoad.getDeclaredMethod("test");
            Object instance = classToLoad.newInstance();
            Object result = method.invoke(instance);

        } catch (MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException
                 | InstantiationException | IllegalAccessException | IllegalArgumentException
                 | InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}``` Okay so I'm trying to access a jar in my addons folder and I'm getting this error
``` java.lang.ClassNotFoundException: newJar.org.cloud.addons.test ```
#

Here's the jar class its trying to access

package org.cloud.addons.test;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class Test extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic

    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }

    public void test() {
        System.out.print("test");
    }
}
#

Also as and extra, how would i do the same, like allow the jar im accessing to access my api and keep its classes and methods saved

tardy delta
#

why not getting the plugin via the pluginmanager and calling ::getClass?

#

anyways is calling == on world objects fine?

fleet comet
tardy delta
#

lol

hushed pawn
limpid bronze
#

Hey, I'm doing player.breakBlock(block) but the breaking sound is not played, how can I add a breaking sound depending on the block breaked?

pliant oyster
#

Which packets should I use to give a player a custom nametag
I cannot find the ones I want with protocol website

fleet comet
#

can u be patient /

pliant oyster
#

not rlly

fleet comet
fleet comet
tardy delta
#

wdym register

#

spigot wont load it by default

fleet comet
#

or if i cant how would i approach this?

tardy delta
#

well uhh ive never done that

#

what are you trying to do anyways

lost wolf
#

Is there something like a EntityTick event or how do we evaluate code around a specific entity on an ingame tick?

fleet comet
tardy delta
#

i wouldnt let those minigames come in their own jar

sterile rune
#

hi

fleet comet
#

so other creators can make addons

lost wolf
earnest forum
#

thats what hes doing

tardy delta
#

i'd say just make an api and let those minigames be.. ah got ninjad

earnest forum
#

...

#

"huge api"

fleet comet
paper viper
#

He is probably referring to the plugins being loaded by the parent plugin, but it uses the api of the parent

#

How do I explain this

tardy delta
#

let the addons be separate plugins which are either free or not free

#

which use the api that the core plugin provides

subtle folio
#

like a lib for mini games

lost wolf
#

So you want to specifically have the addons being loaded form a different folder other than plugins?

fleet comet
paper viper
#

Good luck handling that yourself

#

You will run into an array of issues

#

Lol

tardy delta
#

an array lol

paper viper
#

You are basically making plugman but even worse

tardy delta
#

english was difficult at that moment

paper viper
#

1st one

lost wolf
tardy delta
#

i dont understand why dont just enable those addons when they are in the plugins folder

#

you will run into a linkeshashset of issues

#

@paper viper šŸ™‰

paper viper
#

Lol

tardy delta
#

does that even exist idk

fleet comet
paper viper
#

So you are going to ignore us…

tardy delta
#

what error lol

limpid bronze
#

Hey, I'm doing player.breakBlock(block) but the breaking sound is not played, how can I add a breaking sound depending on the block breaked?

fleet comet
paper viper
#

I mean we aren’t the type of people to rlly lead you the wrong direction

fleet comet
paper viper
#

Maybe you could just let spigot do the loading

#

And you don’t have to do anything

tardy delta
#

with the pluginclassloader ye lol

fleet comet
#

what about the loadPlugin method?

paper viper
#

You don’t need that…

#

The mini game can be it’s own plugin

quartz basalt
paper viper
#

And use your API

tardy delta
fleet comet
#

also i can delete it more easily if i have too

paper viper
#

Look at WE

#

Or ProtocolApi

#

Does it have an addons folder?

#

Or even go further and look at mods

#

Mods have libraries and they are loaded separately

#

Don’t add unnecessary work for yourself

sterile rune
#

what is the best way to detect when a player puts an item from their inventory into another?

modest garnet
#

not sure but if u just set the potion effect again it should woprk

#

work

tardy delta
#

eyoo is it safe to compare world objects with ==?

earnest forum
#

probably

tardy delta
#

as they come from Bukkit.getWorld

paper viper
#

Unless they get unloaded and loaded again or something

dawn plover
#

i have a custom command /giveObject
if i do /giveObject player1 how would i make it that the command runs on player1 and not on the sender

dawn plover
#

(i tried looking at the spigot wiki, but wasnt much what i could find)

#

ohoho, so all the things you need to create out of nowhere, they are in the class Bukkit

ashen quest
dawn plover
#

thnx, this helped me more then only this thing XD

#

thnx

limpid bronze
#

Hey, I use player.breakBlock(block) but the breaking sound is not played, how can I add a breaking sound depending on the block breaked?

ashen quest
#

ty

ashen quest
worldly ingot
#

o.O Player#breakBlock() should 100% play the sound

#

It literally just forces the player to break the block

#

I use it for vein miner and there's sound iirc

ashen quest
#

so you are the person who made Vein Miner?

paper viper
#

Yeah he made it

ashen quest
worldly ingot
#

You can do block.getBlockData().getSoundGroup().getBreakSound() if you'd like and just play that to the player if you're not getting anything

#

but I'm certain it should play it

ashen quest
#

might be smth with the client?

limpid bronze
worldly ingot
#

I was certain it did. Maybe I'm wrong

#

but yeah, those are the methods you want. getBreakSound() returns you a Sound, you can just World#playSound() that

limpid bronze
#

Not Player#playSound() ?

paper viper
#

Player plays it for that player

worldly ingot
#

Well, World#playSound() will broadcast it to all nearby players, much like what would happen if a player broke a block normally

#

If you want it to be sent just to that one player, then the one from the Player interface is fine

limpid bronze
#

Oh thanks I will do World#playSound() in my case

#

But little problem, the sound played when you break a block of dirt is the sound played when you break an iron block

paper viper
#

Wot

worldly ingot
#

From getBreakSound()? You're doing this before you actually break the block, yeah?

#

If you do it after, the default sound may be stone (which iron uses iirc)

limpid bronze
#

Oh... I'm dumb you're right

worldly ingot
#

(you can use the SoundGroup#getPitch() and #getVolume() too by the way)

limpid bronze
#

Nice I will do that too

modest garnet
#

why cant i get entity health

earnest forum
#

.getH is not a method

ivory sleet
#

Make sure it’s a living entity just

modest garnet
quartz basalt
modest garnet
ivory sleet
#

Uh instance of + cast

#

Or well

#

Since you check that it’s a player

fleet comet
#

Why doesn't this work?

ivory sleet
#

check instanceof Player and then cast and use the casted object to get the health

fleet comet
#

@tardy deltayou were right about the errors lol

tardy delta
#

what errors

#

i didnt say anything

fleet comet
#

i got one

#

and i have NO IDEA WHAT IT MEANS

ivory sleet
#

What did it say to begin with? lol

tardy delta
fleet comet
ivory sleet
#

The `error`

fleet comet
#

here

public final class Cloud extends JavaPlugin {

    public List<Plugin> addons = new ArrayList<>();

    @Override
    public void onEnable() {
        Path addonPath = Paths.get(getDataFolder().toString() + "/addons");
        File dir = new File(addonPath.toString());
        if (!dir.exists()) {
            dir.mkdir();
        }
        Bukkit.getLogger().info(addonPath.toString());
        File[] listOfFiles = dir.listFiles();

        for (File file : listOfFiles) {
            if (file.isFile()) {
                try {
                    Plugin addon = getPluginLoader().loadPlugin(file);
                    addons.add(addon);
                    getPluginLoader().enablePlugin(addon);
                } catch (InvalidPluginException e) {
                    throw new RuntimeException(e);
                }
            }
        }
        // Plugin startup logic
        saveDefaultConfig();

    }



    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
package org.cloud.addons.test;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class Test extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic
        getCommand("test").setExecutor(new TestCommand());
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
``` addon code. and it cannot invoke getCommand becuase it returns null
ivory sleet
#

Looks kinda fun tho

fleet comet
#

thats my code and error

#

@ivory sleet

tardy delta
#

well the command handling is less pain now when using acf

ivory sleet
#

JadeStudios you did not declare the command in your plugin.yml

ivory sleet
#

Well rebuild

#

And redeploy the new jar

tardy delta
#

hehehe

ivory sleet
#

And try again :3

fleet comet
ivory sleet
#

Oh well you’d have to maybe inject bytecode

fleet comet
#

@ivory sleetshould i mention that the plugin im loading is inside a folder called addons inside the plugin cloud's config folder? but same error

ivory sleet
#

Or other crazy stuff in case you wanna run it on another jvm instance

#

Wait

#

Ugh

#

The Plugin api is not meant to be implemented this way Jade I’m afraid

fleet comet
#

then whats the loadPlugin method for?

ivory sleet
#

That is for enabling or disabling actual plugins

fleet comet
ivory sleet
#

Why is it not in the plugins folder

#

I’m very confused

fleet comet
ivory sleet
#

if it’s an add-on system don’t use the plugin api spigot has

#

Extend ur own url class loader or sth

ivory sleet
#

I believe placeholder api and luckperms are good examples for you in this case

fleet comet
ivory sleet
#

It is a bit hard

#

What exactly were you not able to access a

#

Apart from the command

chrome beacon
#

Or add extra height

quartz basalt
#

its not enabled if i have it enabled it sends the block to space

#

and when the armorstands are abvoe each other it works fine so adding extra height would mess that up

paper viper
fleet comet
# ivory sleet What exactly were you not able to access a
 try {

     URLClassLoader loader = new URLClassLoader(new URL[] { myJar.toURI().toURL() },
             CustomClass.class.getClass().getClassLoader());

     Class classToLoad = Class.forName("newJar.org.cloud.addons.test", true, loader);
     System.out.println(classToLoad);
     Method method = classToLoad.getDeclaredMethod("test");
     Object instance = classToLoad.newInstance();
     Object result = method.invoke(instance);

 } catch (MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException
         | InstantiationException | IllegalAccessException | IllegalArgumentException
         | InvocationTargetException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
 }
``` this was the code i was using
paper viper
#

Guess someone didn’t take my advice

#

Lol

fleet comet
#

gimme a sec to replicate the error

tardy delta
chrome beacon
#

Which command api is that

tardy delta
#

acf

snow stratus
#

Anyone know of a website that shows 1.19 Mojang mappings?

paper viper
#

Screaming mappings

fleet comet
#

@ivory sleet```java
package org.cloud.addons.test;

public class Test {

public void test() {
    System.out.print("test");
}

}

#
@Override
    public void onEnable() {
        Path addonPath = Paths.get(getDataFolder().toString() + "/addons");
        File dir = new File(addonPath.toString());
        if (!dir.exists()) {
            dir.mkdir();
        }
        Bukkit.getLogger().info(addonPath.toString());
        File[] listOfFiles = dir.listFiles();

        for (File file : listOfFiles) {
            if (file.isFile()) {
                getCall(file);
            }
        }
        // Plugin startup logic
        saveDefaultConfig();

    }



    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }


    public void getCall(File jar) {
        try {

            URLClassLoader loader = new URLClassLoader(new URL[] { jar.toURI().toURL() },
                    Cloud.class.getClass().getClassLoader());

            Class classToLoad = Class.forName("jar.org.cloud.addons.test", true, loader);
            System.out.println(classToLoad);
            Method method = classToLoad.getDeclaredMethod("test");
            Object instance = classToLoad.newInstance();
            Object result = method.invoke(instance);

        } catch (MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException
                 | InstantiationException | IllegalAccessException | IllegalArgumentException
                 | InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }``` main class thing
fleet comet
#

@ivory sleetand i get classnotfound

chrome beacon
#

Just use the plugins folder

paper viper
#

Just create an API and make the mini games their own separate plugins that use the API

#

Man

fleet comet
#

if i was making a good api i would do that

paper viper
#

And?

fleet comet
#

but im not, im trying to learn how to do that stuff

paper viper
#

You are still going to have to use the core API either way

fleet comet
#

not true

paper viper
#

If that wasn’t true, then what would be the point of your mini game plugin….

fleet comet
#

cause its a plugin that loads the minigames

#

without multiple plugins

paper viper
#

I’m just saying that you can avoid the error and save a load of time

fleet comet
paper viper
#

I’m not yelling at you, I’m just trying to give you advice that will help you and you are refusing to listen.

fleet comet
#

because thats not what im trying to do

paper viper
#

Because your problem is an XY problem

fleet comet
#

?

paper viper
#

Ugh whatever

tardy delta
#

?xy

undone axleBOT
tardy delta
#

i better had commented my old code smh 🄺

fleet comet
#

idk why the error is appearing tho

fleet comet
#

@tardy delta ```java
org/cloud/addons/Main has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0

hoary knoll
#

does getWorlds.get(0) always return the overworld?

paper viper
#

Stop pinging people smh

paper viper
hoary knoll
#

but what if its not called world in server properties

#

?

paper viper
#

Hm yeah true

#

One second

flint coyote
#

You can set another compile version in maven

tardy delta
#

what java version does the spigot jar runs on by default? latest?

#

just wondering

frosty tinsel
fleet comet
#

OKAY so i accessed the jar, i can run stuff on it now, but how the hell should i run spigot stuff on it????

tardy delta
#

so it will take java17 in like mc1.18

fleet comet
#

it takes java 17 in mc 1.10 too

fleet comet
# frosty tinsel Elaborate?

okay so this is my main class```java
package org.eternitystudios.plugins.cloud;
public final class Cloud extends JavaPlugin {

@Override
public void onEnable() {
    Path addonPath = Paths.get(getDataFolder().toString() + "/addons");
    File dir = new File(addonPath.toString());
    if (!dir.exists()) {
        dir.mkdir();
    }
    Bukkit.getLogger().info(addonPath.toString());
    File[] listOfFiles = dir.listFiles();

    for (File file : listOfFiles) {
        if (file.isFile()) {
            getCall(file);
        }
    }
    // Plugin startup logic
    saveDefaultConfig();

}



@Override
public void onDisable() {
    // Plugin shutdown logic
}


public void getCall(File jar) {
    try {

        URLClassLoader loader = new URLClassLoader(new URL[] { jar.toURI().toURL() },
                Cloud.class.getClass().getClassLoader());

        Class classToLoad = Class.forName("org.cloud.addons.Main", true, loader);
        System.out.println(classToLoad);
        Method method = classToLoad.getDeclaredMethod("test");
        Object instance = classToLoad.newInstance();
        Object result = method.invoke(instance);

    } catch (MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException
             | InstantiationException | IllegalAccessException | IllegalArgumentException
             | InvocationTargetException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

}

frosty tinsel
fleet comet
#
package org.cloud.addons;

public class Main {
    public void test() {
        System.out.print("test");
    }
}
``` heres the addon. it accessed it
#

the addon jar is located in the config folder of the main plugin

#

and i want it to access that and run something back on the server but from the code thats on the addon

flint coyote
#

why are you doing that via reflection? o.o

fleet comet
fleet comet
flint coyote
#

So you package the addon inside your jar?

fleet comet
#

the folder is like this:
plugins:
Cloud.jar
cloud:
addons:
addon.jar
config.yml

fleet comet
flint coyote
#

that won't work then

#

It has to be loaded

#

so either another plugin or compiled inside your own

tardy delta
#

why not just letting those addons be loaded thro the plugins folder šŸ¤”

iron glade
#

Is there a way to disguise a player as another player? Like when using commands and stuff it would think that it's the other player executing it?

tardy delta
#

as your core plugin provides an api

fleet comet
flint coyote
#

Why not just let the addons be different plugins?

Those plugins could then implement an interface that you create in your core and deliver the instance via an api that you provide in your core

tardy delta
#

thats whar we are telling the whole time now

flint coyote
#

So basically they would "register" and then go idle/can be disabled

#

idk I didn't follow the whole convo xD

lost wolf
#

What is better for performance?

fleet comet
#

@flint coyotei really want u to reload just those addons those without restarting the server

#

so u can add more easily

paper viper
flint coyote
#

You can add spigot plugins during runtime (like /reload does) but there isn't an easy way to do it.

Changes to plugins during uptime isn't intended since it can lead to unenjoyable sideeffects

flint coyote
paper viper
#

Lol

flint coyote
flint coyote
#

I just told you o.o

paper viper
#

By following our advice

#

Lol

fleet comet
#

oh yeah api

#

wait @flint coyote can i still load plugins normally even if they arent in the plugin folder

paper viper
#

Why would you??

#

You just let Spigot handle it

tardy delta
#

im gettin braindamage of this conversation šŸ”„

fleet comet
#

im just curious

flint coyote
#

Obviously you can but it will just be a lot of "hacks" around spigot that might break every update

dim palm
#

:xd:

flint coyote
#

There's a reason that while running a 0 downtime web-application you provide multiple instances. Applications are not made for code base changes during runtime

tardy delta
#

oh uhh

fleet comet
#

but in a different folder then the pl folder

paper viper
#

No just

chrome beacon
#

Just leave things in the plugins folder

paper viper
#

Just make it the same folder

#

Yeah

#

And make depend attribute in plugin.yml handle loading

flint coyote
#

You can take spigots code and replicate the plugin loading. But that's unnecessary work. Please just take the way we provided. That's the common way of doing it.

tardy delta
#

anyone experience with acf and knows if i can do stuff like
void onAction(Player sender, String action) but with knowing the action at compiletime, so i can write different methods for each action instead of having to use a swwitch?

fleet comet
#

im sry i like making things overlay complicated

tardy delta
#

acf docs kinda suck

paper viper
ivory sleet
#

Why not use a class to represent actions?

#

Then you can add a mapper or whatever it’s called in ACF

tardy delta
#

then i would have to parse those and still handle stuff differnently on each case :/

fleet comet
#

wait are they any resources for plugin api's

flint coyote
#

wdym?

fleet comet
#

nvm

#

found one

ivory sleet
#

I mean fourteen register a context

tardy delta
#

lemme take a look at the docs for that

#

stuff kinda confuses me

flint coyote
fleet comet
#

how do i access that api from another plugin

ivory sleet
#

And well, if the argument is invalid just throw InvalidCommandArgument or whatever ACF calls it

paper viper
#

Or you could use a repository manager

flint coyote
#

You use the core plugin as a dependency. Basically just as you are using spigot right now

ivory sleet
#

It’s just not beginner friendly

#

But it becomes essential for independent redeployment

crimson terrace
tardy delta
#

conclure could you explain a bit more on how to handle those different actions, i have a commandcontext then which represents the actions, what then?

#

handling them internally in the action or smth?

ivory sleet
#

Wait can you show me the initial code? With the switches that is

crimson terrace
#

yeah, ive looked at the di page from the command a couple times. maybe i gotta watch a few youtube videos

ivory sleet
#

Oh well isn’t that just passing objects to functions?

tardy delta
#

or well doesnt @SubCommand("action") work for such purposes

vanish enable
vanish disable
etc```
ivory sleet
#

(To simplify)

crimson terrace
#

I shall elaborate

ivory sleet
#

I shall listen then

ivory sleet
#

If the sub commands are literals

#

And not arguments

iron glade
#
``` does this work in online mode or would it like kick the target player?
tardy delta
ivory sleet
#

/eco <add|remove> <player> <amount>

tardy delta
#

subcommands vs arguments that you pass in (for example player name) or smth?

crimson terrace
#

The plugin instance is supposed to be non static, correct?
That means I would have to have an instance of the plugin to get an instance of the plugin?
I dont know how to get the instance for getting the config file for example in the same plugin and in the dependencies

ivory sleet
#

Here add and remove are literals/real sub commands

#

<player> and <amount> are arguments

tardy delta
#

ah ye then i understand

undone axleBOT
ivory sleet
#

That’s the way mojang handles it also btw

tardy delta
#

makes sense

ivory sleet
#

Yeah Shreb instances can’t be static

#

Well

#

Most systems do it like this

#

They use reflection, method handles or unsafe to instantiate an instance of a/the main class of an addon

#

Which spigot for instance does

tardy delta
#

bruhh i was such an idiot when i wrote this code

crimson terrace
#

would it be possible to make a dependent plugin by getting the instance of the dependency via Bukkit#getPluginManager()#getPlugin(), casting it and doing whatever? or would that not get the actual instance of the plugin?

tardy delta
#

it works

#

i've seen it before for like getting the worldguard instancce

crimson terrace
#

ok, thats easier to understand for me

tardy delta
#

switch on its best

agile anvil
agile anvil
crimson terrace
manic bison
#
ItemStack it = new itemstack(material)

hello, how would I check if a player has this itemstack in inventory of any amount greater than 1?

tardy delta
#

im always trying to use a rust switch

#

but im in java ĀÆ_(惄)_/ĀÆ

tardy delta
#

is a playerquit event fired when the whole server crashes and all players are kicked?

eternal oxide
#

no

worldly ingot
eternal oxide
#

crashed server send no packets

tardy delta
#

ah f*

ivory sleet
#

Some players might be disconnected before the server explodes

tardy delta
#

ok switches make code so unreadable

#

šŸ˜‚

eternal oxide
#

only when you lambda them

tardy delta
#

šŸ‘‰šŸ‘ˆ

eternal oxide
#
case 1:
case 2:
  blah...
  break;```
#

cleaner

tardy delta
#

mwoa

#

me doing unnecessary stuff again..

iron glade
#
   p.getPlayerProfile().update();```
Any idea why this isn't doing anything?
opal wedge
#

Does anyone here have any idea why .getCenter() returns an empty location (location{world=null,x=0.0,y=0.0,z=0.0,pitch=0.0,yaw=0.0})?

flint coyote
#

maybe it returns 0 0 0 when null?

#

ah nvm

#

forgot the null check^^

tardy delta
#

i want to be sure that this is correct

flint coyote
#

wait isn't the worldborder center 0 0 0 by default?

humble tulip
#

Maybe the world border is world independent

flint coyote
#

So unless you set another center for that player it will be 0 0 0

opal wedge
#

Its set to a location, the wb exists, for this player.

flint coyote
#

and it's the only one online?

opal wedge
#

yes

quaint mantle
#

is there any plugins that does a thing like

#

credits to a buycraft giftcard

tardy delta
#

getting a random player?

#

use Player randomPlayer = Bukkit.getOnlinePlayers().iterator().next() instead

flint coyote
# opal wedge

can you print the worldborder size? is that correct?

tardy delta
#

streams are expensive

opal wedge
worldly ingot
#

I'd advise use of Iterables instead

#

Iterables.get(Bukkit.getOnlinePlayers(), generateARandomNumberHere)

flint coyote
#

and the worldborder is not set to at 0?

high rapids
#

Anyone know bedrock coding?

tardy delta
#

oh never heard of that method

opal wedge
humble tulip
flint coyote
#

I'm confused because you check that the border is not null. I would expect a null border to return exactly that

#

but then again it's a method of border so you would get a npe

high rapids
#

Anyone know how to create custom hud in bedrock edition?

flint coyote
#

because at this point it's either a bug in spigot or you have old code runningšŸ¤”

quaint mantle
humble tulip
quaint mantle
#

ehh. a bit

#

but the tebex documentation isnt really

#

clear

humble tulip
#

Use the credits plugin api and subtract credits

#

Use the buycraft api generate coupon

flint coyote
#

Check the values of border directly and follow your code until it shows weird values. Then run it again and step into the method that returned weird stuff and rinse repeat

opal wedge
#

I think the following is causing the error:

When the player joined, I set the WB #1 for the player. When the player updates the WB for himself, I think Spigot saves the reference to WB #1 and does not return the current value.

flint coyote
#

doesn't /worldborder center set it for everyone?

opal wedge
#

Yeah

flint coyote
#

so it overrides the players worldborder

opal wedge
#

On clientside, yes

flint coyote
#

why only clientside?

tardy delta
#

300 lines for a vanish command smh

ivory sleet
#

Myes

tardy delta
ivory sleet
#

I’m proud of you actually

mortal hare
#

This is spigot dev channel

#

not forge or fabric

tardy delta
#

ty cutie

mortal hare
#

we dont code clientside mods here

ivory sleet
mortal hare
#

but I know one mod who can do this

chrome beacon
#

I assume they're making some cheats or smth or else they would ask in the right place

mortal hare
#

Fabric Hider mod

#

does exactly what you need

quartz basalt
#

fb.setVelocity(targetLocation.getLocation().toVector().subtract(baseLocation.getLocation().toVector()).normalize());
targetlocation is the location the blocks should be going to and baselocation is the location the blocks spawn at, both the locations are taken from the position of these armorstands in this picture
https://cdn.discordapp.com/attachments/829796363188830218/993893604181418025/unknown.png
the bottom one is the base top is target, the green arrow is what the falling blocks are doing and the red arrow is where they should be going, x and z works fine but the y axis doesnt go any higher then in the pic which doesnt really make sense

mortal hare
#

I have vanilla optimized modpack but whenever I join specific servers i get kicked out for using fabric

#

oh boy, Fabric modloader is 1.14+

chrome beacon
#

Why hide it

#

Because Lunar gives an unfair advantage

#

Use Vanilla

#

So you want to cheat

mortal hare
# chrome beacon Why hide it

I use it because I have sodium enriched vanilla modpack which allows me to boost fps and some servers just block fabric or forge completely without even checking modlists so I use this to bypass this

chrome beacon
#

How nice of you

mortal hare
#

its not as If I am using it for cheats

flint coyote
opal wedge
mortal hare
tardy delta
#

its modproof

mortal hare
#

this modlist allows me to get 400-600 fps

chrome beacon
#

Lunar has a history of making pvp smoother by making changes that are unfair and thus are hacks

rocky bolt
#

its not about adventage i just want to use smooth client

paper viper
#

I thought

chrome beacon
#

If the owner tells you not to use Lunar don't use it

#

It's that simple

rocky bolt
#

but there is batmod and other clients and their client brand is vanilla

mortal hare
#

OMG I FOUND THIS TRACK

#

NOSTALGIA

#

2011

tardy delta
#

ooh that stuff

flint coyote
paper viper
#

Like 99% sure that’s the case now

#

I remember coding a plugin and using hidePlayer for vanish and my friend couldn’t even see me on tab list

#

Lol

slim brook
#

Hello, someone know how get instance of a ItemStack ?

paper viper
#

new ItemStack(Material.SOMETHING)

#

Like that?

#

Or something

slim brook
#

Yeah

#

I wand get the instance of my item for a cooldown system

idle vessel
#

Hallo

flint coyote
idle vessel
#

So i tried to report timings but i am not on pc

slim brook
idle vessel
#

And the link can’t take me anywhere can i be helped

slim brook
#

I already create instance i want get the instance

idle vessel
#

Because my server is lagging badly

paper viper
#

This is coding

chrome beacon
#

^

#

Also send the link

slim brook
paper viper
#

What’s your goal here

#

Cooldowns for items?

slim brook
#

Yup

idle vessel
#

Hello

paper viper
#

I’d recommend to have some sort of identifier on the item instead

#

Of using the actual ItemStack

quaint mantle
#

a beam with shooting

paper viper
#

Anyways

mortal hare
#

well you can use itemstack

slim brook
#

How i get the identifier ?

paper viper
#

Is grabbing from the map not working?

mortal hare
#

as a key

#

what's wrong with that

#

its not being copied

#

afaik

paper viper
quaint mantle
#

i am not that familiar with the api 😠

slim brook
paper viper
#

Wdym?

idle vessel
#

Thanks olivo, but the attention is being called to how can i get Timings results from a link I can’t click

mortal hare
#

NMS itemstacks are being copied when moved inside another slots but bukkit objects arent afaik

humble tulip
#

then u have the offset

quaint mantle
slim brook
paper viper
#

I don’t understand your issue

slim brook
#

Ok

#

When i "use" my item

humble tulip
#

and u have new points for ur line

quaint mantle
#

Show me

#

the code

ancient plank
#

spigot has a raycast api that's pretty simple to use

chrome beacon
humble tulip
#

?spoonfeed

slim brook
#

The cooldown work but for all item from the server on not only with the item i have in my hand

humble tulip
#

lol one sec

quaint mantle
#

i deleted the code]

#

take my word

slim brook
#

for exmple if i have to same item. I use item 1 but the item 2 is in cooldown too

#

w

paper viper
#

Oh so for like

#

The same items?

slim brook
#

Only for one item

chrome beacon
#

?pdc

paper viper
#

Yeah I was about to say

#

You should use an identifier instead

idle vessel
slim brook
#

I'm in 1.8 😬

flint coyote
paper viper
#
  1. Update
  2. NBTApi… I guess
chrome beacon
#

Get used to that

slim brook
humble tulip
# quaint mantle I got an idea
    private void drawLine(Location l1, Location l2, int subSegments) {
        Vector offset = l1.toVector().subtract(l2.toVector()).multiply(1 / subSegments);
        for (double i = 0; i < subSegments; i++) {
            Location loc = l1.clone().add(offset.clone().multiply(i));
            //dostuffwithloc
        }
    }
flint coyote
#

No you can use any Identifier. Just use UUID.randomUUID()

paper viper
#

We are talking about storing it

#

Not generating it

quaint mantle
#

that works just fine

humble tulip
#

what do u need then?

paper viper
#

So store it using NBTApi or PDC

quaint mantle
humble tulip
#

ohh well u probably wanna do a raycast then

quaint mantle
humble tulip
quaint mantle
#

Idk

humble tulip
#

max?

quaint mantle
#

ill just do it

#

If it lags they just need better hardware tbh

#

šŸ¤·šŸæā€ā™‚ļø

humble tulip
#

lmfao

idle vessel
#

So here are the results and I don’t understand any of it

#

What is causing my server lag and how can i be turned down

dawn plover
#

i want to save a list of locations that isnt fixed (so everyone can add and remove locations from this list). but this list shoudnt reset when te server reloads, how would i save these locations
i thought about a json, but idk if thats the best go here

quartz basalt
#

fb.setVelocity(targetLocation.getLocation().toVector().subtract(baseLocation.getLocation().toVector()).normalize());

targetlocation is the location the blocks should be going to and baselocation is the location the blocks spawn at, both the locations are taken from the position of these armorstands in this picture
https://cdn.discordapp.com/attachments/829796363188830218/993893604181418025/unknown.png
the bottom one is the base top is target, the green arrow is what the falling blocks are doing and the red arrow is where they should be going, x and z works fine but the y axis doesnt go any higher then in the pic which doesnt really make sense

dawn plover
#

uhm, you dont mean in the plugin.yml right?

slim brook
dawn plover
#

aha, and does it have to be a specific path

#

or can i just save it in the same loacation as my java script

#

fair

flint coyote
#

I don't know the nbt api, sorry

slim brook
flint coyote
#

UUID.randomUUID() gives you an identifier. I guess the error is about setting it.

The uuid class that generates it is plain java

slim brook
#

Yeah i saw that

slim brook
#

That why i have this error

#

Thx now it's working

dawn plover
#

i cant find anything about yml, but a lot of yaml

#

are they the same?

#

this guy is doing this

#
List<Employee> colleagues = new ArrayList<Employee>();

colleagues.add(new Employee("Mary", 1800, "Developer", null));
colleagues.add(new Employee("Jane", 1200, "Developer", null));
colleagues.add(new Employee("Tim", 1600, "Developer", null));
colleagues.add(new Employee("Vladimir", 1000, "Developer", null));

// We want to save this Employee in a YAML file
Employee employee = new Employee("David", 1500, "Developer", colleagues);

// ObjectMapper is instantiated just like before
ObjectMapper om = new ObjectMapper(new YAMLFactory());

// We write the `employee` into `person2.yaml`
om.writeValue(new File("/src/main/resources/person2.yaml"), employee);```
#

but i cant do that

humble tulip
#

huh?

#

why cant u do that?

dawn plover
#

wait, cant i share photo?

#

or is it my pc tahts doing stupid

quiet ice
#

Nope, you need to be verified

dawn plover
#

oh oof , let me do that first

quiet ice
#

(It's give you access to the shiny #verified channel, so it is worth it)

humble tulip
#

and access to put pics

dawn plover
#

i cant verify

#

cus the server SpigotMC.org doesnt exist

#

at least that sais my minecraf

#

or is it a website

flint coyote
#

it's a website

dawn plover
#

oh XD, i am stupid

#

oke great

#

back to the question

humble tulip
#

send pic

dawn plover
#

the guy is doing this

humble tulip
#

ok?

dawn plover
humble tulip
#

what does it say when u hover objectmapper?

dawn plover
humble tulip
#

are u copying that?

#

from his code?

dawn plover
#

yea

humble tulip
#

you need the objectmapper class

#

and yaml factory class

dawn plover
#

oh...

#

is it really that bad to use sjon, cus thatone i used more ofthen then the yml

#

never seen yml in my life untill like 3 days ago

flint coyote
#

yml only exists because json does not allow comments

#

but yes it's a standard in spigot so you should get used to it. It ain't that hard

agile anvil
#

I wonder why toml still isn't natively implemented

dawn plover
#

is there any good docs on how to use yml

#

cus the onces i find eather dont say anything on how to move data from script to yml and reverse

dawn plover
flint coyote
dawn plover
#

thnx

modest garnet
#

anyone know any html?

flint coyote
#

I do

twilit wharf
#

I am making a plugin that needs to efficiently check if a player passes through a very small 3x1 passage. I know how to do it with the PlayerMoveEvent, but that doesnt seem efficient. There will be mutliple of the passages, so checking each one doesnt sound too great. Is there another way I could about this? (I dont want to have to use WorldGuard or any plugin like it)
Would packets instead of events be a viable option?

quiet ice
#

Is it 3*1*1 or 3*infinite*1?

flint coyote
#

it still explains the yml syntax

#

which is basically json but spaces instead of square brackets

quiet ice
#

It is basically json

flint coyote
#

and linebreaks

quiet ice
#

yaml is a superset of json

#

So you can just write json and it is valid yaml code

#

Best lifehack

quiet ice
eternal oxide
quiet ice
#

If it is 3*infinite*1 you can make use of a Set<Map.Entry<World, Long>> or similar (where as the long is a combination of x and z coords)

flint coyote
quiet ice
#

Ah then

#

If you want to do it really fast you can just as well use a boolean[][][][][] and spread the bits out through the indices of the individual arrays

quiet ice
#

Any valid json is already valid yaml

eternal oxide
#

yaml accepts json

quiet ice
flint coyote
#

I know it is but if he publishes a plugin with a config.yml full of json people gonna be like "what? why?"

quiet ice
#

I know they are faster for 2D spaces (provided you want to use it concurrently, otherwise you'd use LongToObjectMap)

waxen plinth
#

Why would you need a 5d boolean array

fiery prairie
#

can I use reloadConfig() in a command to reload the config?

waxen plinth
#

Yes

#

But all that does is load a new config instance that will be returned by Plugin#getConfig

#

So if you're keeping instances of the config elsewhere you'll need to update them

#

Basically any process you use for loading config will need to be run again when reloading

fiery prairie
#

but basically if there are only messages in the config it'll reload the messages to the server right?

waxen plinth
#

Not sure what you mean by "reload the messages to the server"

#

The new config will be returned by Plugin#getConfiguration()

#

That is the only thing that will happen

fiery prairie
#

aight thanks

dawn plover
#

why when i try to read it, does it give red flags, and the only thing is suggest is "delete unreachable statement"

waxen plinth
#

Show more code

#

You're likely doing something that is guaranteed to return above that code

hybrid spoke
glass mauve
waxen plinth
#

Also you shouldn't be using a path like that in your code

glass mauve
#

also locations.yml should be in resources

dawn plover
waxen plinth
#

And you should be using nio

#

And you shouldn't have underscores in your package names

glass mauve
#

you shouldnt

#

but you can

hybrid spoke
#

you can and should whenever you want

#

since its not against the naming conventions

short jewel
#

you actually should not, word seperation is done with a .

#

it is very much against package naming convention to do so šŸ˜… but insted of arguing about that lets
help the @dawn plover with his question

hybrid spoke
#

its totally fine to use underscores in your package names

short jewel
#

please provide me with a source that proves your right

glass mauve
#

^

hybrid spoke
#

and there is no convention that says otherwise

dawn plover
hybrid spoke
#

a quick google search should help you out

glass mauve
#

there is a convention that says that you should use lowercase and word seperation with .

waxen plinth
#

Google's official style guide, which to my knowledge is the most respected style guide for java, says not to use underscores

#

You can

#

And it's not possible to prove that it shouldn't be allowed

short jewel
waxen plinth
#

It's just against the most popular naming convention out there

waxen plinth
#

You've linked the oracle style guide and I've linked the google style guide

#

There are multiple style guides

waxen plinth
#

Oh my god can you shut up already

waxen plinth
#

...

glass mauve
#

this is so cringe

waxen plinth
#

Seriously can you shut up

hybrid spoke
#

nah

waxen plinth
#

Nobody is proving anything here

hybrid spoke
#

he literally wanted me to

#

i just did

waxen plinth
#

I said underscores shouldn't be used

hybrid spoke
#

idc

waxen plinth
#

It was feedback, not a compiler error

dawn plover
#

guys, you know you already solved my problem right?

paper viper
#

Just don’t have spaces in your package names…

#

It’s unnecessary

waxen plinth
#

Yes, GodCipher is just being pedantic

hybrid spoke
crisp steeple
glass mauve
#

weird

short jewel
#

well google didnt make java oracle does

#

so he is right although I dont agree

hybrid spoke
#

its a "code like google"

short jewel
#

arnt all conventions "code like X" then?

hybrid spoke
#

i wouldnt say that, but its getting close

short jewel
#

I mean camelCase is seen as a convention in java but I am pretty sure it was made but someone who had nothing to do with java

#

so arnt all conventions just code like X?

hybrid spoke
#

not really. its the standard which is expected in the underlying language

#

well you could say its a "code like java", but at this point we would just spin in circles

short jewel
#

yes but the fact is that its only expected cause someone made it up others liked it and then it became a convention eg a "code like X"

onyx fjord
#

okay so

#

double can be casted to float right?

waxen plinth
#

Yes

#

It's just a lossy conversion

onyx fjord
#

so why umm

if(world.getServer().getAverageTickTime() <= (float)OverlordConfig.spawnerMinTps) return;

gets flipped

#

strange

waxen plinth
#

You don't need to cast number types for comparisons

onyx fjord
#

oh?

#

okay lets see

waxen plinth
onyx fjord
#

so it breaks because of the cast

#

or nah?

worldly ingot
#

what do you mean? All of those are accurate lol

onyx fjord
#

šŸ’€ why does my spawner disable when tps are 20 and config value is 19.8

but it works when tps are 13

glass mauve
#

interesting

mortal hare
#

how big is reflection overhead when you cache field objects

#

it sucks how many NMS fields I need are private and final

#

and there's no setters for them

paper viper
#

I don’t think it’s too much?

chrome beacon
#

Should be fine

onyx fjord
#

can i somehow force server to have lower tps šŸ˜‚ ?

#

testing purposes lets say

paper viper
#

Yes lol

fossil nebula
#

build a lag machine =P

chrome beacon
#

If you want your server to perform poorly and you're on Windows you can lower the priority of the server task

onyx fjord
paper viper
#

You can make a plugin to restrict TPS

#

In fact one already exists

fossil nebula
onyx fjord
#

overdrive or something?

paper viper
#

Yes

onyx fjord
#

tps still 20 😭

mortal hare
#

is there any clientside mod that purposefully desyncs you from the server

#

sometimes its useful to test what's clientside and what's not

quiet ice
paper viper
#

Hack clients 🤔

river oracle
onyx fjord
#

number limits are lame

#

world.getServer().getAverageTickTime()
whats the timespan or whatever

sterile token
#

How do i update a mongo collection when the im not using a document. Instead im using a class object?

worldly ingot
manic bison
#

okay so a problem i'm trying to fix for a long time:

i have a method in another class that takes Player for argument.

and i have PlayerJoinEvent fired when a player joins the server, it kinda gives this code

playerjoinevent event{
player = event.getplayer().

class.method(player);
}

but when someone joins it says that class.method(player) nullpointerexception

#

i know my player is not null, made different checks but i cant seem to understand, its like the player never existed when calling the method

chrome beacon
#

Send your actual code

#

?paste

undone axleBOT
manic bison
crisp steeple
#

i would assume you are getting the npe from something else in the data.createPlayer method, not the player object

lime moat
#

Hello, dumb question...

How can I change where my maven clean install outputs to?

manic bison
#

method(player){
sysout(check1)
method body
sysout(check2)
}

both checks arent firing

crisp steeple
#

could you send the exception you’re getting?

manic bison
#

line 129: data.createPlayer(p);

quaint mantle
#

I didn't quite understand the question... can you explain a little more please?

frosty tinsel
#

Do you mean an external program, which executes some actions on the server?

dawn plover
#

how am i supose to do this outside the main plugin class

delicate lynx
#

?di

undone axleBOT
dawn plover
#

this sais the doc plugin.getConfig().set("player-name", name); , and thats what i did right?

delicate lynx
#

you need an instance of your main class

#

read the link the bot posted

dawn plover
#

thnx

sterile token
#

.ClassCastException: dev.alex.net.api.claim.Claim cannot be cast to dev.alex.net.libraries.bson.conversions.Bson

Claim class:

@Getter
@Setter
public class Claim {

    private final UUID uuid;
    private UUID owner;
    private Type type;

    public Claim(UUID uuid, UUID owner) {
        this.uuid = uuid;
        this.owner = owner;
    }

    public enum Type {
        User, Admin
    }
}```

Database:

```java
public class ClaimManager {

    private final Set<Claim> claims = new HashSet<>();
    private final Main plugin;

    public ClaimManager(Main plugin) { this.plugin = plugin; }

    public void load() {
        for (Claim claim : this.plugin.getStorage().getClaims().find()) this.claims.add(claim);
    }

    public void save() {
        for (Claim claim : this.claims) this.plugin.getStorage().getClaims().updateOne(Filters.eq("uuid", claim.getUuid()), (Bson) claim, new UpdateOptions().upsert(true));
    }
}
#

Maybe that is not the correct way for saving pojo's

paper viper
#

Main user šŸ‘æ šŸ¤§šŸ¤§šŸ—æšŸ—æ

#

I mean the error is literally there. You are casting Bson onto claim and you can’t do that lol

lime moat
#

Is there a way to block lightning strikes?

sterile token
#

Mongo has an option for using java objet instead of Documents

#

Let me send an example

paper viper
#

I don’t need to look at the API, you just are not supposed to cast there cause it’s pretty clear that your class is not a subclass lol

sterile token
#

Allright

#

So how i would do it

sterile token
#

Its like a document

paper viper
#

Show class

sterile token
#

Which class?

#

I alredy send them above

paper viper
#

Bson

sterile token
#

I dont have Bson clas

#

Its a mongo class

paper viper
#

Then why would you cast to it

#

What

sterile token
#
public class StorageManager {

    private final Main plugin;
    private MongoClient client;
    @Getter private MongoCollection<Claim> claims;

    public StorageManager(Main plugin) {
        this.plugin = plugin;
    }

    public void open() {
        Logger.getLogger("org.mongodb.driver").setLevel(Level.OFF);
        this.client = new com.mongodb.MongoClient(new MongoClientURI(""));
        CodecProvider provider = PojoCodecProvider.builder().automatic(true).register(Cuboid.class).build();
        CodecRegistry codec = CodecRegistries.fromRegistries(MongoClient.getDefaultCodecRegistry(), CodecRegistries.fromProviders(provider));
        this.claims = this.client.getDatabase("test").withCodecRegistry(codec).getCollection("claims", Claim.class);
        this.plugin.getLogger().info("Connected to database");
    }

    public void close() {
        this.client.close();
        this.plugin.getLogger().info("Disconnected from database");
    }
}```
#

I dont know i just trying to understand how to save the pojo class

paper viper
#

Do you know how casting even works

#

You can’t just cast to random objects and pray

sterile token
#

Yeah i know it should be extended or implemented to be cast right?

lost wolf
#

How can I know the private fields from an Entity class?

paper viper
#

Yes

paper viper
sterile token
#

So how would i save the document pulse?

sterile token
paper viper
#

There are no fields in an interface

#

Btw let me check

#

For mongo

#

I’m on vacation right now and I’m on phone lmao

lost wolf
#

Well, I'm trying to access a ZombieVillager class fields

#

Oh, yeah, they are all interfaces

paper viper
lost wolf
#

ZombieVillager is an interface too

paper viper
#

Go to the implementation

#

But be careful, realize that when you are dealing with interfaces any class that implements it may use it

#

So make sure that the implementation that you are getting the private fields from is specific

sterile token
#

Look the link i send

#

You will understand better what im doing

#

I based on that example

lost wolf
#

What I actually want to do is to modify the ConversionTime (NBT?) variable in a ZombieVillager without using the method setConversionTime(int time), because when that method is used the "entity.zombie_villager.cure" sound plays automatically

fleet comet
#

Does anyone know how the placeholderapi ecloud expansion works?

dusk flicker
#

ask them

lost wolf
#

Or is there a way to silence those automatically played sounds temporarily?

sterile token
#

Ecloud is just a cloud where placeholder api expansion are saved

#

Its like a maven repository

lost wolf
#

How can I modify a mob's NBT similarly to the /data modify entity <entity> command?

rain igloo
#

I need help with placeholder stuff/java scripts

lost wolf
#

How does reflection allows me to do that?