Exemplo n.º 1
0
 public void saveDefault(ConfigurationNode node) {
   save(node);
   // Remove nodes we rather not see
   node.remove("environment");
   node.remove("name");
   node.remove("chunkGenerator");
   node.remove("spawn");
   node.remove("loaded");
 }
Exemplo n.º 2
0
  public void save(ConfigurationNode node) {
    // Set if the world can be directly accessed
    World w = this.getWorld();
    if (w != null) {
      this.difficulty = w.getDifficulty();
      this.keepSpawnInMemory = w.getKeepSpawnInMemory();
      this.autosave = w.isAutoSave();
    }
    if (this.worldname == null || this.worldname.equals(this.getConfigName())) {
      node.remove("name");
    } else {
      node.set("name", this.worldname);
    }
    node.set("loaded", w != null);
    node.set("keepSpawnLoaded", this.keepSpawnInMemory);
    node.set("environment", this.worldmode.getName());
    node.set("chunkGenerator", LogicUtil.fixNull(this.getChunkGeneratorName(), ""));
    node.set("clearInventory", this.clearInventory ? true : null);
    node.set("gamemode", this.gameMode == null ? "NONE" : this.gameMode.toString());

    if (this.timeControl.isLocked()) {
      node.set("lockedtime", this.timeControl.getTime());
    } else {
      node.remove("lockedtime");
    }

    ArrayList<String> creatures = new ArrayList<String>();
    for (EntityType type : this.spawnControl.deniedCreatures) {
      creatures.add(type.name());
    }
    node.set("forcedRespawn", this.forcedRespawn);
    node.set("rememberlastplayerpos", this.rememberLastPlayerPosition);
    node.set("pvp", this.pvp);
    node.set("defaultNetherPortal", this.defaultNetherPortal);
    node.set("defaultEndPortal", this.defaultEnderPortal);
    node.set("operators", this.OPlist);
    node.set("deniedCreatures", creatures);
    node.set("holdWeather", this.holdWeather);
    node.set("hunger", this.allowHunger);
    node.set("formIce", this.formIce);
    node.set("formSnow", this.formSnow);
    node.set("showRain", this.showRain);
    node.set("showSnow", this.showSnow);
    node.set("difficulty", this.difficulty == null ? "NONE" : this.difficulty.toString());
    node.set("reloadWhenEmpty", this.reloadWhenEmpty);
    if (this.spawnPoint == null) {
      node.remove("spawn");
    } else {
      node.set("spawn.world", this.spawnPoint.getWorldName());
      node.set("spawn.x", this.spawnPoint.getX());
      node.set("spawn.y", this.spawnPoint.getY());
      node.set("spawn.z", this.spawnPoint.getZ());
      node.set("spawn.yaw", (double) this.spawnPoint.getYaw());
      node.set("spawn.pitch", (double) this.spawnPoint.getPitch());
    }
  }
Exemplo n.º 3
0
 @Override
 public void save(ConfigurationNode node) {
   node.set("displayName", this.displayName.equals(this.trainname) ? null : this.displayName);
   node.set("soundEnabled", this.soundEnabled ? null : false);
   node.set("allowPlayerTake", this.allowPlayerTake ? null : false);
   node.set("requirePoweredMinecart", this.requirePoweredMinecart ? true : null);
   node.set("trainCollision", this.collision ? null : false);
   node.set("keepChunksLoaded", this.keepChunksLoaded ? true : null);
   node.set("speedLimit", this.speedLimit != 0.4 ? this.speedLimit : null);
   node.set("slowDown", this.slowDown ? null : false);
   node.set("allowManualMovement", allowManualMovement ? true : null);
   if (this.mobCollision != CollisionMode.DEFAULT) {
     node.set("collision.mobs", this.mobCollision);
   }
   if (this.playerCollision != CollisionMode.DEFAULT) {
     node.set("collision.players", this.playerCollision);
   }
   if (this.miscCollision != CollisionMode.DEFAULT) {
     node.set("collision.misc", this.miscCollision);
   }
   if (this.trainCollision != CollisionMode.LINK) {
     node.set("collision.train", this.trainCollision);
   }
   if (!this.isEmpty()) {
     ConfigurationNode carts = node.getNode("carts");
     for (CartProperties prop : this) {
       ConfigurationNode cart = carts.getNode(prop.getUUID().toString());
       prop.save(cart);
       if (cart.getKeys().isEmpty()) carts.remove(cart.getName());
     }
   }
 }