@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } /* * ignore command. */ if (command.getName().equalsIgnoreCase("ignore")) { if (player != null) { if (PickleCraftPlugin.hasPerm(player, command.getPermission())) { if (args.length >= 1) { if (args.length >= 2) { /* * flags */ if (args[0].equalsIgnoreCase("-r")) { // remove ignore flag Object[] playerAndbool = PickleCraftPlugin.getPlayer(args[1]); Player p = (Player) playerAndbool[0]; if (p != null) { if ((Boolean) playerAndbool[1] == false) { IgnorePlayer igP = getIgnorePlayer(player); if (igP != null) { igP.unignorePlayer(p.getUniqueId(), true); } else { player.sendMessage( plugin.getStringFromConfig( "ignorecraft.messages.errors.isnotignored", p.getName())); } } else { player.sendMessage( plugin.getStringFromConfig( "common.messages.errors.tomanyplayers", args[1])); } return true; } else { player.sendMessage( plugin.getStringFromConfig( "common.messages.errors.playerdontexist", args[1])); } } } else { Object[] playerAndbool = PickleCraftPlugin.getPlayer(args[0]); Player p = (Player) playerAndbool[0]; if (p != null) { if ((Boolean) playerAndbool[1] == false) { IgnorePlayer igP = getIgnorePlayer(player); if (igP != null) { igP.ignorePlayer(p.getUniqueId(), true); } else { igP = new IgnorePlayer(this, player.getUniqueId()); igP.ignorePlayer(p.getUniqueId(), true); playerIgnoreList.add(igP); } } else { player.sendMessage( plugin.getStringFromConfig("common.messages.errors.tomanyplayers", args[0])); } } else { player.sendMessage( plugin.getStringFromConfig("common.messages.errors.playerdontexist", args[0])); } return true; } } } else { player.sendMessage(plugin.getStringFromConfig("common.messages.errors.donthaveperm")); return true; } } else { sender.sendMessage("This is a player only command."); return true; } } /* * ignoreall command */ else if (command.getName().equalsIgnoreCase("ignoreall")) { // all ignore if (player != null) { if (PickleCraftPlugin.hasPerm(player, command.getPermission())) { IgnorePlayer igP = getIgnorePlayer(player); if (igP != null) { igP.toggleAllIgnore(true); } else { igP = new IgnorePlayer(this, player.getUniqueId()); igP.toggleAllIgnore(true); playerIgnoreList.add(igP); } } else { player.sendMessage(plugin.getStringFromConfig("common.messages.errors.donthaveperm")); } } else { sender.sendMessage("This is a player only command."); } return true; } /* * display ignore list */ else if (command.getName().equalsIgnoreCase("ignorelist")) { // displays ignore list if (player != null) { IgnorePlayer igP = getIgnorePlayer(player); if (igP != null) { listIgnores(igP); } } else { sender.sendMessage("This is a player only command."); } return true; } return false; }