Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commands dont Work #129

@xXFlyingBananaXx

Description

@xXFlyingBananaXx

Hello,
I tried to make Commands, but it didnt Work.
I didnt found any issue Report that has kind of the same Problem, this is not an JDA Issue its an JDA-Utilities Issue.
I hvae the latest Version of both, the Bot is running on a BungeeCord Plugin but that worked fine with just JDA.

So the Real Problem i guess is that the Command doesnt get registered because even on the help command it doesnt show the Command, i tried to Debug with a simple sout but it didnt Print.

Here are my 2 Classes:
Main Class:


    public static void start(){



        try {
            JDABuilder bot = JDABuilder.createDefault("");
            CommandClientBuilder builder = new CommandClientBuilder();
            builder.setPrefix("f.");
            builder.setHelpWord("help");
            builder.setAlternativePrefix("f1.");
            builder.setOwnerId("847627635324354631");
            builder.addCommand(new ServerCommand());
            builder.setActivity(Activity.playing("Joine jetzt 'Tsukimi.de'"));
            builder.setStatus(OnlineStatus.ONLINE);

            CommandClient client = builder.build();
            bot.addEventListeners(client);
            bot.build();




            BCSystems.plugin.getProxy().getConsole().sendMessage(TextComponent.fromLegacyText("§9The Discord Bot has been successfully started"));
        }catch (LoginException e){
            e.printStackTrace();
        }

    }


}```

My Command Class:

public class ServerCommand extends Command {
public ServerCommand(){
this.name = "server";
this.aliases = new String[]{"s","ip"};
this.help = "Dieser Command gibt Informationen über den Server aus";

}
@Override
protected void execute(CommandEvent event) {
    List<String> list = new ArrayList<>();

    EmbedBuilder embedBuilder = new EmbedBuilder();
    embedBuilder.setTitle("Tsukimi.de");
    embedBuilder.setDescription("Joine Jetzt mit der 1.8.8 - 1.16.5");
    BCSystems.plugin.getProxy().getPlayers().forEach(proxiedPlayer -> {
        list.add(proxiedPlayer.getDisplayName());
    });
    if (list.isEmpty()){
        return;
    }else {
        embedBuilder.addField("Online Spieler",list.toString(),true);
    }

    System.out.println("Command geht eig?");
    event.getMessage().reply(embedBuilder.build()).queue();
}

}

I hope you can help me, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions