Beispiel #1
0
 @Override
 public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
   if (cmd.getName().equalsIgnoreCase("ban") && args.length == 1) {
     Player target = Bukkit.getPlayer(args[0]);
     if (target == null) return true;
     BytecraftPlayer bt = BasicCommands.getPlayerInfo(target);
     if (cs instanceof Player) {
       BytecraftPlayer player = BasicCommands.getPlayerInfo((Player) cs);
       if (player.isStaff()) {
         bt.setBanned(true);
         target.kickPlayer(
             ChatColor.RED + "You have been banned by " + ((Player) cs).getDisplayName());
         Bukkit.broadcastMessage(
             ((Player) cs).getDisplayName()
                 + ChatColor.DARK_AQUA
                 + " has banned "
                 + target.getDisplayName());
       }
     } else {
       bt.setBanned(true);
       target.kickPlayer(ChatColor.RED + "You have been banned by " + ChatColor.DARK_RED + " GOD");
       Bukkit.broadcastMessage(
           ChatColor.DARK_RED
               + " GOD"
               + ChatColor.DARK_AQUA
               + " has banned "
               + target.getDisplayName());
     }
     bt.save();
   }
   return true;
 }
Beispiel #2
0
 @Override
 public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
   if (cmd.getName().equalsIgnoreCase("say") && args.length >= 1) {
     if (cs instanceof Player) {
       BytecraftPlayer player = BasicCommands.getPlayerInfo((Player) cs);
       if (player.isStaff()) {
         String color;
         if (player.getGodColor() == null) {
           color = "&c";
         } else {
           color = player.getGodColor();
         }
         StringBuilder sb = new StringBuilder();
         for (int i = 0; i < args.length; ++i) {
           sb.append(args[i] + " ");
         }
         String god = ChatColor.translateAlternateColorCodes('&', color + "<GOD>");
         Bukkit.broadcastMessage(god + " " + ChatColor.LIGHT_PURPLE + sb.toString().trim());
         for (Player other : Bukkit.getOnlinePlayers()) {
           if (BasicCommands.getPlayerInfo(other).isAdmin()) {
             other.sendMessage(ChatColor.AQUA + "//say used by " + ((Player) cs).getDisplayName());
           }
         }
       }
     } else {
       StringBuilder sb = new StringBuilder();
       for (int i = 0; i < args.length; ++i) {
         sb.append(args[i] + " ");
       }
       Bukkit.broadcastMessage(
           ChatColor.DARK_RED + "<GOD> " + ChatColor.LIGHT_PURPLE + sb.toString().trim());
       for (Player other : Bukkit.getOnlinePlayers()) {
         if (BasicCommands.getPlayerInfo(other).isAdmin()) {
           other.sendMessage(ChatColor.AQUA + "//say used by " + ChatColor.DARK_RED + "<GOD>");
         }
       }
     }
   }
   return true;
 }