mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-26 18:47:37 +01:00
parent
58c42cf300
commit
ac7bb5c0f6
@ -29,9 +29,11 @@ public class AntiBotService implements SettingsDependent {
|
||||
// Settings
|
||||
private int duration;
|
||||
private int sensibility;
|
||||
private int delay;
|
||||
|
||||
// Service status
|
||||
private AntiBotStatus antiBotStatus;
|
||||
private boolean startup;
|
||||
private BukkitTask disableTask;
|
||||
private int antibotPlayers;
|
||||
private final CopyOnWriteArrayList<String> antibotKicked = new CopyOnWriteArrayList<>();
|
||||
@ -47,6 +49,7 @@ public class AntiBotService implements SettingsDependent {
|
||||
disableTask = null;
|
||||
antibotPlayers = 0;
|
||||
antiBotStatus = AntiBotStatus.DISABLED;
|
||||
startup = true;
|
||||
// Load settings and start if required
|
||||
reload(settings);
|
||||
}
|
||||
@ -56,6 +59,7 @@ public class AntiBotService implements SettingsDependent {
|
||||
// Load settings
|
||||
duration = settings.getProperty(ProtectionSettings.ANTIBOT_DURATION);
|
||||
sensibility = settings.getProperty(ProtectionSettings.ANTIBOT_SENSIBILITY);
|
||||
delay = settings.getProperty(ProtectionSettings.ANTIBOT_DELAY);
|
||||
|
||||
// Stop existing protection
|
||||
stopProtection();
|
||||
@ -66,13 +70,21 @@ public class AntiBotService implements SettingsDependent {
|
||||
return;
|
||||
}
|
||||
|
||||
// Schedule the bot activation
|
||||
bukkitService.scheduleSyncDelayedTask(new Runnable() {
|
||||
// Bot activation task
|
||||
Runnable enableTask = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
antiBotStatus = AntiBotStatus.LISTENING;
|
||||
}
|
||||
}, 90 * TICKS_PER_SECOND);
|
||||
};
|
||||
|
||||
// Delay the schedule on first start
|
||||
if(startup) {
|
||||
bukkitService.scheduleSyncDelayedTask(enableTask, delay * TICKS_PER_SECOND);
|
||||
startup = false;
|
||||
} else {
|
||||
enableTask.run();
|
||||
}
|
||||
}
|
||||
|
||||
private void startProtection() {
|
||||
|
@ -42,6 +42,10 @@ public class ProtectionSettings implements SettingsHolder {
|
||||
public static final Property<Integer> ANTIBOT_DURATION =
|
||||
newProperty("Protection.antiBotDuration", 10);
|
||||
|
||||
@Comment("Delay in seconds before the antibot activation")
|
||||
public static final Property<Integer> ANTIBOT_DELAY =
|
||||
newProperty("Protection.antiBotDelay", 60);
|
||||
|
||||
private ProtectionSettings() {
|
||||
}
|
||||
|
||||
|
@ -435,6 +435,8 @@ Protection:
|
||||
antiBotSensibility: 10
|
||||
# Duration in minutes of the antibot automatic system
|
||||
antiBotDuration: 10
|
||||
# Delay in seconds before the antibot activation
|
||||
antiBotDelay: 60
|
||||
GroupOptions:
|
||||
# Registered permission group
|
||||
RegisteredPlayerGroup: ''
|
||||
|
Loading…
Reference in New Issue
Block a user