Multiple Commands dont work

Samyocord

New Member
Hello,

so I started getting into Nukkit-Plugin-Development. Now I've tried to add more commands than one in multiple classes.
Here is the commands-section of my plugin.yml:
Code:
commands:
  random:
    description: Wähle einen zufälligen Spieler
  addwarp:
    description: Fuege einen Warp hinzu
  warp:
    description: Teleportiere dich zu einem Warp
  sudo:
    description: Einen Spieler zwingen etwas einzugeben
This would be the register in the main class:
Code:
        getServer().getCommandMap().register("random", new RandomPlayer("random"));
        getServer().getCommandMap().register("addwarp", new AddWarpCMD("addwarp"));
        getServer().getCommandMap().register("warp", new WarpCMD("warp"));
        getServer().getCommandMap().register("sudo", new SudoCMD("sudo"))
The classes for the commands all extend the Command-Class and I've also tried adding a Message when the command is triggered, but no luck.
Hope you can help me.

Thanks,
Samyocord
 

SupremeMortal

Administrator
Staff member
If you define the commands in your plugin.yml, you will need to get the instance already created like so:
Java:
((PluginCommand<PluginClass>) this.getCommand("commandname")).setExecutor();
Replace PluginClass with your main Plugin class that extends PluginBase.
 
Top