#help-development

1 messages · Page 330 of 1

mortal hare
#

its so hard to make something useful

quaint mantle
#

um

quiet ice
#

I kinda like terminal UIs for that reason

quaint mantle
#

did anyone figure out what is wrong in the code i pasted?

mortal hare
#

this is what I currently had made

sterile token
#

I think the most efficient way for doing this outline would be using Packets, so then only the client see them

mortal hare
#

and the more i look it the more I hate it

quaint mantle
#

how do i use packets?

rotund ravine
#

use the spigot api

quiet ice
quaint mantle
quiet ice
#

In chunk 0/0/0 I mean

quaint mantle
#

?????????????????????????????????????????

quiet ice
#

You are working with absolute values

quaint mantle
#

wtf it does

quiet ice
#

I.e.

                player.sendBlockChange(new Location(playerWorld, 15, highestBlockInChunk, i), blockData);

is wrong as x,y, and z won't ever be beyond [0,255]

#

for x, z it's even worse with them never being beyond [0,15]

mortal hare
#

enter 1.18

quaint mantle
#

wait.................................

#

oh.........................................................

#

nevermind

#

i am tired today.......

quiet ice
#

so you understood your issue?

quaint mantle
#

yep.....

#

i am blind

mortal hare
#

iirc block limits are not hardcoded anymore

quiet ice
quaint mantle
#

i thought they were chunk coordinates

quiet ice
#

Ah you mean THAT

mortal hare
#

-64 is the lowest point

quaint mantle
#

not world coordinates

#

this entire time

regal scaffold
#

Like I want to use the world gen on startup then wait until i'm allowed to create worlds and create the worlds @tender shard

quaint mantle
#

bruh

#

i am blind

#

so

#

blind

#

lol!

#

i somehow thought i was working in chunk coordinates and relative to the chunk of the player even though that is clearly not the case.

mortal hare
#

x,z only

quaint mantle
#

no they do, blocks in a chunk

mortal hare
#

since chunks are mapped into 2d

quiet ice
#

Even then they are in world coords

quaint mantle
#

in the f3 screen.

mortal hare
#

chunk dimensions are 2d while their contents are 3d

#

0,0 is the first chunk

sterile token
# rotund ravine nope.

I thought it was more efficient, because the sever doesnt have the extra load for rendering
As far as i know client rendering is more efficient rather server rendering

mortal hare
#

unless you are using cubic chunks mod

quiet ice
rotund ravine
quiet ice
#

There are Chunks sections and Chunk columns. Both can be considered to be "Chunks"

sterile token
rotund ravine
#

It happens on all versions

quiet ice
#

Yeah

#

What else would it do?

#

It's strictly clientside

mortal hare
#

Older versions didn't have that API method

#

afaik 1.8 doesnt have it for example

sterile token
mortal hare
#

you needed to get the nms network manager and get the packet class to send it manually

sterile token
#

Also dont you need the player handle?¡

mortal hare
#

you do

#

that's how you get network manager

#

or smth like that

#

i havent coded plugins since august

#

i've been busy with uni c++

#

and assembly, bitwise operations 😄

sterile token
#

oh ok, dovidas dont you know which class listen RemoteQuery from Bungee?

mortal hare
#

no idea

sterile token
#

Because on bungee its like a RemoteQuery object which make queries to Spigot side, but i dont find it on the bukkit code

tardy delta
mortal hare
#

it was simple x86 operations nothing fancy

#

msvc c++ with _asm keyword

tardy delta
#

i had to suffer with writing the instructions in binary

mortal hare
#

i had it too

quaint mantle
#
player.sendBlockChange(playerChunk.getBlock(i, highestBlockInChunk, 0).getLocation(), blockData);```
#

fixed the error

mortal hare
#

most useless lecture ever

quaint mantle
#

i just copy pasted code and it has cost me like 40 mins

tardy delta
#

java bytecode would've been more useful in my case

mortal hare
#

asm is powerful, but it takes time

quaint mantle
#

lmao.

tardy delta
#

hmm

sterile token
mortal hare
#

C

sterile token
#

oh kk

mortal hare
#

JVM is written in C and yes, you're right kinda

sterile token
#

Im really confuse with ASM because there 2 ones

willow moss
#

Hey, I need a little bit of help with attack cooldowns. I am trying to get the exact time in ticks of the attack cooldown of the player.

For instance, if they player were to swing a sword that takes 1 second for the cooldown to go away, it would return 20. If you were to use the default .getAttackCooldown() It only returns a number between 0 and 1.

civic prairie
#

hello

#

how can i add enchantments to a sword?

mortal hare
#

C is more raw, and C++ is more versatile but at the same time very inconsistent since it wraps around C language principles

sterile token
willow moss
mortal hare
#

C is fast, but cant even overload a function

#

or heck even do OOP classes

quiet ice
#

but there are structs

civic prairie
# sterile token You should ge tthe item stack object and then use they addEnchant method

I am trying this:

                                        ItemStack item = new ItemStack(Material.DIAMOND_SWORD);
                                        ItemMeta meta = item.getItemMeta();
                                        item.setItemMeta(meta);

                                        if(getConfig().getString("espada.display.Name").equals("")) {
                                            meta.setDisplayName(getConfig().getString("espada.display.Name"));
                                        };

                                        if(getConfig().getList("espada.display.Lore") != null) {
                                            List<String> lore = new ArrayList<>();
                                            lore.add("Linea 1 del lore");
                                            lore.add("Linea 2 del lore");
                                            meta.setLore(lore);
                                        }




                                        meta.addEnchantment(Enchantment.DAMAGE_ALL, 1);
mortal hare
civic prairie
#

But addEnchantment is in red

mortal hare
#

apart from the function pointers

#

inside the struct vars

tender shard
willow moss
sterile token
civic prairie
civic prairie
sterile token
civic prairie
#

you are spanish too, right?

#

ah hahaha

willow moss
# civic prairie ahhhh, ok

You will also have to pass in another argument specifying whether or not it will ignore level restriction.

civic prairie
#

ok, thanks

tardy delta
#

most of the people not realizing the lore doesnt need to be a mutable list

hazy parrot
ivory sleet
#

I mean I would not consider function overloading a feature in c, but there are... well... other ways to achieve similar results

hazy parrot
#
void foo(int a)
void foo(int a, int b)
#

There is nothing wrong in doing it in c

#

Afaik that is overloading

mortal hare
#
Does C have function overloading?
Function overloading is a feature of Object Oriented programming languages like Java and C++. As we know, C is not an Object Oriented programming language. Therefore, C does not support function overloading.
#

maybe your compiler supports it?

tardy delta
#

isnt overloading the same method with dif amount of params?

#

i never use all those fancy words, i just know how to impl stuff

sterile axle
#

the same method with same parameter counts but different types

#

c does not support polymorphism which is why you cannot do that in c

#

for example

#
void foo(int param);
void foo(char param);
#

you can't do that

tardy delta
#

lol

#

you can in c++ tho?

hazy parrot
#

I can swear Ive done that for my school project

mortal hare
#

as long as the function name is the same you cant do it

sterile axle
#

you can do this however, and you see this often in c

void foo_i(int param);
void foo_ch(char param);
#

c++ is object oriented and supports polymorphism

tardy delta
#

lets goo brr...

sterile axle
#

so yes you can

#

c is very simple

mortal hare
#

C++ can overload functions but internally it uses function naming map

#

its kinda hacky

tardy delta
#

and very barebones

mortal hare
#

it adds suffix to your function name

#

to distinquish while compiling

tardy delta
#

🥲

sterile axle
#

overloading is syntax sugar anyway, when it comes down to it and you boil all the way down, it has to do fucky shit

#

it is what it is

mortal hare
#

i still dont get it why C++ compilers read functions as two distinctive ones even if the names are the same, but still do some suffixing for no reason, since asm use pointers to call functions not their names

sterile axle
#

not a clue, im not a c++ user :p c however is bae

mortal hare
#

i bet it has to do something with C backwards compatibility

sterile axle
#

that probably makes sense. valid c is valid c++ right? so g++ probably is indeed compiling it the same way as gcc would

#

but pure guess

mortal hare
#

*(void*)var is invalid in C++

#

while it is valid in C

#

afaik

sterile axle
#

and this is why i don't like c++

illegalizing my beloved pointer hell

tardy delta
#

afaik g++ has a flag to set to either compile it for C or for C++

sterile axle
#

if you do man g++, it pulls up the same document as man gcc. so i think they're the same program - the manual merely mentions that some flags are for c++ only and when used on c have no effect

#

it also says that when compiling c++, you could use gcc, but g++ should be used as a matter of habit

tardy delta
#

im wondering what one im actually using

#

no clue i have them both and i forgot which one to use on cli

drowsy gust
#

Hey when yall finish ping me i wanna ask a qustion i won't disturb yall

tardy delta
#

g++ ig

sterile axle
#

you can ask

#

we're just talking, it's not anything important @drowsy gust

drowsy gust
#

aight

#

so

#

I'm trying to make a small annotation based commands system core for my server i've made a good progress so far but i' having issues while registering the commands (actually i'm not facing any issues but i have no idea how to register the SubCommands for the root command using annotations).

My idea was to make a SubCommand Object and load it from the annotation @SubCommand then add them to the subcommands list at HomiesCommand Object.
All i need is some expert to guide me how to make it happen

Command Manager:

public abstract class HomiesCommand extends BukkitCommand {

    private List<HomiesSubCommand> subcommands;

    public HomiesCommand(String name, List<HomiesSubCommand> subcommands, List<String> aliases, String permission, String permissionMessage, String description) {
        super(name);
        this.setUsage(MessageUtils.format("&cUsage:/"+name));
        this.setAliases(aliases);
        this.setDescription(description);
        this.setPermission(permission);
        this.setPermissionMessage(permissionMessage);
        this.subcommands = subcommands;
        hook();
    }

    public void hook(){
        Field field = null;
        try {
            field = Bukkit.getServer().getClass().getDeclaredField("commandMap");
            field.setAccessible(true);
            CommandMap commandMap = (CommandMap) field.get(Bukkit.getServer());
            commandMap.register(getName(),this);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public boolean execute(CommandSender commandSender, String s, String[] strings) {
        if(strings.length > 0){
            for(int i = 0; i < this.subcommands.size();i++){
                subcommands.get(i).execute(commandSender,strings);
            }
        }
        execute(commandSender,strings);
        return true;
    }

    protected abstract boolean execute(CommandSender sender, String[] args);
}

SubCommand annotation:

public @interface SubCommand {
    String value();
}

Command annotation:

public @interface Command {
    String value();
}
tardy delta
#

ig you need some kind of Map<String, SubCommand> to keep track of them and to select the one to call

sterile axle
#

i'll try to check later if you can't figure something out. but there are a few annotation command libs existing, you could reference them to see how they do it. ACF & Cloud come to mind. but brush's idea doesn't seem bad

tardy delta
#

im wondering what that abstract method is for

drowsy gust
tardy delta
#

their wiki is shit yes

drowsy gust
tardy delta
#

so wait each subcommand is a bukkitcommand on its own?

drowsy gust
#

1s lemme send the code

tardy delta
#

i kinda stopped messin with making my own command framework cuz it always ended up as a mess

drowsy gust
#
   @Getter private static CommandAdapter handler;

    public CommandAdapter(){
        handler = this;
    }
    private final Map<String /* SubCommand Name */, Method /* SubCommand Execution */> subcommands = Maps.newHashMap();

    public void process(Object object) {
        String name = null;
        List<String> aliases = Lists.newArrayList();
        Permission permission = null;

        Method commandFunction = null;

        for (Method method : object.getClass().getDeclaredMethods()) {
            if (method.isAnnotationPresent(Command.class)) {
                Command command = method.getAnnotation(Command.class);
                name = command.value();
                commandFunction = method;
                for (String alias : command.aliases()) {
                    aliases.add(alias);
                }
            }
            if (method.isAnnotationPresent(SubCommand.class)) {
                SubCommand subCommand = method.getAnnotation(SubCommand.class);
                subcommands.put(subCommand.value(),method);
            }
            if (method.isAnnotationPresent(Permission.class)) {
                permission = method.getAnnotation(Permission.class);
            }
        }
        Method finalCommandFunction = commandFunction;
        HomiesCommand homiesCommand = new HomiesCommand(name, aliases, null) {
            @Override
            protected void execute(CommandSender sender, String[] args) {
                try {
                    finalCommandFunction.invoke(this,sender,args);
                } catch (IllegalAccessException | InvocationTargetException e) {
                    throw new RuntimeException(e);
                }
            }
        };
        if(permission != null){
            homiesCommand.setPermission(permission.value());
            homiesCommand.setPermissionMessage(MessageUtils.format(permission.message()));
        }
        PluginManager.getInstance().register(homiesCommand);
    }
#

this where i tried alot of shitty codes to make it work

#

and never did

tardy delta
#

uhh

drowsy gust
#

idk what i was doing tbh i tried evreything i could to make it work

#

i'ma recode this one

#

any tips ?

#

cuz idk how the params of the invoke() method works

tardy delta
#

it takes in the parameters of that method

drowsy gust
#

aight cool

#

so for each subcommand i think i'll let it take the CommandSender and String[] for arguments

#

but i have a qustion

#

what if the subcommand have to be smth like a player name

#

how can i define that

gleaming grove
#

I guess player name will be always parameter for example /command <playername> subcommand, so in that case you need to make system that will treat second parameter as subcommand

drowsy gust
gleaming grove
#

Ye like each command could have list of arguments <Name,Type>

drowsy gust
#

can u explain more cuz i've been working on this for like 8 hours now i'm losing my focus

tardy delta
#

i just tried smth rq but its about as what you have lol

drowsy gust
gleaming grove
tardy delta
#

?paste

undone axleBOT
drowsy gust
gleaming grove
#

in case of learning

#

w8 a moment

tardy delta
#

looks like brigadier

drowsy gust
#

i think i'm going to fix it

regal scaffold
#

How can I make my own player object that also works as a Bukkit player

#

If I extend I need to implement all methods, is that the correct way?

frail gazelle
#

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

trying to make a plugin with a custom configuration file where when a player joins the server, it logs their uuid along with a trample value of true. the plugin should append a uuid when another player joins as well. though when i restart my plugin and rejoin on the first account, all other entries are gone. how do i prevent this?

tardy delta
regal scaffold
#

Hmmmm

#

I need to add some stuff to a existing player

#

Fields specifically

#

Like, lives, killcount, etc

tardy delta
#

i just created a wrapper which wraps a player uuid and adds playerdata my plugin uses

regal scaffold
#

That would be great to have something to go on

regal scaffold
#

Thanks! Much appreciated

regal scaffold
drowsy gust
#

i can't send pictures ?

regal scaffold
#

What's the difference between adding all that to KindgomPlayer

tardy delta
#

more organized than just throwing a bunch of maps in my player wrapper

regal scaffold
#

Ah gotcha

#

Perfect

tardy delta
#

it probably had other reason too, i believe it was wrapped in a AtomicReference<T> in the first case too but i removed that

regal scaffold
#

I see

#

But technically

#

Everything in both classes

#

Is accessible by any of your kingdomplayers

#

So it would be the same thing putting it in 1

tardy delta
#

yes

drowsy gust
#

back

#

i think i can fix it if i figure out how i can do these 3 il things

drowsy gust
tardy delta
#

?img

undone axleBOT
tardy delta
#

same link whatever

drowsy gust
#

i think i need to register each sub command into a map or smth that takes @SubCommand as a key and the method of it as a value

#

so i can call invoke using @SubCommand object from the subcommands list

regal scaffold
#

Fourteen

drowsy gust
#

what do u think guys

gleaming grove
# drowsy gust both i wanna improve my skills with annotations & i'll use it in a simple core ...
{
      public interface CustomCommand
    {

        boolean invoke(CommandSender sender, String[] args);

        String getName();

        List<CommandArgument> getArguments();

        List<CustomCommand> getSubCommands();
    }

    public interface CommandArgument
    {
        String getName();

        ArgumentType getArgumentType();
    }

    public enum ArgumentType
    {
        NUMBER, TEXT, PLAYER, COMMAND
    } 
}```  You can take this approach, so when argument type is set to `Command` you check in subcommands contains provided value and trigger it
#

ps subCommands list should be private

drowsy gust
#

w8 my brain lagged

tardy delta
#

reflections my friend

regal scaffold
#

So i'm trying to make this:

Game.class ->
- Contains stuff like
- Game state
- Level
- GamePlayers

GamePlayer.class ->
- Contains stuff like
- KillCount
- DeathCount
- etc

If I want to include something like you did Bossbar in GamePlayer.class

How can I read what level i'm on from Game.class since it's being stored there

drowsy gust
#

the last two cells just broke

gleaming grove
#

make some fancy method like addArgument()

regal scaffold
#

Do I need to make a absract class that's parent to both game.class and gameplayer.class?

tardy delta
#

what

drowsy gust
#

so wait CommandArgument what refers to ?

#

subcommands

tardy delta
#

an argument

drowsy gust
#

?

tardy delta
#

like /sethome <name> where name would be an argument with type STRING

drowsy gust
#

then what is the use of getSubCommands();

gleaming grove
#

well right, this should not be public but private

regal scaffold
drowsy gust
#

can u put it in a small exmaple i'm sorry but i can't under stand how will this work i'm tired of testing my brain broke

gleaming grove
#

but you need to keep all avaliable subcommands in list inside command class

drowsy gust
#
@Getter public class Homie
{

    private final UUID uniqueId;
    private final Player player;
    private final String name;
    @Setter private Clan clan;
    //private Group group;

    private int globalKills, globalDeaths, globalBlocksPlaced, globalBlocksBroke;

    public Homie(UUID uniqueId){
        this.uniqueId = uniqueId;
        this.player = Bukkit.getPlayer(uniqueId);
        if(this.player != null){
            this.name = player.getName();
        }else{
            this.name = Bukkit.getOfflinePlayer(uniqueId).getName();
        }

        this.globalKills = 0;
        this.globalDeaths = 0;
        this.globalBlocksPlaced = 0;
        this.globalBlocksBroke = 0;

        load();

        if(ClanManager.getBy(uniqueId) != null){
            this.clan = ClanManager.getBy(uniqueId);
        }else if(ClanManager.getByModerator(uniqueId) != null){
            this.clan = ClanManager.getByModerator(uniqueId);
        }else if(ClanManager.getByMember(uniqueId) != null){
            this.clan = ClanManager.getByMember(uniqueId);
        }

        HomiesCore.getPlugin().getPlayerManager().register(getPlayer(),this);
    }

    public void sendMessage(String msg){
        getPlayer().sendMessage(MessageUtils.format(msg));
    }
    public boolean hasClan(){
        if(getClan() == null){
            return false;
        }
        return true;
    }
    public void load(){
        try{
            ResultSet set = HomiesCore.getPlugin().getDataProvider().getResult("SELECT * FROM players WHERE UUID = '"+getUniqueId().toString()+"'");
            while(set.next()){
                this.globalKills = Integer.parseInt(set.getString("kills"));
                this.globalDeaths = Integer.parseInt(set.getString("deaths"));
                this.globalBlocksPlaced = Integer.parseInt(set.getString("blocksPlaced"));
                this.globalBlocksBroke = Integer.parseInt(set.getString("blocksBroke"));
            }
        }catch (SQLException e){
            e.printStackTrace();
        }
    }
}
tardy delta
#

How can I read what level i'm on from Game.class since it's being stored there
whats that supposed to mean?

#

ig you need to read properties from that other class?

regal scaffold
#

Yes

#

Like the structure is what I sent

tardy delta
#

ig let game store a map<gameplayer, gamedata> or smth

regal scaffold
#

Game contains gameplayers but I need to be able to acces game property

#

Oh you’re saying do it from the game class

tardy delta
#

ig ye

regal scaffold
#

Isn’t making a parent class for both better?

drowsy gust
regal scaffold
#

And adding all the fields that must be shared there

#

Is that good practice?

#

Like an interface I believe

tardy delta
#

or create some class extending game player which stores additional session bound data for the game

regal scaffold
#

Hmmmm

#

Alright

drowsy gust
#

if anyone does can u put it in a example so hopefully i would understand

#

keep in mind i still want it to be based on Annotations

#

to avoid ton of if else statements

gleaming grove
#
        private List<CommandArgument> arguments;
        private List<CustomCommand> subCommands;

        @Override
        public boolean invoke(CommandSender sender, String[] args) {
            var index = 0;
            for(var argument : arguments)
            {
                var value = args[index];
                if(argument.getArgumentType() == ArgumentType.COMMAND)
                {
                    var subCommand = subCommands.stream().filter(c -> c.getName().equals(value)).findFirst();
                    if(subCommand.isEmpty())
                    {
                        //sub command not exists
                        return false;
                    }
                    var subCommandArgs = new String[0];
                    return subCommand.get().invoke(sender, subCommandArgs);
                }
                index ++;
            }
            return false;
        }
        
        public void addArgument(CommandArgument argument)
        {
            arguments.add(argument);
        }
        
        public void addSubCommand(CustomCommand command)
        {
            subCommands.add(command);
        }
        }```
#

here example that handle Argument type of COMMAND

remote swallow
regal scaffold
#

Epic

#

Hi

remote swallow
#

yo

regal scaffold
tardy delta
#

what fields do you need tho?

regal scaffold
#

GameState (enum)
CurrentLevel
etc

#

Stuff that goes on the game not the player

tardy delta
#

well gamestate belongs in the game class

regal scaffold
#

Indeed it's there

#

What if I put it in abstractclass AbsGame

tardy delta
#

id just make a map of gamestats objects against gameplayers

regal scaffold
#

Really

#

hmmm

#

But there's more fields

tardy delta
#

a player should not be aware of the game level, if it really needs it for some method, pass it in with dependency injection

regal scaffold
#

No but like "Level 1"

tardy delta
#

game state*

regal scaffold
#

Ok yeah

#

Man I hate the structure

#

I can't get my head around it

tardy delta
#

it just doesnt make sense to put it in a player class cuz if the player leaves the game, those stats dont make sense

regal scaffold
#

But if they leave the game then just delete his player object

#

But in the middle of the game I need to be able to update stuff for the player as he progresses

tardy delta
#

ah i thought you needed it for non game related things too

regal scaffold
#

What if I wanna do sendmessage you're on level #

#

Can't get the level# cause it's in the game class

#

I think abstract class is the right thing here

#

I think*

tardy delta
#

ig you can store the level in the player class then, did that too

#

but not the gamestate or smth

regal scaffold
#

Fair

#

Abstract classes are objects too right

tardy delta
#

those are classes

regal scaffold
#

Like, when I create a game and it calls the absClass the data will be different for each object

#

For each game object*

#

Wait ignore that I figured it out in my head

drowsy gust
#

this one

#

?

gleaming grove
#

yes

#

also it depends how far you want go with subCommand because in your implementation you can't make /command subcommand subsubcommand

drowsy gust
#

aight cool and how to hook the annotation into it by calling a new "FancyCommand"

covert yacht
#

Hello, i have two questions!

1 - Is it possible to change the skin of a player (if yes can you give me some docs or things that can help me with it)

2 - Is it possible to :

Assume there is a player A and B and C
And there are two skin 1 and 2

Player A will have a skin between 1 and 2 depending on the player looking at A

If B is watching it will be skin 1 but for C, A will have the skin B

(KInda hard to explain, I hope you understood)

glossy venture
#

you can do that with packets

#

but idk if theres an api

drowsy gust
#
package mc.homiesbase.com.handlers;

import com.google.common.collect.Lists;
import lombok.Getter;
import mc.homiesbase.com.annotations.Command;
import mc.homiesbase.com.annotations.Permission;
import mc.homiesbase.com.annotations.SubCommand;

import java.lang.reflect.Method;
import java.util.List;

@Getter public class CommandProcessor {
    @Getter private static CommandProcessor handler;

    public CommandProcessor(){
        handler = this;
    }

    public void process(Object object) {
        List<String> aliases = Lists.newArrayList();
        for (Method method : object.getClass().getDeclaredMethods()) {
            if (method.isAnnotationPresent(Command.class)) {
                Command command = method.getAnnotation(Command.class);
                for (String alias : command.aliases()) {
                    aliases.add(alias);
                }
            }
            if (method.isAnnotationPresent(SubCommand.class)) {
                SubCommand subCommand = method.getAnnotation(SubCommand.class);
            }
            if (method.isAnnotationPresent(Permission.class)) {
                Permission permission = method.getAnnotation(Permission.class);
            }
        }
    }
}
regal scaffold
#

Can I make a method in DungeonGame that allows me to get the value of a field from DungeonGameHandler from DungeonPlayer?

gleaming grove
drowsy gust
#

you have to register the DungeonPlayer in the DungeonGameHandler so you can access the DungeonPlayer methods

drowsy gust
#

i wanna use it as a Main Command system

regal scaffold
#

But that's not what I want to do

drowsy gust
#

for multiple arguments

covert yacht
drowsy gust
gleaming grove
#

with annottation that would be pretty painfull IMO, that's way people use Builder design pattern to make commands instead of annotations

drowsy gust
drowsy gust
regal scaffold
drowsy gust
#

i just need to understand the idea how would i register each subcommand and it would be easier

regal scaffold
#

Go read how he does it

drowsy gust
#

ty

carmine urchin
#

Is it possible to set the latency / ping of a player?

drowsy gust
carmine urchin
drowsy gust
#

and mostly no because it has client side things

drowsy gust
long zephyr
#

hello !
Someone knows how to translate the unicode to the icon in TabComplete ?
it shows like : /ue0003 :(

carmine urchin
regal scaffold
#

How can I access a field inside DungeonGameHandler from DungeonPlayer?

DungeonGameHandler has a list of DungeonPlayers.

For example I want to access that state field you see in the image from the DungeonPlayer

pseudo hazel
#

well youdneed a reference to the dungeon handler

regal scaffold
#

Is that better than making another class that is parent to both gamehandler and player?

#

Like sort of this

pseudo hazel
#

wlso how did you make those diagrams, can intellij generate those 😮

regal scaffold
#

yeah

#

But I'm still confused I can't wrap my head around it

pseudo hazel
#

i would say it depends on the field but generally making these endless handlers gets annoying

regal scaffold
#

A gameHandler has a list of dungeonplayers. Those players all belong to the same game

pseudo hazel
#

like for example what field do you need

regal scaffold
#

lets say I add

#

Level

#

int level

#

to gamehandler

pseudo hazel
#

like maybe it would just be fine to pass the dungeon handler to the player constructor and have it be a property of the player

regal scaffold
#

Hmmmm

pseudo hazel
#

then you can just do player.dungeon.level

regal scaffold
#

wait no you mean I would do

#

dungeonHandler.getLevel

#

Man that feels like a bad structure idk why maybe Im overcomplicating it

hybrid spoke
#

in game development you need one class that knows everything which is normally the environment

#

f.e. world or in your case the dungeongame

#

store the players there and get them by it

#

i wouldnt do a handler

pseudo hazel
#

well in your case it feels like level should be in player

regal scaffold
#

No because a game can only have 1 value for level

hybrid spoke
#

player shouldnt know that any handler or whatever exists

regal scaffold
#

Ok so yopu're saying god

#

This structure is better

#

And make methods to access

#

Arrow means extend btw not sure if everyone knows that

#

DungeonGame is also a abstract class

pseudo hazel
#

first off make it an interface xD

#

then we are talking

regal scaffold
#

Why

hybrid spoke
#

why is the Player a dungeongame

regal scaffold
#

I need method declarations

pseudo hazel
#

but then its just a glorified version of what I said

hybrid spoke
#

or am i understanding something wrong

regal scaffold
#

Yeah it's not cipher I just wouldn't know how to do it

#

Nono you're right actually

#

That's wrong

hybrid spoke
#

composition over inheritance

regal scaffold
#

DungeonPlayer shouldn't extend dungeongame yes

#

So you say

hybrid spoke
#

player is not a game, it has a game

pseudo hazel
#

you need to know what info the player needs and how they get it

regal scaffold
#

Wait give me 2 mins to change the diagram

hybrid spoke
#

merge game and handler and voila, you have a central point for your stuff

regal scaffold
#

Isn't that the same as just removing dungeongame

pseudo hazel
#

yes

hybrid spoke
#

most likely

pseudo hazel
#

dungeon game in this example serves no purpose

hybrid spoke
#

just that dungeongame is more speaking than "handler"

regal scaffold
#

Ok good i'll remove that

#

Now once again, how can a player get a field from the DungeonHandler

#

Does it have to be passed a parameter?

#

Only way>?

pseudo hazel
#

in my plugin the game there can only be one of my game so I just get it like a singleton, that way I can access it from everywhere xD

hybrid spoke
#

what exactly are you trying to get

regal scaffold
#

I'm adding a int level

#

to Gamehandler

#

Because the level is the same for every players

#

Like a team game of sorts

pseudo hazel
#

what does the player do with this value

regal scaffold
#

All move together

#

Display it

#

In a fucking bossbar

#

LMAO

#

All for a bossbar

#

I just remembered why I needed it....

#

Been at this for 30 minutes...

pseudo hazel
#

so why is the player the one that keeps the bossbar

hybrid spoke
#

why would your game player need it then?

regal scaffold
#

um

#

I know I have a reason

#

Wait

#

Gotta remember

pseudo hazel
#

I would make it so the dungeon ahndler actually pusher bossbar updates to all gameplayers

regal scaffold
#

Hm

#

That's actually better...

pseudo hazel
#

and any data from player to the handler can be done using events

hybrid spoke
#

if even

regal scaffold
#

Alright so lastly

hybrid spoke
#

i would seperate that

regal scaffold
#

Technically a DungeonPlayer isn't a Player right

#

In spigot eyes

hybrid spoke
#

having a bukkit scheduler which does that and accessing the game

regal scaffold
#

How do I make DungeonPlayer have Player methods tho

hybrid spoke
#

you dont

#

you map them

pseudo hazel
#

wdym by player methods

hybrid spoke
#

or give the dungeonplayer a uuid

pseudo hazel
#

it would have dungeonplayer methods

hybrid spoke
#

so you can access his bukkitplayer at any time

regal scaffold
#

Is it not better to have DungeonPlayer also be a Player?

pseudo hazel
#

and a dungeon player can get the actual player in some way

regal scaffold
#

Then I could use DungeonPlayer for like even DungeonPlayer.sendMessage

pseudo hazel
#

well you cant do that easily

regal scaffold
#

You're saying add a getBukkitPlayer(DungeonPlayer) type of stuff

pseudo hazel
#

no

hybrid spoke
#

no im saying that your dp could hold internally his own player instance

pseudo hazel
#

your dungeonplayer class needs a way to get the player that belongs to the dungeon player object

regal scaffold
#

Oh

#

Alright I understand that part

pseudo hazel
#

and then any actions from the handler to the player should be going through the dungeonplayer

regal scaffold
#

So maybe merge playerdata with dungeonplayer and add Player player as a field

hybrid spoke
#

from where comes the merge now

#

i would keep it like this

gleaming grove
regal scaffold
#

Ok

#

Yes

#

Alright so let me sed what I changed I think we good now

gleaming grove
#

how to open it? or it's only premium intelji feature

pseudo hazel
#

I mean to be conpletely honest imo playerdata is redundant and could be inside dungeonplayer

#

but thats up to you

hybrid spoke
#

better to have it then not

pseudo hazel
#

why

#

just split it if its gets too big

hybrid spoke
#

i would rather have my dto extra than transient everything in terms of jdbc

#

also its a nice seperation

pseudo hazel
#

in terms of what?

hybrid spoke
#

saving the data

regal scaffold
#
public class DungeonGameHandler extends DungeonGame {

    int dungeonGameID;

    Difficulty difficulty;
    State state;
    List<DungeonPlayer> players;
#
public class DungeonPlayer {

    private Player player;
    private final PlayerData playerData;
    private final transient BossBar levelBar;


    public DungeonPlayer(Player player) {
        this(player, new PlayerData());
    }
}

tardy delta
#

isnt your gamestate in the dungeongame?

pseudo hazel
#

meh fair enough

regal scaffold
#
    private int killCount;
    private int deathCount;
    private boolean isAlive;
    private int lives;

    public PlayerData() {

    }
}
#

Is that too badf

#

Yes

#

Oh wait never changed that

hybrid spoke
pseudo hazel
#

yes exactly thats what I would put into the dungeonplayer

hybrid spoke
pseudo hazel
#

but like are these values just for one game or like a scoreboard thing

regal scaffold
#

Wait wait 1 min fixing all

#
public class DungeonGameHandler extends DungeonGame {

    int dungeonGameID;

    Difficulty difficulty;
    State state;
    List<DungeonPlayer> players;

    public void addPlayer(DungeonGameHandler gameHandler,Player player) {
        players.add(new DungeonPlayer(gameHandler, player));
    }
}
public class DungeonPlayer {

    private Player player;
    private final PlayerData playerData;
    private final DungeonGameHandler dungeonGameHandler;


    public DungeonPlayer(DungeonGameHandler gameHandler, Player player) {
        this(gameHandler,player, new PlayerData());
    }

    public DungeonPlayer(DungeonGameHandler gameHandler, Player player, PlayerData playerData) {
        this.player = player;
        this.playerData = playerData;
        this.dungeonGameHandler = gameHandler;
    }

}
public class PlayerData {
    private int killCount;
    private int deathCount;
    private int lives;

    public PlayerData() {

    }
}
#

I think that makes sense now

#

At least to my peanut brain it does

hybrid spoke
#

yeah well no

regal scaffold
#

LOL

#

I want to delete DungeonPlayer if they leave the game

hybrid spoke
#

why does your player hold a handler now

pseudo hazel
#

why is dungeon game a parent of dungeon game handler

hybrid spoke
#

and your addPlayer gets a handler?

regal scaffold
#

Oh true we just said we don't need a handler

hybrid spoke
regal scaffold
#

Yes yes

#

Alright I removed all that

#

Is that a good base

hybrid spoke
#

also i would rename your handler class to the actual game class

regal scaffold
#

Fair

pseudo hazel
#

well yeah I would rename dungeonhandler to dungeongame and remove the old dungeongame as that was empty

tardy delta
#

whats in your dungeongame class

regal scaffold
#

Yup just did

pseudo hazel
#

like he said xD

regal scaffold
#

Currently full deleted

#

So void

hybrid spoke
regal scaffold
#

Alright I think i finally got the structure down

#

Thanks for the help and the patience and I apologize

hybrid spoke
#

you're welcome

pseudo hazel
#

np

regal scaffold
#

Now some extra questions if you're bored of me yet:

All game related stuff goes straight in the dungeonGame:
---> Gamestate
---> Manage the game
---> etc

DungeonGame has a runnable task to check for the game states and do stuff accordingly
---> Does game logic also go in there?
---> Event listeners

#

And some method to "enable" the game to start the task

atomic swift
#

if i have event.getPlayer().setWalkSpeed((float) getConfig().getInt("kot.spawn-walkspeed")); and the speed in config is 0.7 it wont let the player move

frail gazelle
#

custom config file resets on restart

regal scaffold
#
    public void startDungeon(Player player) {
            new BukkitRunnable() {
                @Override
                public void run() {
                    if (!isEnabled()) {
                        ChatManager.sendMessage(player, "This dungeon is not enabled!");
                        return;
                    }
                }
            }.runTaskTimer(plugin, 100, 100);
        }

How can I make it to if the condition is not met it stops running repeating tasks until it's called again?

#

Would cancel() stop the tasks completely?

#

Ok perfect! Thanks

atomic swift
#

any idea?

sterile token
#

Is posible to disable chest open sound?

sterile token
#

I found a method called Entity#setSilent()

remote swallow
#

i dont think a chest is an entity

atomic swift
sterile token
#

oh ok

eternal oxide
#

Has anyone noticed any issue with the Spigot logger? ie not able to set to Level.FINE ?

#

I set the level to FINE but it doesn't actually show anything I output to FINE

#
System.out.println("++++++++++++++++++ " + GroupManager.logger.getLevel());
GroupManager.logger.fine("Found an " + result.resultType + " for " + permission + " in group " + result.owner.getLastName());```
#

No FINE logging for fine

dire marsh
#

it doesnt use it

eternal oxide
#

it used to

bold vessel
#

Hi, i use intelij idea and i need to add okhttp to my project (in my pom.xml) but it doesnt work

#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>fr.steelfri</groupId>
    <artifactId>SteelfriStaff</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>SteelfriStaff</name>

    <description>Plugin Staff</description>
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>19</source>
                    <target>19</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
        </artifactId>
        <version>1.19.3-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>okhttp</artifactId>
        <version>4.9.0</version>
    </dependency>
</dependencies>
        </project>
#

this is my pom.xml

remote swallow
#

did you reload maven?

bold vessel
#

how ?

remote swallow
#

on the right you should see a maven tab, open that then press the circle type thing far left of the top of that pane

bold vessel
#

okk i find it

vague bolt
#

The approach that I took for this was to implement my own custom IInventory using nms that wraps the player's storage contents and armour contents. It's backed by the exact same list instances, so changes the player makes are reflected directly.

quaint mantle
#

Hey all, how can I make a sort of private world for a player? Sort of how in skyblock each player gets their own little world, I want to do the same here.

minor shell
#

What is the best method to handle configs with the newer built in methods supporting comments for both new versions while still supporting old versions? Has anybody made a config manager utility class? Should I not worry about pre 1.18 versions?

sterile token
#

@minor shell I have my own FileManager for that. Do you want to take a look

livid dove
#

Devs help me out, why would a player hypothetically be pining another a server at the same time as trying to join mine?

#

they keep crashing but ive noticed in their logs they try pinging 2 servers at the same time

wet breach
#

Pining? Do you mean pinging?

livid dove
#

Assume this guy was doing something dodgey

#

cause they didnt even know where logs were

#

so it might be a "using dodgey thing, but didnt know much about the back end"

wet breach
# livid dove

Server list in the client pings all servers visible at the time on the client.

regal scaffold
#

Hey

livid dove
#

he had already been able to log on

wet breach
#

Ok? Not sure what that has to do with pinging servers in your saved list of servers

livid dove
#

Im just trying to figure out why, the day I turn the anti xray on this guy in particular be having issues server side

wet breach
regal scaffold
#

My plugin is currently getting loaded on startup because it contains a world generation feature.

But I also need to create more worlds, I know I have to wait until the first world is setup. How can I do that from onenable

regal scaffold
#

jeffLib has getLifePhase() but I have no clue where I could add it to

remote swallow
#

@tender shard jefflib

regal scaffold
#

He's sleeping I think

#

I mean if I can do it without jefflib idm

remote swallow
#

normally isnt

livid dove
regal scaffold
#

I know getLifePhase() returns the server state I just don't know where I would call it

remote swallow
regal scaffold
#

yessir

livid dove
regal scaffold
#

There you go exactly what I need

wet breach
#

It gets called when the server is finished loading

regal scaffold
#

Thanks frost

#

That's after all plugins are loaded correct

remote swallow
wet breach
livid dove
wet breach
#

Also note it is called when reload is used too

#

Alright afk again. Good thing i popped in when i did uwu

remote swallow
livid dove
#

they sent me a screenshot of the log

#

this is a player who doesnt code

#

.....

#

JDK 17 is in the background

remote swallow
#

the jre isnt distributed anymore iirc

#

the jdk is required

hazy parrot
#

If that is true its dump

rotund ravine
#

It is true

livid dove
eternal oxide
#

I'm going to guess incompatible hacked client

rotund ravine
remote swallow
livid dove
remote swallow
#

as in?

hazy parrot
#

Why would you need developer kit to run app lmao

rotund ravine
#

Cause he just installed it and pressed the create shortcuts option? @livid dove

rotund ravine
hazy parrot
rotund ravine
#

It’s easier to just bundle it in one place than split it.

livid dove
#

I dont think you are quite listening here. This is a player who didnt even know where the logs for minecraft were

rotund ravine
#

Plus java 9+ allows you to bundle a minimal jre in your distributed jars iirc.

rotund ravine
#

He installed java

#

It is on his desktop

livid dove
#

What scenario made him install java?

remote swallow
#

playing minecraft

rotund ravine
#

He needed to run the server obviously

remote swallow
#

iirc mc doesnt come with java anymore

rotund ravine
#

@remote swallow it does afaik

remote swallow
#

hm weird

#

everytime i installed it i also had to install java

livid dove
#

Welp turns out he's never owned a private server (he hasnt clocked on i saw the jdk lol)

#

So erm, alternative theories?

#

:L

rotund ravine
#

What’s the issue? @livid dove

livid dove
rotund ravine
#

K. And whah’s the last thing in the logs?

livid dove
rotund ravine
#

Oh, he probably just downloaded it to desktop @livid dove

remote swallow
#

or installed it with fabric

#

and downloaded it with fabrif

#

i cant english

rotund ravine
#

@livid dove Is the last “Can’t ping” your server ip?

remote swallow
livid dove
#

ours

#

and a random one

rotund ravine
#

Does his game crash or does it simply go back to his server list.

livid dove
#

booted as far as i know

rotund ravine
#

M8

#

Crash or to server ip

#

Server list*

#

Booted can mean both

livid dove
#

when I say booted i meant server list

rotund ravine
#

Alright.

#

Have him run a speedtest

livid dove
#

other servers are fine

remote swallow
livid dove
#

*other servers are fine

rotund ravine
#

Still want to see it.

remote swallow
rotund ravine
#

Which version is he running snd which version are you running? Mc-version

livid dove
#

I'll find out in a tiny while

#

i'll be real guys, only thing giving me pause is the only other guy who has had this problem is a 2b2t player who's had half his group caught for hacking so far xD

#

so for em both to have the same issue on the same day i turned anti xray on is erm

#

yeah

#

xD

rotund ravine
#

Get him to tell you the exact version of his mc. Fabric etc.

regal scaffold
#
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.tomisanhues2.dungeonmaster.Dungeonmaster.getCommand(String)" is null
remote swallow
#

did you add to plugin.yml

regal scaffold
#

This load: STARTUP is annoying to deal with...

#

Oh you're right lol

#

I blame alex for convincing me not to use the framework I was using

remote swallow
#

icl im with him

livid dove
#

:L

remote swallow
rotund ravine
regal scaffold
#

lol fair

#

How can I define a method that would go here

#

What does that even mean

#

plugin.getGameList().get(lobby - 1).addPlayer(p).HERE

remote swallow
#

where

regal scaffold
#

Where it says here

#

In call caps

remote swallow
#

in what context

#

what is getGameList

regal scaffold
#

Returns a List<games>

sterile token
regal scaffold
#

It's not actually that

remote swallow
#

im gonna guess that means it adds a player then .HERE means something you do

regal scaffold
#

It is named uppecase

#

I mean I want to replace .here with

#

.teleport() and automatically teleport the player too

remote swallow
#

make the addPlayer method do thant

regal scaffold
#

I thought about that too

#

Yeah i'll just do that

#

Was just curious tbh

#

Like what is it

remote swallow
#

or add a .teleportPlayers() method that teleports all players

regal scaffold
#

Like just to know. where would a method have to go to be able to add it there

remote swallow
#

same place you have addPlayer

regal scaffold
#

ooooooooo

#

I see now

#

Alright alright thanks

remote swallow
#

and make sure .addPlayer returns the instance of that class

regal scaffold
#

I just made him teleport on add anyways

#

But I was curious

rotund ravine
#

Create a wrapper or smth @regal scaffold

harsh badge
#

If I send my timings report, can someone help me figure out ways to make my plugin more efficient? There are lots of lag spikes

rotund ravine
#

Maybe

quaint mantle
#

@EventHandler
    public void onShoot(PlayerInteractEvent e) {
    Player p = e.getPlayer();
    if (p.getInventory().getItemInMainHand().getItemMeta() != null) {
        if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            Arrow bullet = (Arrow)p.getWorld().spawn(p.getEyeLocation(), Arrow.class);
            bullet.setShooter((ProjectileSource)p);
            bullet.setVelocity(p.getLocation().getDirection().multiply(4.5D));
            bullet.setDamage(5.0);
            PersistentDataContainer bulletPDC = bullet.getPersistentDataContainer();
            bulletPDC.set(new NamespacedKey(Nebula.getPlugin(), "a8pistol"), PersistentDataType.STRING, "shot");
            p.sendMessage("Sent via onShoot event" + String.valueOf(bulletPDC.getKeys()));
            PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(bullet.getEntityId());
            ReflectionUtils.sendPacket(p, packet);

        }```

Hey all, this little event checks for when a player shoots with anything rn, but as you can see, im setting the pdc of the arrow to a value of shot, but in a later event when i check if that arrow has a pdc, its empty, any ideas?
harsh badge
#

It's an arena based pvp duels server. As more players are dueling there are more maps being created so I decided to paste x amount of maps at the beggining so that way there didn't need to be pasting all of the time. But i'm unsure of other ways to lower the lag

rotund ravine
#

TheBridgeServerUtils is sync loading a lot of chunks.

quaint mantle
rotund ravine
#

Tried using metadata instead?

quaint mantle
#

wdym?

#

What exactly is metadata? Another way to store data in stuff?

quaint mantle
# quaint mantle What exactly is metadata? Another way to store data in stuff?

Did some research and fixed some stuff up:

i set the metadata to have a key of a8bullet and in the second event which checks for when it gets shot, i check if the metadata exists but it never passes the if statement so it doesnt:

            bullet.setMetadata("a8bullet", new FixedMetadataValue(Nebula.getPlugin(), "a8shot"));
``` First event here

```java
if(e.getEntity().hasMetadata("a8bullet"))```

second event here
#

just closed my ide, i think it was projectilelaunchevent

rotund ravine
#

@quaint mantle tried using the consumer inside the spawn function?

harsh badge
subtle temple
#

anyone have experience updating a block? I am trying to make all crops grow to max age. I am not seeing anything happen after setting age. trying to update state didn't do anything either

HashSet<Block> nearbyBlocks = getNearbyBlocks(player, 5);
for (Block block : nearbyBlocks) {
    if(block.getBlockData() instanceof Ageable ageable) {
        ageable.setAge(ageable.getMaximumAge());
        block.getState().update();
    }
}                  
eternal oxide
#

block.getState().update(); will wipe any changes you made

#

probably set teh BlockData back to the block

subtle temple
#

thank you!

regal scaffold
#

Are bossbar titles editable and autoupdate?

subtle temple
#

changed to block.setBlockData(ageable);

regal scaffold
#

What if I'm changing the progress ondeathevent

#

Do i still need a scheduler?

#

Ummm no comprende

#

Display total kills

final monolith
#

Guys its possible to remove that original-... .jar file when maven compile without deleting the old .jar?

#

i dont like to delete the old .jar every time i need to compile

#

💀

remote swallow
#

you should really care about original-stuff or stuff-shaded

#

because those would be the incorrect jar to use

final monolith
#

it generates me only two jars

remote swallow
#

how are you building

final monolith
#

a correct jar, and that sh original-

final monolith
remote swallow
#

do you have the shade plugin

final monolith
#

yeah

#

its shading

remote swallow
#

dafuq

#

that doesnt add up

#

if you relocate/shade stuff it should also generate the-shaded jar

final monolith
#

the shaded one only appears if i try to compile when the original- and the correct one jar already exists

remote swallow
#

that might be why

#

use the jar with no additions

#

it will automatically delete those

#

so recompiling can just be invocing package

final monolith
#

What you mean?

remote swallow
#

use the jar called project-version.jar not original-project-version.jar

#

and maven will automatically delete any present jars of that

#

when maven package is invoked

final monolith
#

ok

#

the mid one is the correct, but its really required to have that 3 jars on my project file?

remote swallow
#

thats just maven

#

ive got no idea

final monolith
#

lol damn english

remote swallow
#

only way i know that would do that is build elsewhere

fierce whale
#

Is there a way to create world in async?

eternal oxide
#

no

final monolith
fierce whale
#

Ahha I got it 🙂

quaint mantle
#

i have no idea what "this" means, are you able to explain what hes talking about?

#

its probably better if i explain what im doing. I want the bullet (which i identify by its pdc or metadata or wtv) to have a trail following it since i make the arrow invisible so you can tell if its a bullet or not

quaint mantle
#

alr fixed it by just spawning particles while the arrow isnt dead or not on the ground

#

nope didnt work, just infinitely spawns particles, no idea

quaint mantle
#

I keep hearing about how packet based plugins are best for high player counts, how does that work and is there any where I can read about that

rotund ravine
#

?paste

undone axleBOT
tender shard
#

UGH UGH UGH

#

I had a bad dream

remote swallow
#

what about

tender shard
#

I dreamt about someone doing this

<dependency>
  <groupId>org.example</groupId>
  <artifactId>something</artifactId>
  <version>1.0-SNAPSHOT</version>
  <scope>system</scope>
  <systemPath>C:\Users\Someone\.m2\repository\org\example\something\1.0-SNAPSHOT\something-1.0-SNAPSHOT.jar</systemPath>```
remote swallow
#

who was it

#

what was there name

tender shard
#

i dont know

remote swallow
#

think

#

hard

tender shard
#

all I know is that someone did it

#

probably it was geol

remote swallow
#

@quiet ice bad

#

get out

remote swallow
orchid gazelle
#

bonk

tender shard
#

well okay I know why you hate yourself. because you do stuff like this

#

and i stiiiiiiiiiiiiiillll havent fouuuuuuuuuund what im loooking foooooooooor

remote swallow
#

is it tobacco

tender shard
#

omg after 4 days, my itunes backup rsync is complete

remote swallow
#

i forgot you were doing that

wild bloom
# tender shard why do you hate yourself

The only difference is that I usually do

<dependency>
  <groupId>org.example</groupId>
  <artifactId>something</artifactId>
  <version>1.0-SNAPSHOT</version>
  <scope>system</scope>
  <systemPath>${user.home}\.m2\repository\org\example\something\1.0-SNAPSHOT\something-1.0-SNAPSHOT.jar</systemPath>
tender shard
#

are you a bit stupid or sth?

tender shard
#

lol

wild bloom
#

maybe

tender shard
#

you should use more properties

wild bloom
#

but it works

tender shard
#

<dependency>
<groupId>${the.groupId.of.the.dependency.I.use</groupId>

#

etc

#

lol

buoyant viper
tender shard
#

10.0.0.X = pog

#

some people use 192.168.X.X and i dont get it

remote swallow
#

hippity hoppity your ip is now my property

tender shard
buoyant viper
remote swallow
tender shard
#

ok

#

lol

remote swallow
#

i say that to every ip i see

buoyant viper
#

like my old routers use 192.168.x.x

#

and newer one uses 10.0.0.x

tender shard
#

my router uses 192.168.178.1

#

and that's so stupid

remote swallow
#

also wheres your i still dont care about cookies addon

tender shard
#

why not just

#

10.0.0.1

buoyant viper
#

yeah no mine were like 192.168.1.x

buoyant viper
#

i just blindly accept all

remote swallow
#

last night i had the strangest dream

buoyant viper
#

i sailed away to china

#

in a little row boat to find ya

remote swallow
#

lmfao

buoyant viper
#

u said u had to get ur Laundry done

tender shard
#

how often can I reheat chicken soup before it gets toxic?

#

I think I have heated it at least like 10 times by now but never ate it

buoyant viper
#

why dont u pour it into a bowl and heat up the bowl

wild bloom
remote swallow
#

my mom follows like, cook it from frozen/chilled once and reheat it once

buoyant viper
#

yeah

wild bloom
# wild bloom

unfortunately I'm unable to do the same with mvn plugins

buoyant viper
#

my mom follows if u reheat food u cant store it again

#

like microwave reheat

remote swallow
#

yeah

buoyant viper
#

idk about reheating w like oven or stove tho

remote swallow
#

im pretty sure that would still be reheating it more than once

tender shard
#

thats not how it works

remote swallow
#

FUCK YEAH

#

AMAZON WORKERS WENT ON STRIKE

buoyant viper
#

r u continuously reheating the same bowl of soup in rapid succession?!

remote swallow
#

i bet you put hot food in the fridge

buoyant viper
#

how fucking frozen was ur Soup

buoyant viper
remote swallow
#

good

#

hot food no fridge

#

cold food fridge

distant ridge
#

hey i'm using reflect to try to register a custom /tp command but minecraft keeps using the default tp command. anyway i can get it to use the reflect /tp command instead?

chrome beacon
#

Why are you using reflection for commands

tender shard
#

why do people still not use ACF

distant ridge
#

to dynamically load in all the plugin's commands instead of declaring them all individually. makes it easier to rapidly load commands.

chrome beacon
#

Declare them individually

tender shard
#

apparently it does not really make it easier

distant ridge
#

its similar to what plugins like CMI use

chrome beacon
#

CMI is a pain

tender shard
#

CMI is one of the worst plugins

#

my bug report from dec 2021 still hasnt been answered

distant ridge
#

wow, well if one of the top selling plugins is a terrible plugin i hope to be half as bad as CMI

tender shard
#

thats not hard. just answer to bug reports within a year and you're already better

distant ridge
#

its nice to know that ya'll rather criticize than offer help in a help channel

chrome beacon
#

If you want to fix your issue you need to reflect a bit more

tender shard
#

use java code blocks pls

distant ridge
#

there's also like 5 other command registration and processing classes that handle the dynamic loading

#

plus annotations

tender shard
#

where is this weird CommandInfo annotation coming from?

earnest forum
#

also u dont need to include the imports

tender shard
#

how do you register that command

remote swallow
#

naming conventions please

distant ridge
#
                        final CMD coreCommand = new CMD((CommandBase)entry.getValue().getConstructor((Class<?>[])new Class[0]).newInstance(new Object[0]), str, annotations);

                        pluginCommandList.add(annotations.command());
                        registerCommand(coreCommand);

    private void registerCommand(CMD coreCommand) {
        CommandInfo ci = coreCommand.getInfo();

        // Check if there is a module required
        if(ci.module().length() > 0) {
            if (!modulesConfig.getBoolean(ci.module())) return;
        }

        //If there is no command then use the aliases as command
        if(ci.command().length() == 0) {
            for(String alias: ci.aliases()) {
                CommandRegister cr = new CommandRegister(coreCommand, alias, ci.args(), ci.description());
                cr.register();
            }
        } else {
            CommandRegister cr = new CommandRegister(coreCommand, ci.command(), ci.args(), ci.description(), List.of(ci.aliases()));
            cr.register();
        }
    }
chrome beacon
#

?paste

undone axleBOT
solemn frigate
#

sup fellas, this is more of a general java question, but im trying to remove an element from a hashmap and then iterate over the hashmap and change the indexes of the elements. but, i keep getting a ConcurrentModificationException. here's my code: https://paste.md-5.net/omuyekuyam.js

tender shard
solemn frigate
#

oh

#

ig that makes sense

tender shard
buoyant viper
tender shard
#

i have no clue

#

their run(...) method even takes in the plugins main instance

#

it's really weird

distant ridge
#
    public void register() {
        ReflectCommand cmd = new ReflectCommand(this.command);
        if (this.description != null) cmd.setDescription(this.description);
        if (this.alias != null) cmd.setAliases(this.alias);
        if (this.usage != null) cmd.setUsage(this.usage);
        if (this.permMessage != null) cmd.setPermissionMessage(this.permMessage);
        getCommandMap().register("EpicCore", cmd);
        cmd.setExecutor(this);
    }

    final CommandMap getCommandMap() {
        if (cmap == null) {
            try {
                final Field f = Bukkit.getServer().getClass().getDeclaredField("commandMap");
                f.setAccessible(true);
                cmap = (CommandMap) f.get(Bukkit.getServer());
                return getCommandMap();
            } catch (Exception e) { e.printStackTrace(); }
        } else if (cmap != null) { return cmap; }
        return getCommandMap();
    }```
#
    private final class ReflectCommand extends Command {
        private CommandRegister exe = null;
        protected ReflectCommand(String command) { super(command); }
        public void setExecutor(CommandRegister exe) { this.exe = exe; }
        @Override public boolean execute(CommandSender sender, String commandLabel, String[] args) {
            if (exe != null) { return exe.onCommand(sender, this, commandLabel, args); }
            return false;
        }

        @Override  public List<String> tabComplete(CommandSender sender, String alais, String[] args) {
            if (exe != null) { return exe.onTabComplete(sender, this, alais, args); }
            return null;
        }
    }

    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        cmd.getCoreClass().run(EpicCore.getInstance(), sender, command, label, args);
        return true;
    }

    public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
        CommandInfo ci = cmd.getInfo();

        if(ci.tab().length > 0) {
            for(String tab: ci.tab()) {
                switch(tab) {
                    case "playername":
                        List<String> tabSort = new ArrayList<>();
                        for(Player player: Bukkit.getOnlinePlayers()) {
                            tabSort.add(player.getName());
                        }

                        return StringUtil.copyPartialMatches(args[0], tabSort, new ArrayList<>());
                }
            }
        } else {
            return cmd.getCoreClass().tab(sender, command, label, args);
        }
        return null;
    }```
#

but realistically this all boils down to registering a command with reflect that already exists as a vanilla command not being accessible

tender shard
#

you gotta replace the existing command map's "tp" command

distant ridge
#

also the reason you do this is so you can assign dynamic aliases for all commands

#

among a slew of other reasons

tender shard
distant ridge
tender shard
#

wdym

distant ridge
#

players can't create their own commands if you use commands.yml

#

server owners*

tender shard
#

ofc server owners can

distant ridge
#

not with the plugin

tender shard
#

they just have to edit the commands.yml file

remote swallow
#

can you have bukkit

distant ridge
#

if someone creates a script in my plugin and wants to run it as /barf or the ability to add dynamic aliases for a command that can be created on the fly

tender shard
#

when was the last time that somebody said "oh I need to create a new alias for an existing command. thank god the plugin offers this itself, so I do not have to edit commands.yml" lol

#

custom aliases = use commands.yml

distant ridge
#

its less coding on my end. so i can just provide a list of aliases that can be a command

tender shard
#

less coding? you literally just sent two screens of command registration code

#

where you usually only need one line

distant ridge
#

i only have to edit / create 1 file to make a command, create the functions, or aliases. it also allows me to use wrappers so people can disable commands individually or based on the module they're in

tender shard
#

your method is just a dirty workaround to do things that bukkit can do with builtin methods

distant ridge
#

i'd rather not muddy up my main class with 100+ manual command additions

#

and since that doesn't use a framework it makes it harder to make changes en mass

tender shard
distant ridge
#

it works just not with default commands, but like you said, i can just remove the default command from the command map

tender shard
#

yeah that's what you gotta do

#

the default command map looks like this:

#

"minecraft:tp" -> something
"tp" -> something
etc

#

it includes both, the namespaced and non-namespaced commands

distant ridge
#

in the list folder it automatically adds all those commands. the 5 files on the bottom are the loader / manager. it makes the initial load a little heavy but makes everything else happen rapidly

tender shard
#

you should really think about using proper class names

distant ridge
#

and what would be a proper class name in your eyes

remote swallow
#

TpCommand

#

GmsCommand

#

?convetions

#

?conventions

tender shard
#

or CommandTp

sullen marlin
#

That's just like your opinion man

distant ridge
#

100%

tender shard
#

stop urinating on my carpet, md5

distant ridge
#

I use normal naming conventions through everything that's not dynamically loaded

distant ridge
#

as you can see with EpicCoreCommand and CommandBase, CommandInfo, etc..

tender shard
#

oh

#

wrong caption

#

yeah anyway

remote swallow
#

like essx

distant ridge
#

if its dynamically loaded, the command name is the class because i never have to reference it

tender shard
#

i wonder whether "TheDude" nickname is already taken on spigotmc

distant ridge
#

without a doubt

tender shard
#

if I'd change my name, it would be some weird movie reference

distant ridge
#

how old are these references

tender shard
#

early 80's

#

well the big lebowski is end 90's

distant ridge
#

like anyone has seen airplane

tender shard
#

by bf didnt even knew that movie existed

#

granted, he's only 20

#

and he doesnt like BTTF so yeah he's a weirdo

rotund ravine
distant ridge
rotund ravine
#

Yes

#

Make us proud

distant ridge
#

hmmm

#

    public void unregister(String cmd){
        try {
            CommandMap commandMap = getCommandMap();
            final Field f = commandMap.getClass().getDeclaredField("knownCommands");
            f.setAccessible(true);
            final Map<String, Command> commands = (Map<String, Command>) f.get(commandMap);
            commands.remove(cmd);
        }catch (Exception e){
            e.printStackTrace();
        }
    }```
#

no such field as knownCommands

buoyant viper
distant ridge
#

i guess this forum post was hella old

buoyant viper
#

or try final Field f = SimpleCommandMap.class.getDeclaredField("knownCommands"); and then continue on as u have it

distant ridge
#

yeah i've done goofed

#

i realized it after i sent it

tender shard
#

ughm

#

but you would have gotten a stacktrace if that was the problem

distant ridge
#

i did

tender shard
#

why didnt you tell...

distant ridge
buoyant viper
#

no such field kinda implies an exception thrown

tender shard
#

oh ok

buoyant viper
#

since its called NoSuchFieldException p sure lol

tender shard
#

i havent seen that

rotund ravine
#

Balls

tender shard
#

why do english speaking people always use genitals to describe things that suck

distant ridge
#

because tits

tender shard
#

you built a time machine - into a delorean?!

rotund ravine
#

Say it together

tender shard
#

einstein is so cute

distant ridge
#

the dog or the man

#

i mean either way tbh...

tender shard
#

the dog