Exemplo n.º 1
0
 @Override
 protected String executePlayer(Player p_player, String p_cmd, String[] p_args) {
   switch (p_args.length) {
     case 0:
       if (this.checkPerm(p_player, false)) {
         final Player target = p_player;
         for (Player player : p_player.getServer().getOnlinePlayers()) {
           if (player != target) {
             player.teleport(target, TeleportCause.COMMAND);
             if (msg != null) {
               player.sendMessage(ChatColor.GREEN + msg);
             }
           }
         }
         return ZeltCmds.getLanguage()
             .getString("log_port_a2m", new Object[] {p_player.getName()});
       }
       break;
     default:
       p_player.sendMessage(
           ChatColor.RED
               + "["
               + this.getPlugin().getName()
               + "] "
               + ZeltCmds.getLanguage().getString("arguments_too_many"));
       p_player.sendMessage(
           ChatColor.RED
               + "["
               + this.getPlugin().getName()
               + "] "
               + ZeltCmds.getLanguage().getString("usage", new Object[] {"/" + p_cmd}));
       break;
   }
   return null;
 }
Exemplo n.º 2
0
 public CmdPlayerToggle(
     Types p_type,
     Permission p_perm,
     Permission p_permExt,
     RequireListener p_listener,
     String p_msg) {
   super(
       ZeltCmds.getLanguage().getString("description_playertoggle_" + p_type.name().toLowerCase()),
       p_perm,
       p_permExt,
       p_listener);
   type = p_type;
   if (p_msg.isEmpty()) {
     msg = null;
   } else {
     msg = new String[2];
     String[] temp = p_msg.split("\\\\\\/", 2);
     if (temp.length == 2) {
       msg[0] = temp[0].isEmpty() ? null : temp[0];
       msg[1] = temp[1].isEmpty() ? null : temp[1];
     } else {
       msg[0] = temp[0];
       msg[1] = temp[0];
     }
   }
 }
Exemplo n.º 3
0
 @Override
 protected void executeConsole(CommandSender p_sender, String p_cmd, String[] p_args) {
   switch (p_args.length) {
     case 0:
       this.getPlugin()
           .getLogger()
           .warning(ZeltCmds.getLanguage().getString("arguments_not_enough"));
       this.getPlugin()
           .getLogger()
           .warning(ZeltCmds.getLanguage().getString("usage_Player", new Object[] {p_cmd}));
       break;
     case 1:
       final OfflinePlayer off_player = p_sender.getServer().getOfflinePlayer(p_args[0]);
       if (off_player.isOnline()) {
         final Player player = off_player.getPlayer();
         Results result = this.action(player);
         switch (result) {
           case ERROR:
             this.getPlugin()
                 .getLogger()
                 .warning(ZeltCmds.getLanguage().getString("playertoggle_error"));
             break;
           case OFF:
             if (msg != null && msg[1] != null) {
               player.sendMessage(ChatColor.GREEN + msg[1]);
             }
             break;
           case ON:
             if (msg != null && msg[0] != null) {
               player.sendMessage(ChatColor.GREEN + msg[0]);
             }
             break;
         }
       } else {
         this.getPlugin()
             .getLogger()
             .warning(
                 ZeltCmds.getLanguage()
                     .getString(
                         (off_player.getFirstPlayed() != 0
                             ? "player_offline"
                             : "player_not_found"),
                         new Object[] {p_args[0]}));
       }
       break;
     default:
       this.getPlugin()
           .getLogger()
           .warning(ZeltCmds.getLanguage().getString("arguments_too_many"));
       this.getPlugin()
           .getLogger()
           .warning(ZeltCmds.getLanguage().getString("usage_Player", new Object[] {p_cmd}));
       break;
   }
 }
Exemplo n.º 4
0
 @Override
 protected String executePlayer(Player p_player, String p_cmd, String[] p_args) {
   switch (p_args.length) {
     case 0:
       if (this.checkPerm(p_player, false)) {
         Results result = this.action(p_player);
         switch (result) {
           case ERROR:
             p_player.sendMessage(
                 ChatColor.RED
                     + "["
                     + this.getPlugin().getName()
                     + "] "
                     + ZeltCmds.getLanguage().getString("playertoggle_error"));
             break;
           case OFF:
             if (msg != null && msg[1] != null) {
               p_player.sendMessage(ChatColor.GREEN + msg[1]);
             }
             break;
           case ON:
             if (msg != null && msg[0] != null) {
               p_player.sendMessage(ChatColor.GREEN + msg[0]);
             }
             break;
         }
         return ZeltCmds.getLanguage()
             .getString(
                 "log_playertoggle_self",
                 new Object[] {type.name(), result.name(), p_player.getName()});
       }
       break;
     case 1:
       if (this.checkPerm(p_player, true)) {
         final OfflinePlayer off_player = p_player.getServer().getOfflinePlayer(p_args[0]);
         if (off_player.isOnline()) {
           final Player player = off_player.getPlayer();
           Results result = this.action(player);
           switch (result) {
             case ERROR:
               p_player.sendMessage(
                   ChatColor.RED
                       + "["
                       + this.getPlugin().getName()
                       + "] "
                       + ZeltCmds.getLanguage().getString("playertoggle_error"));
               break;
             case OFF:
               if (msg != null) {
                 player.sendMessage(ChatColor.GREEN + msg[1]);
               }
               break;
             case ON:
               if (msg != null) {
                 player.sendMessage(ChatColor.GREEN + msg[0]);
               }
               break;
           }
           return ZeltCmds.getLanguage()
               .getString(
                   "log_playertoggle_player",
                   new Object[] {
                     type.name(), result.name(), p_player.getName(), player.getName()
                   });
         } else {
           p_player.sendMessage(
               ChatColor.RED
                   + "["
                   + this.getPlugin().getName()
                   + "] "
                   + ZeltCmds.getLanguage()
                       .getString(
                           (off_player.getFirstPlayed() != 0
                               ? "player_offline"
                               : "player_not_found"),
                           new Object[] {p_args[0]}));
         }
       }
       break;
     default:
       p_player.sendMessage(
           ChatColor.RED
               + "["
               + this.getPlugin().getName()
               + "] "
               + ZeltCmds.getLanguage().getString("arguments_too_many"));
       p_player.sendMessage(
           ChatColor.RED
               + "["
               + this.getPlugin().getName()
               + "] "
               + ZeltCmds.getLanguage().getString("usage_player", new Object[] {"/" + p_cmd}));
       break;
   }
   return null;
 }
Exemplo n.º 5
0
 @Override
 protected void executeConsole(CommandSender p_sender, String p_cmd, String[] p_args) {
   this.getPlugin()
       .getLogger()
       .warning(ZeltCmds.getLanguage().getString("command_console_no_use"));
 }
Exemplo n.º 6
0
 public CmdPortA2M(
     Permission p_perm, Permission p_permExt, RequireListener p_listener, String p_msg) {
   super(ZeltCmds.getLanguage().getString("description_port_a2m"), p_perm, p_permExt, p_listener);
   msg = (p_msg.isEmpty() ? null : p_msg);
 }