Fixed template teleportation if the world hasn't loaded fully

This commit is contained in:
boy0001 2015-08-05 02:57:28 +10:00
parent 64bb860594
commit 6944471ad6
2 changed files with 12 additions and 6 deletions

View File

@ -64,9 +64,6 @@ public class DebugRoadRegen extends SubCommand {
manager.createRoadSouthEast(plotworld, plot); manager.createRoadSouthEast(plotworld, plot);
MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.id + "\n&6 - Result: &aSuccess"); MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.id + "\n&6 - Result: &aSuccess");
} }
return true; return true;
} }
} }

View File

@ -41,6 +41,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SetBlockQueue;
import com.intellectualcrafters.plot.util.SetupUtils; import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
@ -178,8 +179,13 @@ public class Template extends SubCommand {
setup.step = new ConfigurationNode[0]; setup.step = new ConfigurationNode[0];
setup.world = world; setup.world = world;
SetupUtils.manager.setupWorld(setup); SetupUtils.manager.setupWorld(setup);
SetBlockQueue.addNotify(new Runnable() {
@Override
public void run() {
MainUtil.sendMessage(plr, "Done!"); MainUtil.sendMessage(plr, "Done!");
plr.teleport(BlockManager.manager.getSpawn(world)); plr.teleport(BlockManager.manager.getSpawn(world));
}
});
return true; return true;
} }
case "export": { case "export": {
@ -210,7 +216,10 @@ public class Template extends SubCommand {
}); });
return true; return true;
} }
} default: {
return true; C.COMMAND_SYNTAX.send(plr, this.getUsage());
}
}
return false;
} }
} }