#help-development

1 messages Β· Page 1962 of 1

stray crescent
#

Is theresomething such as worldguard entry and exit commands?

#

/playsound minecraft:music_disc.otherside ambient <p> ~50 ~70 ~20 0.2
/stopsound <p>

sterile token
warm light
#

is there anyway to set skullOwner with different texture?

#

like skullOwner = md5
but texture will be mine

sterile token
warm light
#

yes

sterile token
#

Have you try searching like this on google "SpigotMC set existing skull texture to another texture"

#

When i cannot do it myself, I search it like that on google. And if i dont find any way i come to spigot

warm light
#

I already did. there are a lot of threads about "how to set skull texture" but no help about existing texture

zinc spire
#

anyone knows the way to fix this sql problems?

sterile token
#

What library are you using?

zinc spire
#

HikariCP

young knoll
#

Outdated, we have API now

#

See PlayerProfile

sterile token
#

Opinions?

young knoll
#

Try it?

#

Does it work

sterile token
#

It has an error

#

That why

#

It looks like Spigot-Jar doesnt contain that method

#

I will take a look at the NetworkManager class

young knoll
#

Did you remap

sterile token
#

Oh no

#

Which was the command?

young knoll
#

Well first, what version

sterile token
#

1.8.8

young knoll
#

Ah

#

No remapping back then

sterile token
#

Oh f

young knoll
#

Assuming you are developing against 1.8.8 and running 1.8.8

#

It should work

sterile token
#

And i check the obfuscated code and didnt find something that looks like returning the version

#

Because i know that for joining a server the server must know the version, so tge version its sent

young knoll
#

Not really

#

The client must know the server version

sterile token
#

Oh

#

Hmn

young knoll
#

ViaVersion has an API for this

sterile token
#

Oh

#

I will take a look

#

Thanks

dawn hazel
#

mm yes

#

java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.woolmc.basic.Basic.getCommand(String)" is null

#

i beg to differ

#

frucking java

#

also dont hate on me for defining plugin but still using this

#

i needed that to execute .reloadconfig

hasty prawn
#

Is it in your plugin.yml

dawn hazel
#

yep

#

oh right

#

i need to put content in these

vital yacht
#

That’s definitely causing it

dawn hazel
#

🀠 🏳️

warm light
dawn hazel
#

im too lazy to code in /basic and have reload be a subcommand of it

#

reload is the class

#

basicreload is the command

warm light
#

you register command "basicreload" onEnable
but said a command "reload" in plugin.yml

dawn hazel
#

oh

#

brain.exe stopped responding

#

there we are

#

now its working

#

your help is appreciated

sonic osprey
#

Hi. I use an ubuntu 20.04 server.
I've been told to host the minecraft server using a separate user account - Not root
I was wondering how this actually improves security...?
Also, I run a website using caddy. I don't know what 'user' caddy is running under, if it is even running under a user.

dawn hazel
#

lets say someone were to use a backdoored plugin to gain access to your machine

#

although the chances are unlikely

#

there is always possibilities

#

they wont have full root access

#

just the access you give the separate account on your machone

neon nymph
#

Hey guys, I got a folder in my resources folder that contains a lot of files. How would I go about saving the entire folder into the plugin's data folder without having to manually use saveResource() on each of them?

wet breach
#

an example of how to load/save your own files πŸ™‚

#

oh that method is just to update a config in moving data from the config to its own file

#

that highlighted section is the load method

#

that is the save method for the file

#

yeah the load method I showed does that too πŸ™‚

#

keep in mind when modifying your files, they are modified in memory only until you call the save() method

#

well the last link shows you how to do it, once you have a reference for the file you can do getString() or setString()

#

that project is open source, feel free to use it as a reference πŸ˜„

#

it comes from yamlconfiguration()

#

getData() just returns that object from the save/load class

#

well if nickData() is a yamlconfiguration object, then that would work and would set nickreq_list: args[1] in whatever yaml file

#

generally you want to use the specific set though for the type of data

#

so setString() is what most use

#

maybe it changed πŸ€”

#

set should work, now to see it in the file, you need to call the save() method

warm light
#

I am making a headdrop plugin which drop mob head on death. but problem is when someone place and break the head, it became default name(Player's Head). is there any way to fix it?
like with setOwner but with different texture or something else?

wet breach
#

Yeah that looks right, however you shouldn't need to specify the file to save

#

unless that is how you setup your method

wet breach
#
        File nickreq = new File(plugin.getDataFolder(), "nickreq.yml");
        YamlConfiguration nickData = YamlConfiguration.loadConfiguration(nickreq);
#

the way I have it is the better way πŸ™‚

#

it ensures you always grabbing the file from the plugin's folder

#

well the way you are doing the path is correct technically, but the more appropriate way is what I have shown. It removes any ambiguity in the path. Anyways I changed your object from FileConfiguration to YamlConfiguration instead

#

but with those changes it should work

#

the reason I keep my load/save methods in a separate class is because you need to ensure you retain the reference to your file

#

easier to ensure that when you have a whole class dedicated for that πŸ™‚

#

They are both files yes, but FileConfiguration is the base class and YamlConfiguration extends it, but it is more precise in that it knows it is a yaml file and not just a config file

#

Well it is a plugin that I need to update, I just use it as a teaching tool πŸ˜›

#

one of the best parts of it I think is that it makes use of the conversation API which I think gets under utilized in the bukkit/spigot api lol

#

what do you mean?

warm light
#

frostalf pls check dm

wet breach
#

Ah I see now, this is why I use a caching mechanism

#

to keep all the configs in memory so that they can be manipulated without the data actually changing in the file

#

Just keep your config in memory using a custom class and then either implement a timer to save what is in memory every so often or whenever you want it to happen

#

oh I see what you mean now lmao

#

you need to get and hold the old data

#

and then add it all back

#

to add to it

#

not if you add the old data plus new data together πŸ™‚

torn badge
#

Get the list, add your stuff, then re-set it

warm light
torn badge
#

It's a List, right?

wet breach
#
List<String> nicknames = getconfig().getList("Nicknames");
nicknames.add("new nickname");
getConfig.set("Nicknames", nicknames);
getconfig().save();
#

if you get it as a string that is fine too

#

you just can run that string through a buffer

#

and then you can just append to it

#

StringBuilder

#

works for that

torn badge
#

Just use a List

#

And use FileConfiguration#getStringList

torn badge
wet breach
#

that is because you created your hashmap that is suppose to keep track of the heads in the event class

#

so the only thing that gets added to it is anything recent

torn badge
#

nickData.getStringList

wet breach
#

instead of getConfig() it is nickData()

warm light
torn badge
#

Use a List of Locations instead

warm light
#

alright

torn badge
#

You're adding it to the list and afterwards you need to save it by calling set and then save

torn badge
neon nymph
#

Subfolder items contains all of them, and I don't wanna do saveResource on each and every one of them

#

Trying to find a way to maybe iterate over the files in the resources/items

torn badge
#

Don't set to args[1]

#

Set to nicknames instead

deft forum
#

anyone have an idea how to get a chest's contents in EntityExplodeEvent

lost matrix
onyx fjord
#

Can u make blocks cracked with spigot API?

#

Like the destroying progress

eternal night
#

note that this is limited to a single block iirc

onyx fjord
#

Does it have to be done as player

eternal night
#

huh ?

#

what do you mean "done as a player"

onyx fjord
#

I don't want w player to simulate breaking it

eternal night
#

this is a packet abstraction

#

nothing is happening on the server

onyx fjord
#

πŸ₯²

eternal night
#

you need a player because that player is the receiver of the fake packet

onyx fjord
#

Can I use nonexisting player

eternal night
#

what are you talking about. This method will show a fake block destruction progress to the specific player you called the method on

onyx fjord
#

Oooooh

#

Okay but can it be showed to everyone in radius or everyone online

eternal night
#

sure if you just run this method on all those players ?

onyx fjord
#

Gotcha thanks

eternal night
#

tho again, this method is limited to a single block

#

generally, not the most reliable

dapper sapphire
#

I'm working on a bungeecord plugin, I need to play a sound to a player what is the quickest and easiest way to do this?

silk mirage
#

he is using bungee btw

dapper sapphire
silk mirage
#

i think you can send a sound packet

#

lemme see

dapper sapphire
#

Can you further explain? This is like my first time working with bungeecord

silk mirage
#

he wants to handle it on bungeeside

dapper sapphire
#

yeah

lost matrix
#

Oh

#

Bungee

silk mirage
#

i do know that

lost matrix
#

Why would he want to do that on bungee? It has no context on locations or anything Player related.

dapper sapphire
full elbow
#

is there a plugin that disable elytra?

lost matrix
silk mirage
#

🀷

lost matrix
full elbow
silk mirage
#

There is a NamedPacketPlayOut thing

full elbow
#

i cant find one

silk mirage
#

but im not quite sure about the impl

lost matrix
dapper sapphire
lost matrix
lost matrix
dapper sapphire
full elbow
#

i try that one

dapper sapphire
lost matrix
dapper sapphire
ancient jackal
#

okay so I looked into the hashmap compute method after being shown it today
a much better way to write this, which adds 1 to each entityType key or sets it to 1 if null

            for(Entity e : c.getEntities()) {
                EntityType k = e.getType(); // k is EntityType in entityMap
                if(entityMap.containsKey(k)) {
                    entityMap.put(k, entityMap.get(k) + 1); // Sets EntityType key to previous value +1
                } else {
                    entityMap.put(k, 1); // Sets amount of EntityType to 1
                }
            }```
would be ```java
            for(Entity e : c.getEntities()) {
                entityMap.compute(e.getType(), (k, v) -> (v != null) ? v += 1 : v = 1);
            }

I think?

low frost
#

.

eternal night
#

compute is rather ugly as you have to do the null check yourself

#
for (final Entity entity : entities) {
    entityTypeCount.merge(entity.getType(), 1, Integer::sum);
}
ancient jackal
#

gotcha, the documentation confused me

tardy delta
#

the implementation of merge in HashMap goes brr

ancient jackal
#

fr fr

raw ibex
#

is it possible for a plugin to do other plugin's commands? Such as multiverse's commands

blazing scarab
#

you should use api's

lost matrix
raw ibex
#

(the yes)

eternal night
#

most plugins provide an API you can develop against to fetch its data

eternal night
#

how to use the API is usually documented

lost matrix
eternal night
#

why would you not want to use the API o.O πŸ‘€

raw ibex
#

how would you use the api

raw ibex
#

nothing nothing

#

its fine

#

sorry

lost matrix
# raw ibex i mean the not api

Not gonna support that when there is a well documented api present. But search for dispatchCommand. Will lead to bugs and you might need to implement your own Player interface.

lost matrix
#

copyResourceDirectory(final JarFile source, final String path, final File target)

#

copies a directory from within a jar to a file location.

manic furnace
#

In my plugin, I want to list something and list a list with TabCompletion.
My list looks like this:

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]

But when I show it on TabCompletion it looks like this:

#

What can I do so that its sorted?

tardy delta
#

not sure if minecraft respects the order

spiral light
#

its sorted

tardy delta
#

the 2, 3, 4 etc are down

spiral light
#

1 is lower then 2 ^^

tardy delta
#

ah

#

it sorts it in that way

manic furnace
#

How?

torn badge
#

It is being sorted as strings

#

Not as whole numbers

tardy delta
#

10, 11, 12, etc, 20, 21, 22 etc

#

dunno if Collections#sort would work

#

think mc handles the sorting itself

manic furnace
torn badge
#

You cannot sort it yourself

ivory sleet
#

The client sorts these alphabetically before listing them.

torn badge
#

The client does it

manic furnace
#

Is there a way to sort it numeric?

ivory sleet
#

well you have already been told that the client actually sorts them the way it does

#

and it considers even numbers to be strings whilst sorting I believe

manic furnace
#

Ok

midnight shore
#

Hi guys, how can i remove the possibility to get 9 ingots from a block? Basically i have a custom block named "compact gold block" thats made using 32*5 gold blocks. But when i put this item in the crafting grid, it returns 9 ingots which i don't want

lost matrix
#

*If you want to prevent crafting with it all together.

#

Otherwise you would want to check the recipe key

tardy delta
#

im gettin angry at my code

neon minnow
#

Im using gradle to build my jar, it builds it in /gradle/libs, how can i make it automatically go into my plugins folder? Thanks.

lost matrix
#

How is this all in one plugin called again that also provides a Economy.class service?
I need to quickly test a Vault impl and forgot the plugins name because i usually dont use any plugins

tardy delta
#

i thought you were talking about vault itself

tardy delta
#

i still dont understand why there are two db files

#

wth is that file extension tho

neon minnow
eternal night
#

a symbolic link

neon minnow
#

for what reason

#

is there no way to do it in gradle

eternal night
#

you create it in your servers directory

#

and it points to your build/lib/output-jar-1.0.0.jar

neon minnow
#

Why cant gradle just build to different directories?

eternal night
#

I mean you can

#

create a copy task

neon minnow
#

Thats what I asked

eternal night
#

create a copy task then /shrug

neon minnow
#

Β―_(ツ)_/Β―

neon minnow
#

Unresolved reference: copyDocs

eternal night
#

are you just copy pasting things ?

neon minnow
#

What are you talking about ?

eternal night
#

you'll have to throw some brain meat at the docs

blazing scarab
#

Symlink is an OS feature, not gradle

neon minnow
blazing scarab
#

It's easier

neon minnow
#

Its building into /build/libs why is there no easy way to change that in gradle

#

It is so stupid

eternal night
#

there literally is :/

neon minnow
#

It is not easy, i been looking on google and cant find anything about it

eternal night
#

create a copy task that depends on your build task

neon minnow
eternal night
#

which takes the output of the build task (your jar file) and copies it to your server home

neon minnow
#

I got this

#

tasks.build {
dependsOn("shadowJar")
}

wet breach
#

OS features are generally better

neon minnow
#

CopyDocs unresolved reference

blazing scarab
#

Just use sym links

#

It is simple as dick

#

And you can use it in multiple places

neon minnow
#

How!!!!!!!!!!!!

eternal night
#

google symlink creation ?

#

create a symlink in your servers plugin folder

#

that point to the jar you are building on your local PC

neon minnow
#

to be linked

eternal night
#

you can name the symlink whatever you want

#

as long as it ends in .jar

wet breach
#

will have to recreate the symlink when you update however

tardy delta
#

concurrency is weird lmao

#

nothing seems to trigger

midnight shore
#

how can i create a yaml file?

tardy delta
#

by creating a new file first

wet breach
#

File(file).createNewFile();

tardy delta
#

check if it exists

#

or use plugin.saveResource if it is included in your jar (with default or something)

#

then load it with YamlConfiguration.loadConfiguration(file) to get a FileConfiguration object to work with

tardy delta
#

is there no way to check if a file is empty tho?

eternal oxide
#

isEmpty() probably

neon minnow
#

what are you talking about @wet breach

#

update...

wet breach
#

if you change the original jar file the symlink gets broken

neon minnow
#

ok

#

obviously

tardy delta
#

nah there is no method like that lemme look it up

midnight shore
#

oh ty

tardy delta
#

ah there is a File#length == 0

midnight shore
#

and then how can i read?

#

values from the file

tardy delta
#

fileconfig.getString("bla-bla-bla") or smth

zealous silo
#

FileConfiguration#get(String key)

tardy delta
#

whiwh return an object ._.

zealous silo
#

or you have different variations for each object

#

yea

midnight shore
#

oh so the same as the default config of the plugin

zealous silo
#

yup

midnight shore
#

ty

#

how can i get an already created file? I don't want to make one, i'm using a command to read values from a specific file

quaint mantle
#

@tender shard and I are having e-sex in the vc

lost matrix
wet breach
#
File someFile = new File(plugin.getDataFolder(), "somefile.yaml");
YamlConfiguration someYaml = YamlConfiguration.loadConfiguration(someFile);
tardy delta
#

bruh i changed a sysout line and suddenly my things work

#

its .yml

#

dunno if it would matter

wary harness
#

try to run code at specific time at the day

        DateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss");

        Date date = null;
        try {
            date = dateFormatter .parse("20:34:30");
        } catch (ParseException e) {e.printStackTrace();}
        timer.schedule(new MyTimeTask(), date);

    }

    private static class MyTimeTask extends TimerTask
    {

        public void run()
        {
            Bukkit.broadcastMessage("Banana is Big");
        }
    }```
#

but nothing happens

#

am I doing something wrong

tardy delta
#

when does the player object knows that it has played before? i am checking if Player#hasPlayedBefore and it returns true when i joined for the second time?

#

causing issues with my database

midnight shore
tardy delta
#

he is in there

tardy delta
#

and they get saved within some time i guess?

#

so not specifically when the player quits the game?

wet breach
#

it gets saved when the player quits as well as when the world saves

#

and it should return true when you join a second time since you have played before

tardy delta
#

lets join a third time

#

its handling the first join again :/

wary harness
wet breach
#
Minecraft Wiki

<player>.dat files are used by servers to store the state of individual players. The format is also used within level.dat files to store the state of the singleplayer player, which overrides any <player>.dat files with the same name as the singleplayer player. These files are in NBT format.

tardy delta
#

im throwing the runtime exception myself but im talking about the sql exception

ivory sleet
wet breach
# tardy delta and then im getting this error on my database https://paste.helpch.at/ceyemekadu...
vague swallow
#

Can anyone tell me please how to update spigot with IntelliJ?

lost matrix
#

Do you want to fork it?

vague swallow
#

I need the newest version of spigot

#

But my plugin is a bit older

tardy delta
#

im doing that?

lost matrix
#

Let mcdev create a clean maven project and copy your src folder into the new project. Intellij can handle that.

vague swallow
#

Okay

#

ty

tardy delta
#

problem is that Player#hasPlayedBefore seems to return false instead of true

#

i guess the player data not being saved immediately

wet breach
eternal oxide
#

Which event are you testing the played before?

tardy delta
#

PlayerLoginEvent

#

hmm maybe that might be the issue

eternal oxide
#

test in join

vague swallow
#

Does anyone know what happened to the GameProfiles?

tardy delta
#

database stuff in login hmh ill see

fervent gate
#
public double calculateRequiredXPToNextLevel (int currentLevel) {

        int startingXP = (int) plugin.getConfig().get("StartingXP");
        double increment = (double) 1 + (plugin.getConfig().get("FarmLevelIncrement") / 100);
        double totalXP = startingXP;

        for (int i = 0; i < currentLevel; i++) {

            totalXP *= increment;

        }

        return totalXP;

}

This function gives the following error: Operator '/' cannot be applied to 'java.lang.Object', 'int' --> At the "double increment..." line.

tardy delta
#

(int) plugin.getConfig().get("StartingXP");

#

plugin.getConfig().getInt <=

fervent gate
#

Ooh

#

Thanks!

sacred mountain
#

hey im trying to make a vector for my fireball explosion, but its quite off the default fireball knockback. I just want to increase the knockback and not completely change it

#

any ideas on how to do that

tardy delta
#

well it seems to work

#

i was using login because it happens earlier so i'd have more time to do database stuff

midnight shore
#

Hi guys, i'm sending a PacketPlayOutPlayerListHeaderFooter packet to a player, the point is that i want it to update. i tried using a runnable but it doesn't work

tardy delta
#

anyways is it useful to explicitly clear a reference? im having an user class which holds a weakreference to the player itsis bound to, when they logout im intending to clear the reference

#

might be done automatically but thats why im asking

wet breach
tardy delta
#

nah ok

#

and something else...

#

i have a vanish command and when the player is vanished, he has fly enabled. But when they switch to survival while still vanished, the fly dissapears and im trying to avoid that but this doesnt seem to work, the debug message gets printed anyway

#

maybe delaying by one tick would be somethign?

vale ember
#

maybe

#

create variable for player plz

tardy delta
#

meh

vale ember
#

its ugly to call event.getPlayer() 3 times

tardy delta
#

🀌

vale ember
#

🍝

tardy delta
#

lemme see if it works

#

eyy works

#

lemme change 2 ticks to one tick lmao it looks like im falling a bit

vale ember
#

i would

tardy delta
#

what does it even do

#

generating basic structure?

vale ember
#

creates the template pom.xml, plugin.yml, main class and little other things

tardy delta
#

lmao noobs

vale ember
#

well personally i use gradle init instead

tardy delta
#

saving time is just making your own template and copying it when you need a new plugin lol :0

ancient jackal
#

πŸ‘‘

vale ember
#

why won't they add gradle kotlin dsl support???

ivory sleet
#

they?

vale ember
#

idk maybe him

ivory sleet
#

oh yeah

vale ember
#

i thought there are few ppl

ivory sleet
#

well you got a point

#

kotlin dsl is better in every way

restive tangle
#
@CommandOptions(name = "menu")
public class GameMenuCommand extends CustomCommand {
    @Override
    protected boolean execute(Player player, String[] args) {
        PlayerUtilitiesKt.sendMessage(player, "&eOpening the game menu");
        GameMenuInventory gameMenu = new GameMenuInventory();
        player.openInventory(gameMenu.getInventory());
        return true;
    }
}
public abstract class CustomCommand implements CommandExecutor {
    private final CommandOptions information;

    public CustomCommand() {
        this.information = getClass().getDeclaredAnnotation(CommandOptions.class);
    }

   // Stuff
    public String name() {
        return information.name();
    }
}
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandOptions {
    String name();
    String permission() default "none";
    int argsRequired() default 0;
}

The error happens when the plugin starts and tells me that customcommand name is null, even though it is not

#
java.lang.NullPointerException: null
    at me.quzack.survival.commands.CustomCommand.name(CustomCommand.java:33) ~[?:?]
    at me.quzack.survival.commands.CommandManager.<init>(CommandManager.java:17) ~[?:?]
    at me.quzack.survival.GameMain.onEnable(GameMain.kt:18) ~[?:?]
vale ember
#

ig information is null

#

not name

restive tangle
#

But all of it should already be given

vale ember
#

on CustomCommand

#

and it is null

#

try using getAnnotation

#

not getDeclaredAnnotation

#

or maybe you event cant

#

idk

restive tangle
#
    public CommandManager(GameMain plugin) {
        String directory = this.getClass().getPackage().getName();
        Reflections reflections = new Reflections(directory + ".implementation");

        for(Class<? extends CustomCommand> file : reflections.getSubTypesOf(CustomCommand.class)) {
            try {
                CustomCommand command = file.getDeclaredConstructor().newInstance();
                Objects.requireNonNull(plugin.getCommand(command.name())).setExecutor(command);
            }catch(NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException exception) {
                exception.printStackTrace();
            }
        

This is how it's registered

vale ember
#

interesting cuz i tested similar thing and it works

#

for annotation

tender shard
#

why ping

vale ember
#

i feel it's not all

restive tangle
#
java.lang.NullPointerException: null
    at me.quzack.survival.commands.CustomCommand.name(CustomCommand.java:33) ~[?:?]
    at me.quzack.survival.commands.CommandManager.<init>(CommandManager.java:17) ~[?:?]
    at me.quzack.survival.GameMain.onEnable(GameMain.kt:18) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.reload(CraftServer.java:965) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.Bukkit.reload(Bukkit.java:726) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:54) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:826) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:2185) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:2000) ~```
#
[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1953) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:49) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:7) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:35) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1271) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1264) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1225) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1139) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
    at java.lang.Thread.run(Thread.java:829) [?:?]
hollow bluff
#

?paste bro

undone axleBOT
vale ember
#

that makes me feel that information is null, can you try logging if it's null or not in constructor?

#

not the name

#

but information

restive tangle
#

Ok

lost matrix
minor garnet
#

i made a code where I did for when a player looks at an armor stand another armor stand on top rotating around it, the problem is that, from the moment the armor stand appears it doesn't rotate in the player's position, unless that you move too close to her

minor garnet
#

?paste

undone axleBOT
quaint mantle
#

Guys, does anyone know how I can get all chunks from point A to point B
Example:
firstLocation(...).to(second Location(...))

tall dragon
#

you can use vectors to achieve that

quaint mantle
#

I need to find chunks

tall dragon
#

well i think still vectors is your best option

eternal oxide
#

get all blocks between the locations with a ray trace. then add all Chunks from each Block to a Set

quaint mantle
#
fun getChunks(first: Chunk, radius: Int): List<Chunk> {

        val chunks: MutableList<Chunk> = ArrayList()

        for (x in first.x - radius..first.x + radius) {

            for (z in first.x - radius..first.z + radius) {
                val chunk = first.world.getChunkAt(x, z)
                if(chunks.contains(chunk)) continue
                chunks.add(chunk)
                server.broadcast(Component.text("Chunks: ${chunks.size}"))
            }

        }

        return chunks
    }
#

I have this code

#

I found such an example on the form of a spigot

tall dragon
#

this appears to get chunks in a radius, which is not what you want

eternal oxide
#

thats not even close to what you want

quaint mantle
#

But I need to find from one point to another. I'm really really bad at math

quaint mantle
#

Maybe someone has an example or there is some kind of library that does this*?

next stratus
#

Hey, what's the fastest way to iterate over a lot of blocks without lag?

eternal oxide
#

actually ```java
public static List<Block> getBlocksInBetween(final Location from, final Location to) {

    Preconditions.checkArgument(from.getWorld() != null && from.getWorld().equals(to.getWorld()));
    final World world = from.getWorld();
    final Vector start = from.toVector();
    final Vector direction = to.toVector().subtract(from.toVector());
    final int distance = (int) Math.floor(direction.length());
    final double yOffset = 0;
    final BlockIterator blockIterator = new BlockIterator(world, start, direction, yOffset, distance);
    final ArrayList<Block> blockList = new ArrayList<>();
    blockIterator.forEachRemaining(blockList::add);
    return blockList;
}```
#

that gets you a List of Blocks. Then all you need to is grab all the Chunks

eternal oxide
next stratus
eternal oxide
#

if you are only reading still Async

next stratus
#

I've been told fawe has some methods to do it but I can't import it due to them only using java 17 now

quaint mantle
#

You didn't misunderstand me a bit, I want to get all the chunks from point A to point B in order to add them to the ticket later (so that they are not disable)

#

And you're not for me

sacred mountain
#

hey how would i create a scheduler that will run code after an event has taken place? i cant seem to put it outside the event

quaint mantle
#

sry

eternal oxide
sacred mountain
#

or is there another way other than using bukkitscheduler/runnable\

eternal oxide
#

?scheduling

undone axleBOT
sacred mountain
#

erm

#

ok

#

ill have a look again

next stratus
#

I wish I could work out how to import fawe because that has what I need :/

tall dragon
#

then why arent you using java 17

lost matrix
#

Was about to ask ^^

next stratus
tall dragon
#

so?

#

you can compile to any level you want

lost matrix
#

Or you just drop all that legacy nonsense

tall dragon
#

yea

next stratus
#

I paid someone to add that support I'm not dropping it quickly lol

tall dragon
#

well regardless, you can still use java 17

next stratus
#

What I'd the user only has java 8 installed?

tardy delta
#

is a PlayerQuitEvent fired for all players when the server shutdown?

tall dragon
#

the user?

#

whats that got to do with it

next stratus
#

Yes, the people using the plugin if they got java 8 installed will it still work

tall dragon
#

a plugin is server side

sacred mountain
#

yea

tall dragon
#

it has nothing to do with the users java version

sacred mountain
#

@onyx fjord no

#

smh

tall dragon
#

ah i see what you mean

#

yes that will work

next stratus
#

Hm

lost matrix
next stratus
#

I have my project moduled it's a shame I can't set only 1 part of it to java 17 lol

eternal oxide
#

you can

tardy delta
#

if im returning a completablefuture somewhere and the excptionally method is handled, will future.whenComplete(result, throwable) -> {} ever return something notnull for the throwable?

eternal oxide
#

just set teh source and target on the module

golden kelp
#

hOw can I give the player a random spawner (a spawner that spawns a random entity)

tardy delta
#

like when do they happen? not the ones that could happen when the result is calculated?

#

or just interupptedexceptions

quaint mantle
tardy delta
#

and whats the difference with CompletableFuture#exceptionally than?

#

then, than idk

eternal night
#

doesn't take the result ?

tardy delta
#

so you have to handle one of them?

eternal night
#

whenComplete is basically your all handeling end of a future

tardy delta
#

ye

eternal night
#

where you can handle either the exception or the result

#

exceptionally is just an error handler

tardy delta
#

which will still return a result when you handle that?

eternal night
#

Well that exception handler can basically convert the exception into a result again

#

iirc

tardy delta
#

ah ye you can specify a result

eternal night
#

I mean it is what your function returns

golden kelp
#

How to check if a player kills an entity

eternal night
#

listen to the death event and check the killer

golden kelp
#

ok

tardy delta
gritty mist
#

``if(Bukkit.getServer().getOnlinePlayers().contains(Bukkit.getPlayerExact(args[0]))){ //Sender send request
Player tradeWith = Bukkit.getPlayer(args[0]);
player.sendMessage(cPrefix + ChatColor.GREEN + "Vous avez envoyΓ© une demande d'Γ©change Γ  : " + tradeWith.getName());
requestTrade.put(tradeWith,player);
tradeWith.sendMessage(cPrefix + ChatColor.GREEN + player.getName() + " vous envoie une demande d'Γ©change !");
}
else if(args[0].equalsIgnoreCase("accept")){ //Target accept trade
if(requestTrade.containsKey(player)){
Player tradeWith = requestTrade.get(player);
if(Bukkit.getOnlinePlayers().contains(tradeWith)){
Inventory tradeInv = Bukkit.createInventory(null,54,">>Trade");
player.openInventory(tradeInv);
tradeWith.openInventory(tradeInv);
requestTrade.remove(player);
}else{
player.sendMessage(cPrefix + "Ce joueur n'est pas en ligne !");
requestTrade.remove(player);
}
}else{
player.sendMessage(cPrefix + ChatColor.RED + "Aucune demande en attente !");
}

                    }

``

lost matrix
#

For traderequests, firendrequests, clanrelations etc. you should use a graph.

#

Otherwise its really hard to maintain relations of that kind

gritty mist
#

ok ok

#

because the tradeWith player didn't receive the information

lost matrix
#

This is how trade requests would look in a graph

gritty mist
#

like it triggers the error when there is no sender as the key for requesttrade

gritty mist
lost matrix
gritty mist
#

like I only check permission and instance of sender and I execute a void from another class (containing the logic)

#

?

lost matrix
#

Basically

gritty mist
#

Ok yeah I see

lost matrix
#

This way if you want to have the same functionality from within a GUI or in a clicked message or for an API they all can just call the same method.

tardy delta
#

im handling my command in the same class πŸ‘‰πŸ‘ˆ

young knoll
#

Welp

#

You’re going to die now

tardy delta
#

oh noo

#

who will feed my cat

lost matrix
#

This is close to my limit to how big a sub command gets. 5 lines is a soft limit for me. 3 is nice.

young knoll
#

Which framework is that

tardy delta
#

whoa

lost matrix
#

But i refuse to switch to anything else because ive put too much time into understanding it.

ivory sleet
#

lol

glossy venture
#

wait this is not possible?

tardy delta
#

wha

#

lol

glossy venture
#

i thought you could explicitly define the type variables

#

when invoking a method

tardy delta
#

try with parameter

glossy venture
#

?

tardy delta
#

nvm

ivory sleet
#

it is

#

Class.<Type>method()

glossy venture
#

ooooh

ivory sleet
#

iirc

#

ye

tardy delta
ivory sleet
#

valueOf

lost matrix
glossy venture
#

yeah i know the latter is obsolete

eternal night
#

thank god for final var r = this.<String>get();

tardy delta
#

😈

#

so this will return an object instead of a string?

ivory sleet
#

basically you're using it as get(Object) -> Object

tardy delta
#

weird

ivory sleet
#

not at all

#

you're just not taking advantage of type parameter inference

tardy delta
#

mye

grim ice
#

so that the uuid is the invited and the set is the inviters

#

since like, im not sure if u want ur players to be able to send more than one trade request to a person

lost matrix
grim ice
#

using a graph will let u send multiple requests to multiple people

lost matrix
#

Hm?

grim ice
#

and you only want to receive multiple requests, not send them in bulk

#

or am i wrong? I didnt really use graphs

lost matrix
#

You can always limit the nodes and kill others if you add a new one.
And for friend requests you def want to be able to send as many as you like.
Trade requests are a bit different. I think a normal mapping approach is just fine.
I would just prefer a graph.

grim ice
#

Gotta learn graphs then ig

quiet ice
gritty mist
# lost matrix Hm?

for the graph you told me to work on I have to set one edge and 2 vertices for the 2 players ?

grim ice
#

btw in ACF,
@CommandAlias("group")
public class GroupCommand extends BaseCommand {
@Subcommand("invite")
@CommandAlias("ginvite")
public void onGroupInvite(Player player, OnlinePlayer playerToInvite) { }
}
how does it know the argument after "invite" is what we want (aka onlineplayer) and how does it convert the arg to onlineplayer, what if i had another class?

lost matrix
quiet ice
#

I guess I'll ask the openjdk irc

lost matrix
quiet ice
#

I will

glossy venture
grim ice
#

But how does it ake it a player

#

what if i had a class I created, how would it know the logic and convert it

glossy venture
#

using a parsing function

eternal night
#

Reflection ?

#

You can fetch the parameter types of a method at runtime

grim ice
#

so it checks for each possible class and do that??

glossy venture
#

only the classes you register

grim ice
#

wdym

glossy venture
#

as commands

grim ice
#

and what even is this:

@Subcommand("pset")
@CommandCompletion("@allplayers:30 @flags @flagstates")
public void onResFlagPSet(Player player, @Flags("admin") Residence res, EmpireUser[] users, String flag, @Values("@flagstates") String state) {
    res.getPermissions().setPlayerFlag(player, Stream.of(users).map(EmpireUser::getName).collect(Collectors.joining(",")), flag, state, resadmin, true);
}
glossy venture
grim ice
#

ye

glossy venture
#

yeah so when you do that it looks through the methods and registers them as subcommands

grim ice
#

Ok but thats not my question

#

there should be a list of possible objects u can use in ur para

#

param

#

what if the class I use has a special way of parsing from a string

#

how would it somehow parse it

glossy venture
#

register a parser probably

#

i dont know how acf works

#

but i assume thats how it would wokr

lost matrix
grim ice
#

confusing

lost matrix
#

Its not easy to get a grasp of. Also took me a while. But its really powerful.

grim ice
#

and explanation on forum and wiki

#

is rly bad

#

or im just an idiot

quiet ice
#

Let's see if we are getting a response. The irc channel only has 15 clients connected to it which appears to be a really low number for such a huge project

lost matrix
# grim ice is rly bad
  private final Map<String, Clan> clanMap = new HashMap<>();

  public void register(BukkitCommandManager commandManager) {
    commandManager.getCommandCompletions().registerCompletion("@Clans", context -> new ArrayList<>(this.clanMap.keySet()));
    commandManager.getCommandContexts().registerContext(Clan.class, context -> clanMap.get(context.popFirstArg()));
  }

Basically this

#

Made up example

grim ice
#

oh so it accepts anything from the keyset, and passes it from the value in the map?

lost matrix
#

Then your command could look like this:

  @Subcommand("edit clan")
  @CommandCompletion("@Clan")
  public void onClanEdit(Player player, @Values("@Clan") Clan clan) {
    clan.openEdit(player);
  }
grim ice
#

whats @Values(@Clan) doing

lost matrix
#

@Values is a preliminary filter. It only accepts values provided by the completion.

grim ice
#

damn thats really cool

lost matrix
#

So if you type /clans edit clan sam but "sam" is not a valid completed argument then the player will get a message

grim ice
#

and how can u set that message

restive tangle
lost matrix
#

Thats a different story. You can define custom context error handler which handle the messages in a broad way.
Like Please specify one of [someclans] or define custom handlers for specific classes.

glossy venture
#

acf is really cool

#

brigadier is also quite epic

opal juniper
#

brigader isnt very intuitive imo

eternal night
#

if else if is the best

glossy venture
eternal night
#

especially for commands with more than 2 sub commands πŸ™

lost matrix
restive tangle
#

Any idea?

lost matrix
# restive tangle Any idea?

Cant look into reflections atm because im a bit tiered. Did you specify a retention policy so that the annotation can be retrieved on runtime?

glossy venture
#
switch (args[0]) {
  case "foo" -> {
    switch (args[1]) {
      case "bar" -> {
        switch (args[2]) {
          case "am" -> {
            System.out.println("ogus");
          }
        }
      }
    }
  }
}
``` best way of doing it
lost matrix
#

Yes.

restive tangle
#

Yes

#

The retention policy was already set, Discord didn't let me send messages lol

#

I don't understand what the issue with this is, it did work fine a day ago

tardy delta
#

java moment

mortal hare
#

am i the only one who thinks today's annotations in frameworks and libs are a bit abused

quiet ice
#

They are a bit abused

elfin atlas
#

Is there a way to send 2 actions bars like this?

mortal hare
quiet ice
#

Yeah, probs resourcepacks + reserved chars

elfin atlas
#

But this are 2 different texts

mortal hare
#

does it show up whenever actionbar doesnt?

elfin atlas
#

And different Hight

mortal hare
#

you can modify fonts in minecraft

lunar forge
#

Just create a invis item, and set the name to the text you want to display

mortal hare
#

and make cool stuff out if nowadays

young dome
#

Hello, would you know what this NPE is due to, it is called when I change world and is caused when I log all the packets (making sure there are no null values in the decoder) that the server receives? PS: There is no log on the client side and just a lost connection on the server side

elfin atlas
quiet ice
#

It probably is the stacktrace

young dome
lost matrix
young dome
#

Just all logs of packets

quiet ice
#

You probably sent invalid packets

lost matrix
quiet ice
#

Could you be encrypting the packets wrongly?

young dome
young dome
lost matrix
# young dome 1.8.8

Well... update to a supported version. Ancient versions like that have unresolved bugs in them.

young dome
#

I just receive and log

quiet ice
#

But you need to deencrypt them so the offline mode server can work with it

#

If you are working with an online mode server, you need to reencrypt them as the encryption keys between client <-> logger and logger <-> server are going to be different

young dome
quiet ice
#

oh, so no funky things on the connection side

young dome
#

Do you think that with an online mode server it will work?

quiet ice
#

It could be that you are accidentally consuming the bytes from the channel but I am not the expert in that matter

young dome
#

I receive byte and I transform it into something readable thanks to the decoder of io.netty

next stratus
restive tangle
#
    public CommandManager(GameMain plugin) {
        String directory = plugin.getClass().getPackage().getName();
        Reflections reflections = new Reflections(directory + ".commands.implementation");

Can it not get the file in the package command.implementation? Probably not since it does loop through the files.I think it thinks the name is null. But it's not

next stratus
#

Would that be better?

young dome
#

This will not bother your main Thread

lost matrix
#

Dangerous

next stratus
#

Dangerous how so?

lost matrix
#

Unspecified behavior. What if someone breaks blocks while you check for data?
Accessing bukkit methods from another thread is always dangerous unless its a BukkitScheduler method.

#

What you can do is split this task over several ticks

next stratus
#

I mean, I just wanna loop the blocks within a region without it causing any lag to the server somehow. I would import fawe to use their systems but they expect everyone to be using a newer Java version and not everyone can support it

lost matrix
#

And why do you use a CuboidRegion? Spigot has BoundingBoxes.

next stratus
#

I mean redlib doesn't offer BoundingBoxes.

lost matrix
#

Do your own async block editing

restive tangle
#

Hold on, it's trying to access a file that does not even exist now, I made a TestCommand file before and it's still trying to load it in

#

Why is it trying to register a class that doesn't even exist??

next stratus
young dome
#

?

quiet ice
#

Not that I think

young dome
quiet ice
#

Well you could do sysouts and check guess when it happens that way, but that is a pretty bad approach given that networking is multi-threaded iirc

young dome
#

Uh, this happens when I change world, and in terms of packets it's mostly the chunk loading packets that are in large numbers

tardy delta
#

how should i call my class that holds are the caches?

quiet ice
#

how is your architecture set up?

tardy delta
next stratus
young dome
tardy delta
#

NO

young dome
#

Yes, it's not beautiful without

tardy delta
#

its ugly with

young dome
#

USE this

tardy delta
#

im going to tell about the kids in your basement

quiet ice
#

If you do not have local variables, using this is overkill outside of setters and constructors

#

I'd call the class <pluginname>Data

tardy delta
#

nonpersistentdata πŸ’€

quiet ice
#

Though if it is only used with SQL, <pluginname>SQLCache

tardy delta
#

got multiple db implementations lol

quiet ice
#

Or just RemoteDataCache

tardy delta
#

hmh ye maybe

quiet ice
#

although that implies a bit that the cache itself is remote. AAAAAAAA

#

Just go back the flatfile, everything is easier here

#

Then you get stupid stuff like


public class UUIDIntIntConcurrentMap<V> {

    @NotNull
    private final ConcurrentHashMap<UUID, RegionatedIntIntToObjectMap<V>> root = new ConcurrentHashMap<>();
tardy delta
#

UUIDIntIntConcurrentMap<V> lmao

zealous silo
#

this is beautiful

quiet ice
#

(I should really just use the chunk PDC for it, but I want to have it concurrent)

tardy delta
#

ConcurrentHashMap<UUID, RegionatedIntIntToObjectMap<V>>🀌

gray comet
#

@NotNull

quiet ice
#

Well I am calling it like 9 million times every 5 seconds, so there is a reason I have this set up

tardy delta
#

nice

quiet ice
#

If I were to use boxed ints GC would be invoked every 5 secs instead of every 2 minutes

gritty mist
#

How do I provide my graph node type with Player type instead of int

quiet ice
#

What is your graph node?

#

Like the guava graph nodes or something else?

gritty mist
#
            Player value;
            int weight;
            Node(Player value, int weight){
                this.value = value;
                this.weight = weight;
            }
        }

#

there is a graph in Guava ?

gray comet
#

Yes

quiet ice
#

(I'd honestly use UUIDs instead)

gritty mist
#

bruh im stupid

gray comet
#

com.google.common.graph.Graph

blazing scarab
#

a stupid question but what's graph

gritty mist
#

data structure

quiet ice
#

Uh, basically an assortment of nodes

gritty mist
#

with nodes and weighted connections

blazing scarab
#

πŸ₯±

quiet ice
#

They do not really need to be weighted

#

Not sure if they need to be connected even

gritty mist
#

yse its optionnal

#

yes its just better to make interactions I guess

quiet ice
#

I guess you could say that an array is a graph?

gritty mist
#

ArrayΒ²

#

most likely

#

so then how do I use it

arctic moth
#

what do you ppl think is the best gui library (i suck at those lol)

quiet ice
#

Where as each element of the array is a node? Idk. However a graph can also connect multiple nodes to a single node and can connect a node to itself

#

InventoryGUI by phoenix616. But there a bit of a bias there because I know the dev a bit more than most other devs

blazing scarab
verbal heron
#

How do i cancel end portal creation?

young dome
verbal heron
#

Without completely disabling the end

gritty mist
#

I think

restive tangle
#

Reflections is trying to load classes that don't exist for no reason

verbal heron
#

I tried cancelling PortalCreateEvent and PlayerPortalEvent

#

that did not work

#

Only works for nether portals

arctic moth
#

in the InventoryGui library, how do you get the InventoryHolder to put in the GUI when making it

#

cuz it requires a holder object

#

and Holder requires InventoryGui

#

im so confused

#

lol

chrome beacon
#

Link it?

arctic moth
#

how tho

chrome beacon
#

No just link the library so I know which one it is :/

arctic moth
gritty mist
#

like set it up put the players in and all that stuff

chrome beacon
quiet ice
#

Make it null

chrome beacon
#

Or that

arctic moth
quiet ice
restive tangle
#

What?? [15:20:43 INFO]: Registering class commands.implementation.TestCommandLol this package does not exist in my project

quiet ice
#

Hm, what do yo uwant to achieve?

restive tangle
#

This is how I register my commands ```h
init {
val directory = javaClass.getPackage().name
val reflections = Reflections("$directory.implementation")
for (file in reflections.getSubTypesOf(CustomCommand::class.java)) {
try {
Bukkit.getConsoleSender().sendMessage("Registering class " + file.typeName)
val command = file.getDeclaredConstructor().newInstance()
Objects.requireNonNull(plugin.getCommand(command.name()))!!.setExecutor(command)
} catch (exception: NoSuchMethodException) {
exception.printStackTrace()
} catch (exception: IllegalAccessException) {
exception.printStackTrace()
} catch (exception: InvocationTargetException) {
exception.printStackTrace()
} catch (exception: InstantiationException) {
exception.printStackTrace()
}
}
}

restive tangle
#

*class does not exist, not the package

restive tangle
#

What is that supposed to mean?

quiet ice
#

is this kotlin?

restive tangle
#

Yes

quiet ice
#

I have no clue what this does, so sadly I do not think that I can help here

#

Just beware that it may be synthetic depending on the circumstances

arctic moth
#

also what do you put for the String[] rows when making the inventorygui

quiet ice
#

(or that it is an "inner" class)

restive tangle
#

It gets all the files in package commands.implementation and loops over all of them which is a sub class of custom command

vale ember
quiet ice
restive tangle
#

I don't know, right now I'm trying to fix this annoying bug

quiet ice
celest ferry
#

Hi !
I'm trying to make the spectator's tab name doesn't change itself in italic and darker.
I'm trying to do :

player.setPlayerListName(ChatColor.RESET + + player.getName());

But it still works halfway... The player's name isn't italic but it stays dark...
Do you know how to do what i'd like to do ?

quiet ice
#

ChatColor.RESET + ChatColor.WHITE + ...

celest ferry
#

(I tryed to search on forums but I didn't find the solution)

celest ferry
arctic moth
opal juniper
celest ferry
#

Oh

opal juniper
#

seeing whether this packet is sent would be a useful start

celest ferry
#

I've never worked with packets tbh, but I'll try πŸ˜‚

lost matrix
celest ferry
#

Okayy i'll search for this, thank you ! <3

restive tangle
#

It keeps trying to register TestCommand even though it's in a different package and it also does not exist

lost matrix
quiet ice
#

What happens if you decompile your plugin?

#

Will the class show in the expected location or in another location?

mortal hare
#

depends if its obfuscated or not

young dome
lost matrix
#

Make sure you dont minimize with maven or else unused classes will just be removed

quiet ice
#

this is kotlin, so likely gradle is used

restive tangle
#

I think I'll just do that

opal juniper
#

last few times ive tried to use minimise it doesnt remove shit lol

azure hazel
#

is it ok to ask about server plugins setup for plotsquared, worldedit and voxelsniper in this chat?

opal juniper
azure hazel
#

ty

arctic moth
#

how would i make it so in InventoryGui the item depends on the player who accesses it

arctic moth
#

cuz it gets the player only when they click an item in the gui but it doesnt do anything like that for showing the gui

errant mist
#

idk

#

s

sterile token
fervent gate
#

The found tag instance cannot store Double as it is a NBTTagIntWhat does this error mean?

#

I keep getting it when getting the value from a pdc

lost matrix
#

It simply tells you that an int is not a double... whats the line that causes this?

sterile token
#

And also provide the code

fervent gate
#

double currentXp = persistentDataContainer.get(key, PersistentDataType.DOUBLE);

#

Most of the class isn't really relevant

#

but this is it if it would be

lost matrix
#

How do you store the data in the pdc?

fervent gate
#
@EventHandler
    public void onPlayerJoin(PlayerJoinEvent playerJoinEvent) {

        Player player = playerJoinEvent.getPlayer();
        PersistentDataContainer persistentDataContainer = player.getPersistentDataContainer();
        NamespacedKey keyxp = new NamespacedKey(plugin, "farmingxp");
        NamespacedKey keylevel = new NamespacedKey(plugin, "farmingxp");

        if (!persistentDataContainer.has(keyxp, PersistentDataType.DOUBLE) && !persistentDataContainer.has(keylevel, PersistentDataType.INTEGER)) {

            persistentDataContainer.set(keyxp, PersistentDataType.DOUBLE, 0.0);
            persistentDataContainer.set(keylevel, PersistentDataType.INTEGER, 0);

        }

    }
#

this is the code that initiates the values

lost matrix
#

Im getting yandere vibes from your code

sterile token
#

Also, why do you assign the same value 2 times?

fervent gate
#

Understandable

arctic moth
#

anyone have a workaround for using player in lambda

sterile token
lost matrix
# fervent gate Understandable

I dont see any immediate causes here. But it sounds like you store an int value somewhere and try to read it as a double later.

arctic moth
#

and their weird event system thing

fervent gate
sterile token
fervent gate
#

That was it indeed, thanks

arctic moth
sterile token
arctic moth
#

their docs dont really help in the example lol

lost matrix
fervent gate
lost matrix
#

HumanEntity?

fervent gate
#

As you said

arctic moth
#

idk its lambda object

#

so it doesnt rlly have a type

lost matrix
arctic moth
#

wdym

lost matrix
neon nymph
ivory sleet
#

Lambdas are just stateless objects, still objects (:

arctic moth
ivory sleet
#

They are objects with no instance variables and just a single concrete method

lost matrix
#

Are you going to make me read the src now?

#

Ok so the lambdas target is a class called Action why doesnt he just use something normal like Consumer<Player>... Now i have to find out where thats from because i dont have it in my ide 😦

lost matrix
#

Im assuming that "viewer" is a HumanEntity

#

But im not sure

arctic moth
#

so do i just cast?

lost matrix
#

Then cast it to Player

arctic moth
#

lol why is it grayed out doesnt that usually mean the cast isnt actualy being used

#

like it doesnt need the cast?

#

im confused

vale ember
#

yep

arctic moth
#

but now its not red

vale ember
#

it means cast isnt required

arctic moth
#

but it is

lost matrix
arctic moth
#

but it wasnt

#

xD

vale ember
#

the viewer is already player or the type the viewer is contains the method/field you want

arctic moth
#

but it didnt

#

before the cast, it was red

#

after, it wasnt

#

Β―_(ツ)_/Β―

vale ember
#

bug ig

opal juniper
#

no, i doubt it was a bug, can you show the whole line of code

celest ferry
#

Hi, I'm trying to get the gamemode in a Player Info packet (tab) with ProtocolLib. https://wiki.vg/Protocol#Player_Info says that the gamemode is an array of VarInt. So, my code is :

        ProtocolManager manager = ProtocolLibrary.getProtocolManager();
        manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.PLAYER_INFO) {
            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer packet = event.getPacket();
                System.out.println(packet);
                int[] gameMode = packet.getIntegerArrays().read(1);
                System.out.println(gameMode.toString());

            }
        });

But I get this error :

No field with type [i exists in class PacketPlayOutPlayerInfo

I really don't understand...

#

Oh I'm sorry, maybe I've just not understood the wiki

lost matrix
celest ferry
#

Ohhh thank you so much, I didn't see that I could do that

lost matrix
#

StructureModifier because i assumed that you want to hide if someone goes into spectator

celest ferry
#

:D Thank you !

opal juniper
#

oh darn smile beat me to it

thick scarab
#

Hi. Is Item#setPickupDelay in ticks or seconds?

opal juniper
#

ticks i would imagine

#

but the docs probs say

lost matrix
#

^

opal juniper
#

oh they dont

#

guess its a try it and see moment

lost matrix
#

Everything in spigot is measured in ticks

sterile token
#

I have question long its a time format?

mortal hare
#

long is data type

sterile token
#

Allright

lost matrix
#

Oh yeah. Actually never used conversations XD

mortal hare
#

you're probably getting Unix timestamp

#

as the long data type

sterile token
#

And why long values are used on sleep(20L)?

mortal hare
#

Unix timespan is the time in milliseconds since the unix epoch

#

time in ms since 1970

mortal hare
opal juniper
sterile token
#

Allright so 20L = 1 second?

opal juniper
#

technically yes

sterile token
#

I never understand the format of L

opal juniper
#

assuming the server isnt lagging

lost matrix
#

depends on your tps

sterile token
#

Hmn?

mortal hare
#

L is just a flag on your value

opal juniper
#

ticks per second

mortal hare
#

to mark that your inputted value is long

sterile token
#

Wait longs arent mili-seconds format

opal juniper
#

no its literally just a number

sterile token
#

Cuz 1000ms = 1 second

mortal hare
#

Long is just a datatype

lost matrix
#

longs are just integers. But longer

sterile token
#

Ahh allright

#

Sorry i get confused

mortal hare
#

Integer largest number available to save: 2147483648
Long largest number available to save: 9223372036854775807

sterile token
#

I would like to make pagination on my menu api

mortal hare
#

sometimes integer isnt enough

#

for example unix timestamp clock would stop at 2038 if the value was integer instead of long

sterile token
#

        MenuButton button1 = new MenuButton(new ItemStack(Material.BOOK), (action) -> action.getWhoClicked().sendMessage("Clicked on slot" + action.getSlot())); // Creating a button
        MenuButton button2 = new MenuButton(new ItemStack(Material.ENCHANTED_BOOK), (action) -> action.getWhoClicked().sendMessage("Clicked on slot" + action.getSlot())); // Creating a button
        Menu menu = new Menu("&6Menus", 9).setButton(3, button1).setButton(6, button2).build(); // Creating the menu

        MenuHandler.getInstance().setup(); // Menu handler setup

        MenuHandler.getInstance().register(uuid, menu); // Registering a menu
        MenuHandler.getInstance().unregister(uuid); // Unregistering a menu

        menu.open(player); // Opening menu to player
        menu.close(player); // Forcing menu closing

Could be more simple?

#

If you are asking this how its works my own menu api

mortal hare
#

that's great

#

if its simple enough to use for you

#

its good

sterile token
#

its not for me

#

Its for my library

#

I will be publishing

#

So im trying to get people opinions

#

Im thinking about adding pagination system. But i didnt find how to do it

lost matrix
#

Is it on github?

sterile token
#

For the momment no

#

But i can upload it to a repo for you to take a look

opal juniper
#

or a gist

tardy delta
#

wrote something similar for my previous plugin :0

sterile token
#

Allrgith i will upload as a public repo

lost matrix
lost matrix
#

classic

#

And its backed by a Map<Integer, MenuButton> i assume?

sterile token
#

This was my best listener done by me. Its amazing. Its not harcoded, doesnt use ugly if-else

lost matrix
#

Then for paginations you have several options. For example a wrapper class that contains a List<Menu> and handles linking them.

mortal hare
#

I'm currently developing gui system too

#

just for fun

sterile token
tardy delta
#

i made a new inventory when i clicked a certain button and filled it with new gui items