@Override
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length != 1) {
     return false;
   }
   Player player = FOPMR_Rank.getPlayer(args[0]);
   if (player == null) {
     sender.sendMessage("Player is not online.");
     return true;
   }
   if (FOPMR_Rank.isEqualOrHigher(FOPMR_Rank.getRank(player), FOPMR_Rank.getRank(sender))) {
     sender.sendMessage(
         "You can only block the commands of a player with lower clearance than yourself.");
     return true;
   }
   Bukkit.broadcastMessage(
       ChatColor.AQUA
           + sender.getName()
           + " - toggling command blockage for "
           + player.getName()
           + ".");
   try {
     FOPMR_DatabaseInterface.updateInTable(
         "UUID",
         player.getUniqueId().toString(),
         !(FOPMR_DatabaseInterface.getBooleanFromTable(
             "UUID", player.getUniqueId().toString(), "CMDBLOCK", "PLAYERS")),
         "CMDBLOCK",
         "PLAYERS");
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
   return true;
 }
Example #2
0
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length < 2) {
     return false;
   }
   Player player = FOPMR_Rank.getPlayer(args[0]);
   if (player == null) {
     sender.sendMessage(ChatColor.RED + "The player you listed: " + args[0] + " is not online...");
     return true;
   }
   try {
     String message = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
     FOPMR_DatabaseInterface.updateInTable(
         "UUID", player.getUniqueId().toString(), message, "LOGIN", "PLAYERS");
     sender.sendMessage(
         ChatColor.GREEN
             + "Set "
             + player.getName()
             + "'s login message to \""
             + CUtils_Methods.colour(message)
             + "\".");
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
   return true;
 }
Example #3
0
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   try {
     if (!(sender instanceof Player)) {
       sender.sendMessage(ChatColor.RED + "You must be ingame to use this command.");
       return true;
     }
     if (args.length == 0 || args.length > 2) {
       return false;
     }
     if (args.length == 1) {
       if (args[0].equalsIgnoreCase("list")) {
         sender.sendMessage(ChatColor.GREEN + "The following users are Master Builders.");
         Connection c = FOPMR_DatabaseInterface.getConnection();
         PreparedStatement statement =
             c.prepareStatement("SELECT * FROM PLAYERS WHERE BUILDER = 1");
         ResultSet set = statement.executeQuery();
         while (set.next()) {
           sender.sendMessage(ChatColor.GREEN + " - " + set.getString("NAME"));
         }
         return true;
       }
     }
     if (args.length == 2) {
       if (!FOPMR_Rank.isSpecialist(sender)) {
         sender.sendMessage("You do not have permission to use this command.");
         return true;
       }
       Player player = FOPMR_Rank.getPlayer(args[1]);
       if (player == null) {
         sender.sendMessage(ChatColor.RED + "The player could not be found.");
         return true;
       }
       if (args[0].equalsIgnoreCase("add")) {
         FOPMR_Commons.adminAction(
             sender.getName(), "Adding " + player.getName() + " to Master Builder.", false);
         FOPMR_DatabaseInterface.updateInTable(
             "UUID", player.getUniqueId().toString(), true, "BUILDER", "PLAYERS");
         FOPMR_BoardManager.updateStats(player);
         return true;
       }
       if (args[0].equalsIgnoreCase("remove")) {
         FOPMR_Commons.adminAction(
             sender.getName(), "Removing " + player.getName() + " from Master Builder.", true);
         FOPMR_DatabaseInterface.updateInTable(
             "UUID", player.getUniqueId().toString(), false, "BUILDER", "PLAYERS");
         FOPMR_BoardManager.updateStats(player);
         return true;
       }
     }
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
   return false;
 }
Example #4
0
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length == 1) {
     OfflinePlayer player = FOPMR_Rank.getPlayer(args[0]);
     if (player == null) {
       player = Bukkit.getOfflinePlayer(args[0]);
     }
     if (player == null) {
       sender.sendMessage(ChatColor.RED + "Player could not be found.");
       return false;
     }
     sender.sendMessage(
         ChatColor.GREEN
             + "The uuid of "
             + player.getName()
             + " is "
             + player.getUniqueId()
             + ".");
   }
   if (!(sender instanceof Player)) {
     return true;
   }
   sender.sendMessage(ChatColor.GREEN + "Your UUID is " + ((Player) sender).getUniqueId() + ".");
   return true;
 }