diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/NoCheatPlus.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/NoCheatPlus.java index 9818093a..5e58a9d5 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/NoCheatPlus.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/NoCheatPlus.java @@ -145,6 +145,21 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI { return System.currentTimeMillis() <= time; } + /** + * Remove all players from the allow login set. + * @return Number of players that had actually been denied to login. + */ + public static int allowLoginAll(){ + int denied = 0; + final long now = System.currentTimeMillis(); + for (final String playerName : denyLoginNames.keySet()){ + final Long time = denyLoginNames.get(playerName); + if (time != null && time > now) denied ++; + } + denyLoginNames.clear(); + return denied; + } + /** * Deny the player to login. This will also remove expired entries. * @param playerName diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/command/actions/UnKickCommand.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/command/actions/UnKickCommand.java index d5e0aa3b..63894982 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/command/actions/UnKickCommand.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/command/actions/UnKickCommand.java @@ -17,8 +17,15 @@ public class UnKickCommand extends NCPCommand { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length != 2) return false; - if (NoCheatPlus.allowLogin(args[1])) sender.sendMessage(TAG + "Allow to login again: " + args[1].trim()); - else sender.sendMessage(TAG + "Was not denied to login: " + args[1].trim()); + if (args[1].trim().equals("*")){ + sender.sendMessage(TAG + "Removed " + NoCheatPlus.allowLoginAll() + " players from the 'deny-login' list."); + } + else if (NoCheatPlus.allowLogin(args[1])){ + sender.sendMessage(TAG + "Allow to login again: " + args[1].trim()); + } + else{ + sender.sendMessage(TAG + "Was not denied to login: " + args[1].trim()); + } return true; }