--- miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/HomeCommand.java 2011/12/21 11:05:51 1665 +++ miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/HomeCommand.java 2011/12/21 16:42:43 1666 @@ -41,7 +41,7 @@ if (!(sender instanceof Player)) { return false; } - Player p = (Player) sender; + final Player p = (Player) sender; String name = p.getName(); @@ -56,10 +56,21 @@ double z = config.getDouble( name + ".z", 0.0); World world = p.getServer().getWorld(worldName); + int blockX = (int) Math.floor(x); + int blockZ = (int) Math.floor(z); + world.loadChunk(blockX, blockZ); + + final Location loc = new Location( world, x, y, z, (float)yaw, (float)pitch); + + Runnable r = new Runnable() { + public void run() { + p.teleport(loc); + } + }; + int tickCount = 2; // 2 ticks = 100ms - Location loc = new Location( world, x, y, z, (float)yaw, (float)pitch); + p.getServer().getScheduler().scheduleSyncDelayedTask(plugin, r, tickCount); - p.teleport(loc); } else { p.sendMessage(ChatColor.YELLOW + "You haven't set a home yet!"); }