@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 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; }
@Override public boolean getBoolean(String path) { return configFile.getBoolean(path); }
@Override public Boolean getBoolean(Object file, String path) { return ((YamlConfiguration) file).getBoolean(path); }
@Override public boolean getBoolean(Object file, String path, boolean def) { return ((YamlConfiguration) file).getBoolean(path, def); }
private static void loadConfig() { loadDefaultFiles(new String[]{ "config.yml" }); YamlConfiguration yaml = YamlConfiguration.loadConfiguration(CFG); doc = yaml.getBoolean("doc"); mcstats = yaml.getBoolean("mcstats-enable"); debug = yaml.getBoolean("debug"); WildSkript.debug = debug; }
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException | InvalidConfigurationException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } return configuration.getBoolean("opt-out", false); } }
public void load() { InputStreamReader reader = mcMMO.p.getResourceAsReader(fileName); if (reader != null) { config = YamlConfiguration.loadConfiguration(reader); chunkletsEnabled = config.getBoolean("Options.Chunklets", true); conversionRate = config.getInt("Options.ConversionRate", 1); useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true); uuidConvertAmount = config.getInt("Options.UUIDConvertAmount", 5); mojangRateLimit = config.getInt("Options.MojangRateLimit", 50000); mojangLimitPeriod = config.getLong("Options.MojangLimitPeriod", 600000); } }
/** * Has the server owner denied plugin metrics? * * @return true if metrics should be opted out of it */ public boolean isOptOut(){ synchronized(optOutLock){ try{ // Reload the metrics file configuration.load(getConfigFile()); } catch(IOException | InvalidConfigurationException ex){ if(debug){ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } return configuration.getBoolean("opt-out", false); } }
/** * Has the server owner denied plugin metrics? * * @return true if metrics should be opted out of it */ public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException | InvalidConfigurationException ex) { if (debug) { PluginLogger.info("[Metrics] " + ex.getMessage()); } return true; } return configuration.getBoolean("opt-out", false); } }
public boolean getSetBoolean(String path, boolean defaultBoolean) throws InvalidConfigurationException { if (config.isBoolean(path)) { return config.getBoolean(path); } else if (config.contains(path)) { throw new InvalidConfigurationException("Object " + config.get(path) + " found under " + path + " in file " + configFile.toAbsolutePath() + " is not a boolean (true/false)"); } else { logger.log(Level.INFO, "Setting {0} to {1} in file {2}", new Object[]{path, defaultBoolean, configFile}); config.set(path, defaultBoolean); return defaultBoolean; } }
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } catch (InvalidConfigurationException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } return configuration.getBoolean("opt-out", false); } }
private AddonDescription asDescription(YamlConfiguration data) { AddonDescription.Builder builder = new AddonDescription.Builder(data.getString("main"), data.getString("name"), data.getString("version")) .authors(data.getString("authors")) .metrics(data.getBoolean("metrics")); if (data.getString("depend") != null) { builder.dependencies(Arrays.asList(data.getString("depend").split("\\s*,\\s*"))); } if (data.getString("softdepend") != null) { builder.softDependencies(Arrays.asList(data.getString("softdepend").split("\\s*,\\s*"))); } return builder.build(); }
public McStatsMetrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); // add some defaults configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); // Do we need to create the file? if (configuration.get("guid", null) == null) { configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } // Load the guid then guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); }
public McStatsMetrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); // add some defaults configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); // Do we need to create the file? if (configuration.get("guid", null) == null) { configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } // Load the guid then guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); }
public MetricsLite(Plugin plugin) throws IOException{ if(plugin == null){ throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); // add some defaults configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); // Do we need to create the file? if(configuration.get("guid", null) == null){ configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } // Load the guid then guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); }
public MetricsLite(Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); // add some defaults configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); // Do we need to create the file? if (configuration.get("guid", null) == null) { configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } // Load the guid then guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); }
public Metrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); // add some defaults configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); // Do we need to create the file? if (configuration.get("guid", null) == null) { configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } // Load the guid then guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); }
public Metrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); // add some defaults configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); // Do we need to create the file? if (configuration.get("guid", null) == null) { configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } // Load the guid then guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); }
@Override protected void enable() { SqlProvider sqlProvider = getService(SqlProvider.class); Sql sql; // load sql instance YamlConfiguration config = loadConfig("config.yml"); if (config.getBoolean("use-global-credentials", true)) { sql = sqlProvider.getSql(); } else { sql = sqlProvider.getSql(DatabaseCredentials.fromConfig(config)); } // init the table String tableName = config.getString("table-name", "helper_profiles"); int preloadAmount = config.getInt("preload-amount", 2000); // provide the ProfileRepository service provideService(ProfileRepository.class, bindModule(new HelperProfileRepository(sql, tableName, preloadAmount))); }