mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-03 19:00:30 +02: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;
|
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.
|
* Deny the player to login. This will also remove expired entries.
|
||||||
* @param playerName
|
* @param playerName
|
||||||
|
|
|
@ -17,8 +17,15 @@ public class UnKickCommand extends NCPCommand {
|
||||||
public boolean onCommand(CommandSender sender, Command command,
|
public boolean onCommand(CommandSender sender, Command command,
|
||||||
String label, String[] args) {
|
String label, String[] args) {
|
||||||
if (args.length != 2) return false;
|
if (args.length != 2) return false;
|
||||||
if (NoCheatPlus.allowLogin(args[1])) sender.sendMessage(TAG + "Allow to login again: " + args[1].trim());
|
if (args[1].trim().equals("*")){
|
||||||
else sender.sendMessage(TAG + "Was not denied to login: " + args[1].trim());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user