Exemplo n.º 1
0
 /**
  * Executes the proper command within Playtime
  *
  * @since 1.3.0
  * @version 1.4.2
  *
  * @param sender The command executor
  * @param cmd The command instance
  * @param commandLabel The command name
  * @param args The command arguments
  *
  * @return Success of command, false if no command is found
  */
 @Override
 public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
     if (this.isReload(commandLabel, args) || !this.plugin.isBusy()) {
         CommandBase command = this.commands.get(commandLabel);
         if (command != null) {
             return command.execute(sender, cmd, commandLabel, args);
         }
     } else {
         sender.sendMessage(_(this.plugin.getCipher().getString("command.handler.busy")));
     }
     return false;
 }
Exemplo n.º 2
0
 public CommandHandler(Playtime plugin) {
     this.plugin = plugin;
     
     CommandBase[] cmds = new CommandBase[] {
         new PlayCommand(this.plugin),
         new DeathCommand(this.plugin),
         new OnlineCommand(this.plugin),
         new PlayTopCommand(this.plugin),
         new DeathTopCommand(this.plugin),
         new OnlineTopCommand(this.plugin),
         new PTCommand(this.plugin)
     };
     
     final CommandHandler chand = this;
     for (CommandBase cmd : cmds) {
         this.commands.put(cmd.getName(), cmd);
         this.plugin.getCommand(cmd.getName()).setExecutor(chand);
     }
 }