diff --git a/pom.xml b/pom.xml index b302035db..4027120f4 100644 --- a/pom.xml +++ b/pom.xml @@ -154,12 +154,6 @@ http://nexus.theyeticave.net/content/repositories/pub_releases - - - Plugin Metrics - http://repo.mcstats.org/content/repositories/releases - - luricos-releases diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 7a56ca194..bce507722 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -176,7 +176,7 @@ public class AdminCommand implements CommandExecutor { return true; } if (auth == null) { - m.send(sender, "user_unknown"); + m.send(sender, "user_unknown"); return true; } long lastLogin = auth.getLastLogin(); @@ -362,9 +362,9 @@ public class AdminCommand implements CommandExecutor { if (sender instanceof Player) { if (Spawn.getInstance().setSpawn(((Player) sender).getLocation())) { sender.sendMessage("[AuthMe] Correctly defined new spawn point"); - } else { + } else { sender.sendMessage("[AuthMe] SetSpawn has failed, please retry"); - } + } } else { sender.sendMessage("[AuthMe] Please use that command in game"); } @@ -427,7 +427,8 @@ public class AdminCommand implements CommandExecutor { ConsoleLogger.showError(ex.getMessage()); } return true; - } else if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) { + } else + if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) { if (args.length != 3) { sender.sendMessage("Usage: /authme changepassword "); return true; @@ -512,7 +513,7 @@ public class AdminCommand implements CommandExecutor { int interval = Settings.getWarnMessageInterval; BukkitScheduler sched = sender.getServer().getScheduler(); if (delay != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, target), delay); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); @@ -528,7 +529,8 @@ public class AdminCommand implements CommandExecutor { m.send(sender, "unregistered"); ConsoleLogger.info(args[1] + " unregistered"); return true; - } else if (args[0].equalsIgnoreCase("purgelastpos") || args[0].equalsIgnoreCase("resetposition")) { + } else + if (args[0].equalsIgnoreCase("purgelastpos") || args[0].equalsIgnoreCase("resetposition")) { if (args.length != 2) { sender.sendMessage("Usage: /authme purgelastpos "); return true; @@ -581,9 +583,9 @@ public class AdminCommand implements CommandExecutor { sender.sendMessage("Usage: /authme getip "); return true; } - sender.sendMessage(player.getName() + "'s actual IP is : " + player.getAddress().getAddress().getHostAddress() + ":" + player.getAddress().getPort()); - sender.sendMessage(player.getName() + "'s real IP is : " + plugin.getIP(player)); - return true; + sender.sendMessage(player.getName() + "'s actual IP is : " + player.getAddress().getAddress().getHostAddress() + ":" + player.getAddress().getPort()); + sender.sendMessage(player.getName() + "'s real IP is : " + plugin.getIP(player)); + return true; } else if (args[0].equalsIgnoreCase("forcelogin")) { if (args.length < 2) { sender.sendMessage("Usage: /authme forcelogin "); diff --git a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java index dd1a94e94..1361656d6 100644 --- a/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java +++ b/src/main/java/fr/xephi/authme/commands/UnregisterCommand.java @@ -88,7 +88,7 @@ public class UnregisterCommand implements CommandExecutor { int interval = Settings.getWarnMessageInterval; BukkitScheduler sched = sender.getServer().getScheduler(); if (delay != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); 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 12e3f3f7d..cf0fa83a2 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -200,7 +200,7 @@ public class AsyncronousJoin { int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; if (time != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), time); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); if (!LimboCache.getInstance().hasLimboPlayer(name)) LimboCache.getInstance().addLimboPlayer(player); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); 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 29077488f..f926c6949 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -38,7 +38,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable { int interval = Settings.getWarnMessageInterval; BukkitScheduler sched = player.getServer().getScheduler(); if (delay != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval)); diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index f90a506d9..e7510eae0 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -36,7 +36,7 @@ public class ProcessSyncronousEmailRegister implements Runnable { int msgInterval = Settings.getWarnMessageInterval; if (time != 0) { LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); - BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), time); + BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } 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 c85988e46..7a7b41e1b 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -67,7 +67,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { int interval = Settings.getWarnMessageInterval; BukkitScheduler sched = plugin.getServer().getScheduler(); if (delay != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval)); diff --git a/src/main/java/fr/xephi/authme/task/TimeoutTask.java b/src/main/java/fr/xephi/authme/task/TimeoutTask.java index 1c1c1f692..85867d434 100644 --- a/src/main/java/fr/xephi/authme/task/TimeoutTask.java +++ b/src/main/java/fr/xephi/authme/task/TimeoutTask.java @@ -1,16 +1,10 @@ package fr.xephi.authme.task; import org.bukkit.Bukkit; -import org.bukkit.GameMode; import org.bukkit.entity.Player; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.cache.backup.FileCache; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.cache.limbo.LimboPlayer; -import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.settings.Messages; public class TimeoutTask implements Runnable { @@ -18,12 +12,12 @@ public class TimeoutTask implements Runnable { private AuthMe plugin; private String name; private Messages m = Messages.getInstance(); - private FileCache playerCache; + private Player player; - public TimeoutTask(AuthMe plugin, String name) { + public TimeoutTask(AuthMe plugin, String name, Player player) { this.plugin = plugin; this.name = name; - this.playerCache = new FileCache(plugin); + this.player = player; } public String getName() { @@ -35,38 +29,13 @@ public class TimeoutTask implements Runnable { if (PlayerCache.getInstance().isAuthenticated(name)) return; - for (final Player player : plugin.getServer().getOnlinePlayers()) { - if (player.getName().toLowerCase().equals(name)) { - if (LimboCache.getInstance().hasLimboPlayer(name)) { - LimboPlayer inv = LimboCache.getInstance().getLimboPlayer(name); - inv.getMessageTaskId().cancel(); - inv.getTimeoutTaskId().cancel(); - if (playerCache.doesCacheExist(player)) { - playerCache.removeCache(player); - } - } - final GameMode gm = AuthMePlayerListener.gameMode.get(name); - if (gm != null) { - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - player.setGameMode(gm); - } - - }); - ConsoleLogger.info("Set " + player.getName() + " to gamemode: " + gm.name()); - } - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - - @Override - public void run() { - if (player.isOnline()) - player.kickPlayer(m.send("timeout")[0]); - } - }); - return; + @Override + public void run() { + if (player.isOnline()) + player.kickPlayer(m.send("timeout")[0]); } - } + }); } }