Ensure world loading occurs on the main thread

This commit is contained in:
Jesse Boyd 2017-04-11 01:49:01 +10:00
parent ddfcc5b077
commit 7eb7cd9b53
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -9,8 +9,10 @@ import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotLoc; import com.intellectualcrafters.plot.object.PlotLoc;
import com.intellectualcrafters.plot.object.PlotSettings; import com.intellectualcrafters.plot.object.PlotSettings;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.SetupUtils; import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
public class SinglePlotArea extends GridPlotWorld { public class SinglePlotArea extends GridPlotWorld {
@ -30,7 +32,10 @@ public class SinglePlotArea extends GridPlotWorld {
VOID = config.getBoolean("void", false); VOID = config.getBoolean("void", false);
} }
public void loadWorld(PlotId id) { public void loadWorld(final PlotId id) {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override
public void run(Object value) {
String worldName = id.toCommaSeparatedString(); String worldName = id.toCommaSeparatedString();
if (WorldUtil.IMP.isWorld(worldName)) return; if (WorldUtil.IMP.isWorld(worldName)) return;
SetupObject setup = new SetupObject(); SetupObject setup = new SetupObject();
@ -41,6 +46,8 @@ public class SinglePlotArea extends GridPlotWorld {
setup.step = new ConfigurationNode[0]; setup.step = new ConfigurationNode[0];
setup.world = worldName; setup.world = worldName;
SetupUtils.manager.setupWorld(setup); SetupUtils.manager.setupWorld(setup);
}
});
// String worldName = plot.getWorldName(); // String worldName = plot.getWorldName();
// World world = Bukkit.getWorld(worldName); // World world = Bukkit.getWorld(worldName);
// if (world != null) { // if (world != null) {