From b427d14bcb286c0406ef6115800b45064357414f Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 19 Sep 2015 22:28:55 +0200 Subject: [PATCH] Speed 0 when not logged! --- src/main/java/fr/xephi/authme/commands/AdminCommand.java | 4 ++++ src/main/java/fr/xephi/authme/commands/UnregisterCommand.java | 4 ++++ .../java/fr/xephi/authme/process/join/AsyncronousJoin.java | 4 ++++ .../authme/process/login/ProcessSyncronousPlayerLogin.java | 4 ++++ .../authme/process/logout/ProcessSyncronousPlayerLogout.java | 2 ++ .../process/register/ProcessSyncronousPasswordRegister.java | 4 ++++ 6 files changed, 22 insertions(+) diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 41c4fbfd..569088b3 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -486,6 +486,10 @@ public class AdminCommand implements CommandExecutor { LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); if (Settings.applyBlindEffect) target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed) { + target.setWalkSpeed(0.0f); + target.setFlySpeed(0.0f); + } m.send(target, "unregistered"); } } diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index 7c1a4c1e..6d8196e5 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -109,6 +109,10 @@ public class UnregisterCommand implements CommandExecutor { } if (Settings.applyBlindEffect) player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed) { + player.setWalkSpeed(0.0f); + player.setFlySpeed(0.0f); + } m.send(player, "unregistered"); ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index a75b91b4..442fab0a 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -235,6 +235,10 @@ public class AsyncronousJoin { player.performCommand("motd"); if (Settings.applyBlindEffect) player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + if (!Settings.isMovementAllowed) { + player.setWalkSpeed(0.0f); + player.setFlySpeed(0.0f); + } } }); diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 659825d7..2ad48153 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -186,6 +186,10 @@ public class ProcessSyncronousPlayerLogin implements Runnable { if (Settings.applyBlindEffect) player.removePotionEffect(PotionEffectType.BLINDNESS); + if (!Settings.isMovementAllowed) { + player.setWalkSpeed(0.2f); + player.setFlySpeed(0.4f); + } // The Loginevent now fires (as intended) after everything is processed Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true)); diff --git a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java index 4cac3864..f78685b0 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -54,6 +54,8 @@ public class ProcessSyncronousPlayerLogout implements Runnable { if (!Settings.isMovementAllowed) { player.setAllowFlight(true); player.setFlying(true); + player.setFlySpeed(0.0f); + player.setWalkSpeed(0.0f); } // Player is now logout... Time to fire event ! Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 71d8292c..60e1f9de 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -119,6 +119,10 @@ public class ProcessSyncronousPasswordRegister implements Runnable { } if (Settings.applyBlindEffect) player.removePotionEffect(PotionEffectType.BLINDNESS); + if (!Settings.isMovementAllowed) { + player.setWalkSpeed(0.2f); + player.setFlySpeed(0.4f); + } // The Loginevent now fires (as intended) after everything is processed Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true)); player.saveData();