mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-02-16 03:31:37 +01:00
Add the command "ncp unkick *".
This commit is contained in:
parent
0d2862c21b
commit
976cd59b7c
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user