@Override
 public void load(ConfigurationNode node) {
   this.setDisplayName(node.get("displayName", this.displayName));
   this.allowPlayerTake = node.get("allowPlayerTake", this.allowPlayerTake);
   this.collision = node.get("trainCollision", this.collision);
   this.soundEnabled = node.get("soundEnabled", this.soundEnabled);
   this.slowDown = node.get("slowDown", this.slowDown);
   if (node.contains("collision")) {
     this.mobCollision = node.get("collision.mobs", this.mobCollision);
     this.playerCollision = node.get("collision.players", this.playerCollision);
     this.miscCollision = node.get("collision.misc", this.miscCollision);
     this.trainCollision = node.get("collision.train", this.trainCollision);
   }
   this.speedLimit = MathUtil.clamp(node.get("speedLimit", this.speedLimit), 0, 20);
   this.requirePoweredMinecart = node.get("requirePoweredMinecart", this.requirePoweredMinecart);
   this.keepChunksLoaded = node.get("keepChunksLoaded", this.keepChunksLoaded);
   this.allowManualMovement = node.get("allowManualMovement", this.allowManualMovement);
   if (node.isNode("carts")) {
     for (ConfigurationNode cart : node.getNode("carts").getNodes()) {
       try {
         CartProperties prop = CartProperties.get(UUID.fromString(cart.getName()), this);
         this.add(prop);
         prop.load(cart);
       } catch (Exception ex) {
         ex.printStackTrace();
       }
     }
   }
 }
示例#2
0
 public void load(ConfigurationNode node) {
   this.keepSpawnInMemory = node.get("keepSpawnLoaded", this.keepSpawnInMemory);
   this.worldmode = WorldMode.get(node.get("environment", this.worldmode.getName()));
   this.chunkGeneratorName = node.get("chunkGenerator", String.class, this.chunkGeneratorName);
   if (LogicUtil.nullOrEmpty(this.chunkGeneratorName)) {
     this.chunkGeneratorName = null;
   }
   this.difficulty = node.get("difficulty", Difficulty.class, this.difficulty);
   this.gameMode = node.get("gamemode", GameMode.class, this.gameMode);
   this.clearInventory = node.get("clearInventory", this.clearInventory);
   String worldspawn = node.get("spawn.world", String.class);
   if (worldspawn != null) {
     double x = node.get("spawn.x", 0.0);
     double y = node.get("spawn.y", 64.0);
     double z = node.get("spawn.z", 0.0);
     double yaw = node.get("spawn.yaw", 0.0);
     double pitch = node.get("spawn.pitch", 0.0);
     this.spawnPoint = new Position(worldspawn, x, y, z, (float) yaw, (float) pitch);
   }
   this.holdWeather = node.get("holdWeather", this.holdWeather);
   this.formIce = node.get("formIce", this.formIce);
   this.formSnow = node.get("formSnow", this.formSnow);
   this.showRain = node.get("showRain", this.showRain);
   this.showSnow = node.get("showSnow", this.showSnow);
   this.pvp = node.get("pvp", this.pvp);
   this.forcedRespawn = node.get("forcedRespawn", this.forcedRespawn);
   this.allowHunger = node.get("hunger", this.allowHunger);
   this.rememberLastPlayerPosition =
       node.get("rememberlastplayerpos", this.rememberLastPlayerPosition);
   this.reloadWhenEmpty = node.get("reloadWhenEmpty", this.reloadWhenEmpty);
   for (String type : node.getList("deniedCreatures", String.class)) {
     type = type.toUpperCase();
     if (type.equals("ANIMALS")) {
       this.spawnControl.setAnimals(true);
     } else if (type.equals("MONSTERS")) {
       this.spawnControl.setMonsters(true);
     } else {
       EntityType t = ParseUtil.parseEnum(EntityType.class, type, null);
       if (t != null) {
         this.spawnControl.deniedCreatures.add(t);
       }
     }
   }
   long time = node.get("lockedtime", Integer.MIN_VALUE);
   if (time != Integer.MIN_VALUE) {
     this.timeControl.setTime(time);
     this.timeControl.setLocking(true);
   }
   this.defaultNetherPortal =
       node.get("defaultNetherPortal", String.class, this.defaultNetherPortal);
   this.defaultEnderPortal = node.get("defaultEndPortal", String.class, this.defaultEnderPortal);
   if (node.contains("defaultPortal")) {
     // Compatibility mode
     this.defaultNetherPortal = node.get("defaultPortal", String.class, this.defaultNetherPortal);
     node.set("defaultPortal", null);
   }
   this.OPlist = node.getList("operators", String.class, this.OPlist);
 }