mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-24 01:27:35 +01:00
enhance the removespeed feature
This commit is contained in:
parent
43b9462ddc
commit
e9b2517188
@ -16,7 +16,7 @@ public class AntiBot {
|
|||||||
private static final AuthMe plugin = AuthMe.getInstance();
|
private static final AuthMe plugin = AuthMe.getInstance();
|
||||||
private static final Messages messages = plugin.getMessages();
|
private static final Messages messages = plugin.getMessages();
|
||||||
private static final List<String> antibotPlayers = new ArrayList<>();
|
private static final List<String> antibotPlayers = new ArrayList<>();
|
||||||
private static AntiBotStatus antiBotStatus = AntiBotStatus.DISARMED;
|
private static AntiBotStatus antiBotStatus = AntiBotStatus.DISABLED;
|
||||||
|
|
||||||
public static void setupAntiBotService() {
|
public static void setupAntiBotService() {
|
||||||
if (!Settings.enableAntiBot) {
|
if (!Settings.enableAntiBot) {
|
||||||
@ -25,19 +25,19 @@ public class AntiBot {
|
|||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
antiBotStatus = AntiBotStatus.ARMED;
|
antiBotStatus = AntiBotStatus.ENABLED;
|
||||||
}
|
}
|
||||||
}, 2400);
|
}, 2400);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void overrideAntiBotStatus(boolean activated) {
|
public static void overrideAntiBotStatus(boolean activated) {
|
||||||
if (antiBotStatus == AntiBotStatus.DISARMED || antiBotStatus == AntiBotStatus.DELAYED) {
|
if (antiBotStatus == AntiBotStatus.DISABLED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (activated) {
|
if (activated) {
|
||||||
antiBotStatus = AntiBotStatus.ACTIVATED;
|
antiBotStatus = AntiBotStatus.INACTION;
|
||||||
} else {
|
} else {
|
||||||
antiBotStatus = AntiBotStatus.ARMED;
|
antiBotStatus = AntiBotStatus.ENABLED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class AntiBot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void activateAntiBot() {
|
public static void activateAntiBot() {
|
||||||
antiBotStatus = AntiBotStatus.ACTIVATED;
|
antiBotStatus = AntiBotStatus.INACTION;
|
||||||
for (String s : messages.send("antibot_auto_enabled")) {
|
for (String s : messages.send("antibot_auto_enabled")) {
|
||||||
Bukkit.broadcastMessage(s);
|
Bukkit.broadcastMessage(s);
|
||||||
}
|
}
|
||||||
@ -54,8 +54,8 @@ public class AntiBot {
|
|||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (antiBotStatus == AntiBotStatus.ACTIVATED) {
|
if (antiBotStatus == AntiBotStatus.INACTION) {
|
||||||
antiBotStatus = AntiBotStatus.ARMED;
|
antiBotStatus = AntiBotStatus.ENABLED;
|
||||||
antibotPlayers.clear();
|
antibotPlayers.clear();
|
||||||
for (String s : messages.send("antibot_auto_disabled"))
|
for (String s : messages.send("antibot_auto_disabled"))
|
||||||
Bukkit.broadcastMessage(s.replace("%m", "" + Settings.antiBotDuration));
|
Bukkit.broadcastMessage(s.replace("%m", "" + Settings.antiBotDuration));
|
||||||
@ -70,7 +70,7 @@ public class AntiBot {
|
|||||||
* @param player Player
|
* @param player Player
|
||||||
*/
|
*/
|
||||||
public static void checkAntiBot(final Player player) {
|
public static void checkAntiBot(final Player player) {
|
||||||
if (antiBotStatus == AntiBotStatus.ACTIVATED || antiBotStatus == AntiBotStatus.DISARMED) {
|
if (antiBotStatus == AntiBotStatus.INACTION || antiBotStatus == AntiBotStatus.DISABLED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plugin.getPermissionsManager().hasPermission(player, "authme.bypassantibot")) {
|
if (plugin.getPermissionsManager().hasPermission(player, "authme.bypassantibot")) {
|
||||||
@ -91,10 +91,9 @@ public class AntiBot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum AntiBotStatus {
|
public enum AntiBotStatus {
|
||||||
ARMED,
|
ENABLED,
|
||||||
DISARMED,
|
DISABLED,
|
||||||
DELAYED,
|
INACTION
|
||||||
ACTIVATED
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -183,10 +183,12 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Settings.isMovementAllowed) {
|
if (!Settings.isMovementAllowed) {
|
||||||
if (event.getFrom().distance(event.getTo()) > 0) {
|
event.setTo(event.getFrom());
|
||||||
event.setTo(event.getFrom());
|
if(Settings.isRemoveSpeedEnabled) {
|
||||||
return;
|
player.setFlySpeed(0.0f);
|
||||||
|
player.setWalkSpeed(0.0f);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.noTeleport) {
|
if (Settings.noTeleport) {
|
||||||
|
Loading…
Reference in New Issue
Block a user