@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(); } } } }
public void setDefault(ConfigurationNode node) { if (node == null) { return; } this.load(node); for (CartProperties prop : this) { prop.load(node); } }