public void registerCommands(Dispatcher dispatcher) {
if (server == null) return;
ServerCommandManager mcMan = (ServerCommandManager) server.getCommandManager();
for (final CommandMapping command : dispatcher.getCommands()) {
final Description description = command.getDescription();
mcMan.registerCommand(new CommandBase() {
@Override
public String getCommandName() {
return command.getPrimaryAlias();
}
@Override
public List<String> getCommandAliases() {
return Arrays.asList(command.getAllAliases());
}
@Override
public void processCommand(ICommandSender var1, String[] var2) {}
@Override
public String getCommandUsage(ICommandSender icommandsender) {
return "/" + command.getPrimaryAlias() + " " + description.getUsage();
}
@Override
public int getRequiredPermissionLevel() {
return 0;