From 7383242599fe0221ca3f8b86a815ce6b755d6a62 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 13 Dec 2015 23:07:58 +0700 Subject: [PATCH] Attempt to fix #339 --- .../executable/authme/UnregisterAdminCommand.java | 10 ++++------ .../authme/process/join/AsynchronousJoin.java | 15 +++++---------- .../login/ProcessSyncronousPlayerLogin.java | 5 ----- .../logout/ProcessSyncronousPlayerLogout.java | 4 ---- .../register/ProcessSyncPasswordRegister.java | 5 ----- .../unregister/AsynchronousUnregister.java | 4 ---- 6 files changed, 9 insertions(+), 34 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterAdminCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterAdminCommand.java index 8d2b1e114..46625aa1b 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterAdminCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/UnregisterAdminCommand.java @@ -59,7 +59,7 @@ public class UnregisterAdminCommand extends ExecutableCommand { } // Unregister the player - Player target = Bukkit.getPlayer(playerNameLowerCase); + Player target = Utils.getPlayer(playerNameLowerCase); PlayerCache.getInstance().removePlayer(playerNameLowerCase); Utils.setGroup(target, Utils.GroupType.UNREGISTERED); if (target != null && target.isOnline()) { @@ -75,11 +75,9 @@ public class UnregisterAdminCommand extends ExecutableCommand { LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setMessageTaskId( scheduler.runTaskAsynchronously(plugin, new MessageTask(plugin, playerNameLowerCase, m.retrieve(MessageKey.REGISTER_MESSAGE), interval))); - if (Settings.applyBlindEffect) - target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - target.setWalkSpeed(0.0f); - target.setFlySpeed(0.0f); + if (Settings.applyBlindEffect) { + target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, + Settings.getRegistrationTimeout * 20, 2)); } m.send(target, MessageKey.UNREGISTERED_SUCCESS); diff --git a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java index 8a4bd6544..dd1eb4b25 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java @@ -10,9 +10,9 @@ import fr.xephi.authme.events.FirstSpawnTeleportEvent; import fr.xephi.authme.events.ProtectInventoryEvent; import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.listener.AuthMePlayerListener; -import fr.xephi.authme.permission.PlayerPermission; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; +import fr.xephi.authme.permission.PlayerPermission; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; import fr.xephi.authme.task.MessageTask; @@ -78,9 +78,9 @@ public class AsynchronousJoin { return; } if (Settings.getMaxJoinPerIp > 0 - && !plugin.getPermissionsManager().hasPermission(player, PlayerPermission.ALLOW_MULTIPLE_ACCOUNTS) - && !ip.equalsIgnoreCase("127.0.0.1") - && !ip.equalsIgnoreCase("localhost")) { + && !plugin.getPermissionsManager().hasPermission(player, PlayerPermission.ALLOW_MULTIPLE_ACCOUNTS) + && !ip.equalsIgnoreCase("127.0.0.1") + && !ip.equalsIgnoreCase("localhost")) { if (plugin.hasJoinedIp(player.getName(), ip)) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { @@ -203,10 +203,6 @@ public class AsynchronousJoin { if (Settings.applyBlindEffect) { player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeOut, 2)); } - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - player.setWalkSpeed(0.0f); - player.setFlySpeed(0.0f); - } } }); @@ -236,8 +232,7 @@ public class AsynchronousJoin { ? m.retrieve(MessageKey.REGISTER_EMAIL_MESSAGE) : m.retrieve(MessageKey.REGISTER_MESSAGE); } - if (LimboCache.getInstance().getLimboPlayer(name) != null) - { + if (LimboCache.getInstance().getLimboPlayer(name) != null) { BukkitTask msgTask = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, msg, msgInterval)); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgTask); } 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 f64b2274a..8c8280741 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -189,11 +189,6 @@ public class ProcessSyncronousPlayerLogin implements Runnable { player.removePotionEffect(PotionEffectType.BLINDNESS); } - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - player.setWalkSpeed(0.2f); - player.setFlySpeed(0.1f); - } - // The Login event now fires (as intended) after everything is processed Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true)); player.saveData(); 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 8f34c3631..4fd6a9caa 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -80,10 +80,6 @@ public class ProcessSyncronousPlayerLogout implements Runnable { if (!Settings.isMovementAllowed) { player.setAllowFlight(true); player.setFlying(true); - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - 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/ProcessSyncPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncPasswordRegister.java index 4c9136def..179161675 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncPasswordRegister.java @@ -128,11 +128,6 @@ public class ProcessSyncPasswordRegister implements Runnable { player.removePotionEffect(PotionEffectType.BLINDNESS); } - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - player.setWalkSpeed(0.0f); - player.setFlySpeed(0.0f); - } - // The LoginEvent now fires (as intended) after everything is processed plugin.getServer().getPluginManager().callEvent(new LoginEvent(player, true)); player.saveData(); diff --git a/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java b/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java index da5d19f9f..53c54b3e7 100644 --- a/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java +++ b/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java @@ -104,10 +104,6 @@ public class AsynchronousUnregister { if (Settings.applyBlindEffect) { player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeOut, 2)); } - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - player.setWalkSpeed(0.0f); - player.setFlySpeed(0.0f); - } m.send(player, MessageKey.UNREGISTERED_SUCCESS); ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); Utils.teleportToSpawn(player);