diff --git a/pom.xml b/pom.xml index d4ab57d49..89c9e0329 100644 --- a/pom.xml +++ b/pom.xml @@ -28,12 +28,12 @@ - 2.7.14 + 2.7.15 org.bukkit bukkit - 1.5-R0.1-SNAPSHOT + 1.5.1-R0.2 net.milkbowl.vault diff --git a/src/main/java/uk/org/whoami/authme/AuthMe.java b/src/main/java/uk/org/whoami/authme/AuthMe.java index 824d9661a..037f8b259 100644 --- a/src/main/java/uk/org/whoami/authme/AuthMe.java +++ b/src/main/java/uk/org/whoami/authme/AuthMe.java @@ -483,15 +483,17 @@ public class AuthMe extends JavaPlugin { for (i = 0 ; i <= players.length ; i++) { Random rdm = new Random(); int a = rdm.nextInt(players.length); - if (!players[a].hasPermission("authme.vip")) { + if (!(players[a].hasPermission("authme.vip"))) { player = players[a]; break; - } + } } if (player == null) { - for (Player p : this.getServer().getOnlinePlayers()) { - if (p.hasPermission("authme.vip")) + for (Player p : players) { + if (!(p.hasPermission("authme.vip"))) { player = p; + break; + } } } return player; diff --git a/src/main/java/uk/org/whoami/authme/Management.java b/src/main/java/uk/org/whoami/authme/Management.java index 73543d00c..f9637a3d0 100644 --- a/src/main/java/uk/org/whoami/authme/Management.java +++ b/src/main/java/uk/org/whoami/authme/Management.java @@ -159,13 +159,13 @@ public class Management { AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc()); pm.callEvent(tpEvent); if(!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } final Location fLoc = tpEvent.getTo(); Bukkit.getScheduler().runTask(plugin, new Runnable() { @Override public void run() { + if (!fLoc.getChunk().isLoaded()) { + fLoc.getChunk().load(); + } player.teleport(fLoc); } }); @@ -176,16 +176,16 @@ public class Management { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, true); pm.callEvent(tpEvent); if(!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } - final Location fLoc = tpEvent.getTo(); - Bukkit.getScheduler().runTask(plugin, new Runnable() { - @Override - public void run() { - player.teleport(fLoc); - } - }); + final Location fLoc = tpEvent.getTo(); + Bukkit.getScheduler().runTask(plugin, new Runnable() { + @Override + public void run() { + if (!fLoc.getChunk().isLoaded()) { + fLoc.getChunk().load(); + } + player.teleport(fLoc); + } + }); } } else if ((Settings.isSaveQuitLocationEnabled) && (getAuth.getQuitLocY() != 0)) @@ -196,13 +196,13 @@ public class Management { AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc()); pm.callEvent(tpEvent); if(!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } final Location fLoc = tpEvent.getTo(); Bukkit.getScheduler().runTask(plugin, new Runnable() { @Override public void run() { + if (!fLoc.getChunk().isLoaded()) { + fLoc.getChunk().load(); + } player.teleport(fLoc); } }); @@ -319,16 +319,16 @@ public class Management { AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, quitLoc); pm.callEvent(tpEvent); if(!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } - final Location fLoc = tpEvent.getTo(); - Bukkit.getScheduler().runTask(plugin, new Runnable() { - @Override - public void run() { - player.teleport(fLoc); - } - }); + final Location fLoc = tpEvent.getTo(); + Bukkit.getScheduler().runTask(plugin, new Runnable() { + @Override + public void run() { + if (!fLoc.getChunk().isLoaded()) { + fLoc.getChunk().load(); + } + player.teleport(fLoc); + } + }); } } else @@ -336,16 +336,16 @@ public class Management { AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc()); pm.callEvent(tpEvent); if(!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } - final Location fLoc = tpEvent.getTo(); - Bukkit.getScheduler().runTask(plugin, new Runnable() { - @Override - public void run() { - player.teleport(fLoc); - } - }); + final Location fLoc = tpEvent.getTo(); + Bukkit.getScheduler().runTask(plugin, new Runnable() { + @Override + public void run() { + if (!fLoc.getChunk().isLoaded()) { + fLoc.getChunk().load(); + } + player.teleport(fLoc); + } + }); } } } @@ -354,16 +354,16 @@ public class Management { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, true); pm.callEvent(tpEvent); if(!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } - final Location fLoc = tpEvent.getTo(); - Bukkit.getScheduler().runTask(plugin, new Runnable() { - @Override - public void run() { - player.teleport(fLoc); - } - }); + final Location fLoc = tpEvent.getTo(); + Bukkit.getScheduler().runTask(plugin, new Runnable() { + @Override + public void run() { + if (!fLoc.getChunk().isLoaded()) { + fLoc.getChunk().load(); + } + player.teleport(fLoc); + } + }); } } else if ((Settings.isSaveQuitLocationEnabled) && (database.getAuth(name).getQuitLocY() != 0)) { @@ -371,13 +371,13 @@ public class Management { AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, quitLoc); pm.callEvent(tpEvent); if(!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } final Location fLoc = tpEvent.getTo(); Bukkit.getScheduler().runTask(plugin, new Runnable() { @Override public void run() { + if (!fLoc.getChunk().isLoaded()) { + fLoc.getChunk().load(); + } player.teleport(fLoc); } }); @@ -388,13 +388,13 @@ public class Management { AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc()); pm.callEvent(tpEvent); if(!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - } final Location fLoc = tpEvent.getTo(); Bukkit.getScheduler().runTask(plugin, new Runnable() { @Override public void run() { + if (!fLoc.getChunk().isLoaded()) { + fLoc.getChunk().load(); + } player.teleport(fLoc); } }); diff --git a/src/main/java/uk/org/whoami/authme/listener/AuthMePlayerListener.java b/src/main/java/uk/org/whoami/authme/listener/AuthMePlayerListener.java index 983b9abb6..4455276b3 100644 --- a/src/main/java/uk/org/whoami/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/uk/org/whoami/authme/listener/AuthMePlayerListener.java @@ -597,25 +597,25 @@ public class AuthMePlayerListener implements Listener { if (name.length() > max || name.length() < min) { - event.disallow(Result.KICK_OTHER, m._("name_len")); + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, m._("name_len")); return; } if (!player.getName().matches(regex) || name.equals("Player")) { try { - event.disallow(Result.KICK_OTHER, m._("regex").replaceAll("REG_EX", regex)); + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, m._("regex").replaceAll("REG_EX", regex)); } catch (StringIndexOutOfBoundsException exc) { - event.disallow(Result.KICK_OTHER, "allowed char : " + regex); + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "allowed char : " + regex); } return; } if (Settings.isKickNonRegisteredEnabled) { if (!data.isAuthAvailable(name)) { - event.disallow(Result.KICK_OTHER, m._("reg_only")); + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, m._("reg_only")); return; } } - if (event.getResult() != Result.KICK_FULL) return; + if (event.getResult() != PlayerLoginEvent.Result.KICK_FULL) return; if (player.isBanned()) return; if (!player.hasPermission("authme.vip")) { event.disallow(Result.KICK_FULL, m._("kick_fullserver")); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index eb52aa2c0..56791c10d 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,7 +3,7 @@ author: darkwarriros,Xephi website: http://www.multiplayer-italia.com/ description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player. main: uk.org.whoami.authme.AuthMe -version: 2.7.14 +version: 2.7.15 softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag] commands: register: