let bukkit load the chunk

This commit is contained in:
DNx5 2015-11-03 03:56:20 +07:00
parent 872856e729
commit 3ede8f0dae

View File

@ -216,17 +216,15 @@ public class Utils {
if (theWorld == null) if (theWorld == null)
theWorld = pl.getWorld(); theWorld = pl.getWorld();
final World world = theWorld; final World world = theWorld;
final Location locat = new Location(world, x, y, z); final Location loc = new Location(world, x, y, z);
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, locat); AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, loc);
plugin.getServer().getPluginManager().callEvent(tpEvent); plugin.getServer().getPluginManager().callEvent(tpEvent);
if (!tpEvent.isCancelled()) { if (!tpEvent.isCancelled()) {
if (!tpEvent.getTo().getChunk().isLoaded())
tpEvent.getTo().getChunk().load();
pl.teleport(tpEvent.getTo()); pl.teleport(tpEvent.getTo());
} }
} }