Exemple #1
0
  public boolean load(Match match) {
    String name = "match-" + match.getID();
    File copyto = new File(name);
    try {
      FileUtil.copy(getFolder(), copyto);
      File sessionLock = new File(copyto.getAbsolutePath() + "/session.lock");
      if (sessionLock.exists()) {
        FileUtil.delete(sessionLock);
      }
      File uid = new File(copyto.getAbsolutePath() + "/uid.dat");
      if (uid.exists()) {
        FileUtil.delete(uid);
      }
      File old = new File(copyto.getAbsolutePath() + "/level.dat_old");
      if (old.exists()) {
        FileUtil.delete(old);
      }
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }

    WorldCreator creator = new WorldCreator(name);
    creator.generator(new NullChunkGenerator());
    this.world = creator.createWorld();

    startModules(ModuleStage.LOAD);
    this.timer.setMatch(match);

    scoreboard();
    for (VisibleRegion region : visible) {
      region.set(world);
    }

    for (VisibleRegion region : visible) {
      Log.info(
          "Using "
              + region.getMaterial().name()
              + ":"
              + region.getDye().name()
              + " for "
              + region.getRegion());
    }

    return true;
  }
Exemple #2
0
  public boolean unload(Match match) {
    String name = "match-" + match.getID();
    File delete = new File(name);

    stopModules(ModuleStage.LOAD);
    World world = Spork.get().getServer().getWorld(name);
    Spork.get().getServer().unloadWorld(world, false);
    FileUtil.delete(delete);

    return true;
  }