Class CommandManager
java.lang.Object
de.rexlcloud.core.command.CommandManager
Registers console commands of modules; get it with
CloudModule.getCommandManager().
public class MyCommands {
@CommandMethod("greet <player>")
@CommandDescription("Greets a player")
public void greet(@Argument(value = "player", suggestions = "players") String player) {
Console.info("Hello %s", player);
}
@Suggestion("players")
public List<String> players() {
return List.of("Notch", "jeb_");
}
}
getCommandManager().registerCommands(this, new MyCommands());
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCommandManager(de.rexlcloud.core.command.CommandRegistry commandRegistry) Internal: created by the master. -
Method Summary
Modifier and TypeMethodDescriptionThe command objects each module registered.voidregisterCommands(@NonNull CloudModule cloudModule, @NonNull Object object) voidunregisterAllCommands(@NonNull CloudModule cloudModule) Removes all commands of a module.voidunregisterCommands(@NonNull CloudModule cloudModule, @NonNull Object object) Removes the commands of one object.
-
Constructor Details
-
CommandManager
protected CommandManager(de.rexlcloud.core.command.CommandRegistry commandRegistry) Internal: created by the master.
-
-
Method Details
-
registerCommands
public void registerCommands(@NonNull @NonNull CloudModule cloudModule, @NonNull @NonNull Object object) - Parameters:
cloudModule- the module, for unregistering its commands when it is disabledobject- the object with the annotated methods
-
unregisterAllCommands
Removes all commands of a module. -
unregisterCommands
public void unregisterCommands(@NonNull @NonNull CloudModule cloudModule, @NonNull @NonNull Object object) Removes the commands of one object. -
getRegisteredCommands
The command objects each module registered.
-