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); }
@Override public T convertSpecial(Object value, Class<?> valueType, T def) { String text = ConversionTypes.toString.convert(value); if (text != null) { return ParseUtil.parseEnum(getOutputType(), text, def); } else { return def; } }