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