예제 #1
0
  public void open() {
    if (this.args.length == 2) {
      String worldName = this.args[1];
      World world = Bukkit.getWorld(worldName);
      if (world == null) {
        message("World <" + worldName + "> was not loaded. Loading world...");
        world = Bukkit.createWorld(WorldCreator.name(worldName));
        message("World <" + worldName + "> loaded");
      }
      if (this.editor.getWorlds().keySet().contains(world)) {
        message("World <" + worldName + "> is already openned in editor");
        return;
      }

      try {
        this.editor.addWorld(world);

      } catch (IOException e) {
        message("Error loading script map for world <" + worldName + ">...");
        e.printStackTrace();
        return;
      }

      this.editor.buildSigns(world);

      message("World <" + worldName + "> openned in editor");
      NSCore.log("World <" + worldName + "> openned in editor by " + this.sender.getName());
    }
  }
예제 #2
0
  public void close() {
    if (this.args.length == 2) {
      String worldName = this.args[1];
      World world = Bukkit.getWorld(worldName);

      if (!this.editor.getWorlds().keySet().contains(world)) {
        message("World <" + worldName + "> is not oppened in editor");
        return;
      }

      if (world != null) {
        this.editor.destroySigns(world);
        this.editor.getWorlds().remove(world);
        Bukkit.unloadWorld(worldName, true);
      }

      message("World <" + worldName + "> is now closed");
      NSCore.log("World <" + worldName + "> closed in editor by " + this.sender.getName());
    }
  }