Browse Source

load plots on world load

Kajetan Johannes Hammerle 3 years ago
parent
commit
888a9bb375
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/me/hammerle/kp/snuviscript/commands/WorldCommands.java

+ 6 - 2
src/me/hammerle/kp/snuviscript/commands/WorldCommands.java

@@ -7,6 +7,7 @@ import org.bukkit.Location;
 import org.bukkit.World;
 import org.bukkit.WorldCreator;
 import me.hammerle.kp.KajetansPlugin;
+import me.hammerle.kp.plots.WorldPlotMap;
 
 public class WorldCommands {
     @SuppressWarnings("")
@@ -54,8 +55,11 @@ public class WorldCommands {
         });
         KajetansPlugin.scriptManager.registerFunction("world.getentities",
                 (sc, in) -> new ArrayList<>(((World) in[0].get(sc)).getEntities()));
-        KajetansPlugin.scriptManager.registerFunction("world.load",
-                (sc, in) -> Bukkit.createWorld(WorldCreator.name(in[0].getString(sc))));
+        KajetansPlugin.scriptManager.registerFunction("world.load", (sc, in) -> {
+            World w = Bukkit.createWorld(WorldCreator.name(in[0].getString(sc)));
+            WorldPlotMap.read(w.getName());
+            return w;
+        });
         KajetansPlugin.scriptManager.registerFunction("world.unload",
                 (sc, in) -> Bukkit.unloadWorld((World) in[0].get(sc), true));
     }