Beispiel #1
0
  @Override
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    switch (args.length) {
      case 0:
        if (CommandUtils.noConsoleUsage(sender)) {
          return true;
        }

        if (!hasSelfPermission(sender)) {
          sender.sendMessage(command.getPermissionMessage());
          return true;
        }

        applyCommandAction(UserManager.getPlayer(sender.getName()));
        return true;

      case 1:
        if (!hasOtherPermission(sender)) {
          sender.sendMessage(command.getPermissionMessage());
          return true;
        }

        String playerName = CommandUtils.getMatchedPlayerName(args[0]);
        McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);

        if (!CommandUtils.checkPlayerExistence(sender, playerName, mcMMOPlayer)) {
          return true;
        }

        if (CommandUtils.isOffline(sender, mcMMOPlayer.getPlayer())) {
          return true;
        }

        applyCommandAction(mcMMOPlayer);
        sendSuccessMessage(sender, playerName);
        return true;

      default:
        return false;
    }
  }
 @Override
 public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
   if (args.length == 1) {
     if (sender instanceof Player) {
       if (!sender.hasPermission("bungeesuite.chat.command.realname")) {
         sender.sendMessage(command.getPermissionMessage());
         return true;
       } else {
         BSPlayer p = PlayerManager.getsimilarNickPlayer(args[0]);
         if (p == null) PlayerManager.realnamePlayer(sender.getName(), args[0]);
         else
           sender.sendMessage(
               ChatColor.GRAY
                   + p.getNickname()
                   + ChatColor.RESET
                   + ChatColor.GRAY
                   + " is "
                   + p.getName());
         return true;
       }
     } else {
       BSPlayer p = PlayerManager.getsimilarNickPlayer(args[0]);
       if (p == null)
         sender.sendMessage(
             ChatColor.GRAY + args[0] + ChatColor.RESET + ChatColor.GRAY + " was not found!");
       else
         sender.sendMessage(
             ChatColor.GRAY
                 + p.getNickname()
                 + ChatColor.RESET
                 + ChatColor.GRAY
                 + " is "
                 + p.getName());
       return true;
     }
   }
   return false;
 }