mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-02 22:17:51 +01:00
Move to antibot class
This commit is contained in:
parent
37b6a2f96f
commit
c0e8650c6f
src/main/java/fr/xephi/authme
@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import static fr.xephi.authme.util.BukkitService.TICKS_PER_MINUTE;
|
||||
import static fr.xephi.authme.util.BukkitService.TICKS_PER_SECOND;
|
||||
@ -26,7 +27,8 @@ public class AntiBot {
|
||||
private final Messages messages;
|
||||
private final PermissionsManager permissionsManager;
|
||||
private final BukkitService bukkitService;
|
||||
private final List<String> antibotPlayers = new ArrayList<>();
|
||||
public final CopyOnWriteArrayList<String> antibotKicked = new CopyOnWriteArrayList<String>();
|
||||
private final CopyOnWriteArrayList<String> antibotPlayers = new CopyOnWriteArrayList<String>();
|
||||
private AntiBotStatus antiBotStatus = AntiBotStatus.DISABLED;
|
||||
|
||||
@Inject
|
||||
@ -78,7 +80,7 @@ public class AntiBot {
|
||||
if (antiBotStatus == AntiBotStatus.ACTIVE) {
|
||||
antiBotStatus = AntiBotStatus.LISTENING;
|
||||
antibotPlayers.clear();
|
||||
AuthMePlayerListener.antibotKicked.clear();
|
||||
antibotKicked.clear();
|
||||
for (String s : messages.retrieve(MessageKey.ANTIBOT_AUTO_DISABLED_MESSAGE)) {
|
||||
bukkitService.broadcastMessage(s.replace("%m", Integer.toString(duration)));
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
public static final ConcurrentHashMap<String, String> joinMessage = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentHashMap<String, Boolean> causeByAuthMe = new ConcurrentHashMap<>();
|
||||
public static final CopyOnWriteArrayList<String> antibotKicked = new CopyOnWriteArrayList<String>();
|
||||
|
||||
@Inject
|
||||
private AuthMe plugin;
|
||||
@Inject
|
||||
@ -276,7 +276,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (auth == null && antiBot.getAntiBotStatus() == AntiBotStatus.ACTIVE) {
|
||||
event.setKickMessage(m.retrieveSingle(MessageKey.KICK_ANTIBOT));
|
||||
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
|
||||
antibotKicked.addIfAbsent(event.getName());
|
||||
antiBot.antibotKicked.addIfAbsent(event.getName());
|
||||
return;
|
||||
}
|
||||
if (auth == null && settings.getProperty(RestrictionSettings.KICK_NON_REGISTERED)) {
|
||||
@ -368,7 +368,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (antiBot.getAntiBotStatus() == AntiBotStatus.ACTIVE && !isAuthAvailable) {
|
||||
event.setKickMessage(m.retrieveSingle(MessageKey.KICK_ANTIBOT));
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
antibotKicked.addIfAbsent(player.getName());
|
||||
antiBot.antibotKicked.addIfAbsent(player.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -413,7 +413,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
event.setQuitMessage(null);
|
||||
}
|
||||
|
||||
if (antibotKicked.contains(player.getName())) {
|
||||
if (antiBot.antibotKicked.contains(player.getName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -434,7 +434,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (antibotKicked.contains(player.getName())) {
|
||||
if (antiBot.antibotKicked.contains(player.getName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user