public void saveTo(ConfigurationSection warConfigSection) { for (WarConfig config : WarConfig.values()) { if (this.bag.containsKey(config)) { warConfigSection.set(config.toString(), this.bag.get(config)); } } }
public String updateFromNamedParams(Map<String, String> namedParams) { String returnMessage = ""; for (String namedParam : namedParams.keySet()) { WarConfig warConfig = WarConfig.warConfigFromString(namedParam); if (warConfig != null) { if (warConfig.getConfigType().equals(Integer.class)) { int intValue = Integer.parseInt(namedParams.get(namedParam)); this.bag.put(warConfig, intValue); } else if (warConfig.getConfigType().equals(Boolean.class)) { String onOff = namedParams.get(namedParam); this.bag.put(warConfig, onOff.equals("on") || onOff.equals("true")); } returnMessage += warConfig.toString() + " set to " + namedParams.get(namedParam); } } return returnMessage; }
public void loadFrom(ConfigurationSection warConfigSection) { for (WarConfig config : WarConfig.values()) { if (warConfigSection.contains(config.toString())) { if (config.getConfigType().equals(Integer.class)) { this.put(config, warConfigSection.getInt(config.toString())); } else if (config.getConfigType().equals(Boolean.class)) { this.put(config, warConfigSection.getBoolean(config.toString())); } } } }