From 6c8ba0d7ef5685020c4b1d53c79d2f761a222789 Mon Sep 17 00:00:00 2001 From: Xephi Date: Sun, 14 Apr 2013 15:42:39 +0200 Subject: [PATCH] Sync this --- src/main/java/uk/org/whoami/authme/Utils.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/uk/org/whoami/authme/Utils.java b/src/main/java/uk/org/whoami/authme/Utils.java index f313422e7..6987a5f8a 100644 --- a/src/main/java/uk/org/whoami/authme/Utils.java +++ b/src/main/java/uk/org/whoami/authme/Utils.java @@ -120,13 +120,20 @@ public class Utils { final int fY = y; final Location loc = new Location(world, x, y + 0.6D, z); - AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, loc); - AuthMe.getInstance().getServer().getPluginManager().callEvent(tpEvent); - if(!tpEvent.isCancelled()) { - if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) - tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load(); - pl.teleport(tpEvent.getTo()); - } + Bukkit.getScheduler().runTask(AuthMe.getInstance(), new Runnable() { + + @Override + public void run() { + AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, loc); + AuthMe.getInstance().getServer().getPluginManager().callEvent(tpEvent); + if(!tpEvent.isCancelled()) { + if (!tpEvent.getTo().getChunk().isLoaded()) + tpEvent.getTo().getChunk().load(); + pl.teleport(tpEvent.getTo()); + } + } + + }); id = Bukkit.getScheduler().runTaskTimer(AuthMe.authme, new Runnable() {