From 6944471ad619cf94bf6b3819fd95903e6227fed5 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Wed, 5 Aug 2015 02:57:28 +1000 Subject: [PATCH] Fixed template teleportation if the world hasn't loaded fully --- .../plot/commands/DebugRoadRegen.java | 3 --- .../plot/commands/Template.java | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java index 9a4d2e28e..ad3aa60d0 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java @@ -64,9 +64,6 @@ public class DebugRoadRegen extends SubCommand { manager.createRoadSouthEast(plotworld, plot); MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.id + "\n&6 - Result: &aSuccess"); } - - - return true; } } diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/src/main/java/com/intellectualcrafters/plot/commands/Template.java index 946ce5a84..b73eecb22 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -41,6 +41,7 @@ import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.SetBlockQueue; import com.intellectualcrafters.plot.util.SetupUtils; import com.intellectualcrafters.plot.util.TaskManager; import com.plotsquared.general.commands.CommandDeclaration; @@ -178,8 +179,13 @@ public class Template extends SubCommand { setup.step = new ConfigurationNode[0]; setup.world = world; SetupUtils.manager.setupWorld(setup); - MainUtil.sendMessage(plr, "Done!"); - plr.teleport(BlockManager.manager.getSpawn(world)); + SetBlockQueue.addNotify(new Runnable() { + @Override + public void run() { + MainUtil.sendMessage(plr, "Done!"); + plr.teleport(BlockManager.manager.getSpawn(world)); + } + }); return true; } case "export": { @@ -210,7 +216,10 @@ public class Template extends SubCommand { }); return true; } + default: { + C.COMMAND_SYNTAX.send(plr, this.getUsage()); + } } - return true; + return false; } }