@Override public YamlConfigurationOptions header(String value) { super.header(value); return this; }
@Override public YamlConfigurationOptions copyHeader(boolean value) { super.copyHeader(value); return this; }
@Override public YamlConfigurationOptions pathSeparator(char value) { super.pathSeparator(value); return this; }
/** * Save the configuration back to file. */ public void save() { try { config.save(configFile); } catch (IOException e) { GlowServer.logger.log(Level.SEVERE, "Failed to write config: " + configFile, e); } }
@Override public boolean getBoolean(Key key) { if (parameters.containsKey(key)) { return (Boolean) parameters.get(key); } boolean bool = config.getBoolean(key.path, (Boolean) key.def); parameters.put(key, bool); return bool; }
@Override public String saveToString() { yamlOptions.setIndent(options().indent()); yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); yamlOptions.setAllowUnicode(SYSTEM_UTF); yamlRepresenter.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); String header = buildHeader(); String dump = yaml.dump(getValues(false)); if (dump.equals(BLANK_CONFIG)) { dump = ""; } return header + dump; }
/** * Change a configuration value at runtime. * * @param key the config key to write the value to * @param value value to write to config key * @see #save() */ public void set(Key key, Object value) { cache.replace(key, value); config.set(key.path, value); }
@Override public YamlConfigurationOptions copyDefaults(boolean value) { super.copyDefaults(value); return this; }
public ConfigurationSection getWorlds() { return config.getConfigurationSection("worlds"); }
@Override public int getInt(Key key) { if (cache.containsKey(key)) { return (Integer) cache.get(key); } int integer = config.getInt(key.path, (Integer) key.def); cache.put(key, integer); return integer; }
@Override public double getDouble(Key key) { if (cache.containsKey(key)) { return (Double) cache.get(key); } double doub = config.getDouble(key.path, (Double) key.def); cache.put(key, doub); return doub; }
public YamlRepresenter() { this.multiRepresenters.put(ConfigurationSection.class, new RepresentConfigurationSection()); this.multiRepresenters.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable()); }
@Override public YamlConfiguration configuration() { return (YamlConfiguration) super.configuration(); }
@Override public FileConfigurationOptions options() { if (options == null) { options = new FileConfigurationOptions(this); } return (FileConfigurationOptions) options; } }
@Override public YamlConfigurationOptions options() { if (options == null) { options = new YamlConfigurationOptions(this); } return (YamlConfigurationOptions) options; }
public YamlConstructor() { this.yamlConstructors.put(Tag.MAP, new ConstructCustomObject()); }
/** * Save the configuration back to file. */ public void save() { try { config.save(configFile); } catch (IOException e) { GlowServer.logger.log(Level.SEVERE, "Failed to write config: " + configFile, e); } }
@Override public boolean getBoolean(Key key) { if (cache.containsKey(key)) { return (Boolean) cache.get(key); } boolean bool = config.getBoolean(key.path, (Boolean) key.def); cache.put(key, bool); return bool; }
/** * Change a configuration value at runtime. * * @param key the config key to write the value to * @param value value to write to config key * @see ServerConfig#save() */ public void set(Key key, Object value) { parameters.replace(key, value); config.set(key.path, value); }
@Override public int getInt(Key key) { if (parameters.containsKey(key)) { return (Integer) parameters.get(key); } int integer = config.getInt(key.path, (Integer) key.def); parameters.put(key, integer); return integer; }