@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; }
@Override public boolean execute(CommandSender sender, String commandLabel, String[] args) { if (exe != null) { if (!FOPMR_Rank.isEqualOrHigher(FOPMR_Rank.getRank(sender), rank)) { sender.sendMessage( ChatColor.RED + "You must be " + CUtils_Methods.aOrAn(rank.name) + " " + rank.name + " to use this command."); return true; } if (!exe.onCommand(sender, this, commandLabel, args)) { sender.sendMessage(this.usageMessage.replaceAll("<command>", command)); return false; } return true; } return false; }