@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; }
@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 int getInt(String path) { return configFile.getInt(path); }
@Override public Integer getInteger(Object file, String path) { return ((YamlConfiguration) file).getInt(path); }
@Override public int getInteger(Object file, String path, int def) { return ((YamlConfiguration) file).getInt(path, def); }
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); } }
public PaperTimingsCommand(LagMonitor plugin) { super(plugin); try { historyInterval = Reflection.getField("com.destroystokyo.paper.PaperConfig", "config" , YamlConfiguration.class).get(null).getInt("timings.history-interval"); } catch (IllegalArgumentException illegalArgumentException) { //cannot find paper spigot historyInterval = -1; } }
public int getSetInt(String path, int defaultInt) throws InvalidConfigurationException { if (config.isInt(path)) { return config.getInt(path); } else if (config.contains(path)) { throw new InvalidConfigurationException("Object " + config.get(path) + " found under " + path + " in file " + configFile.toAbsolutePath() + " is not an integer"); } else { logger.log(Level.INFO, "Setting {0} to {1} in file {2}", new Object[]{path, defaultInt, configFile}); config.set(path, defaultInt); return defaultInt; } }
/** * @return Whether config was changed or not */ private static boolean checkConfigVersion(){ YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(plugin.getResource("config.yml"))); if(config.getInt("config-version") != defaultConfig.getInt("config-version")){ plugin.getLogger().warning("Config version does not match, backing up old config and creating a new one"); plugin.upgradeConfig(); reload(); return true; } return false; }
throw new SkyConfigurationException("Couldn't load internal translation yaml file " + file, ex); messagesVersion = config.getInt("messages-version"); Map<TransKey, String> internal = new EnumMap<>(TransKey.class); for (TransKey key : TransKey.values()) {
private void loadGroups() { List<GroupData> groupData = new ArrayList<>(); for (String groupName : groups.getConfigurationSection("Groups").getKeys(false)) { GroupData data = new GroupData(); data.setGroupName(groupName); data.setPermission(groups.getString("Groups." + groupName + ".Permission", "nte.default")); data.setPrefix(groups.getString("Groups." + groupName + ".Prefix", "")); data.setSuffix(groups.getString("Groups." + groupName + ".Suffix", "")); data.setSortPriority(groups.getInt("Groups." + groupName + ".SortPriority", -1)); groupData.add(data); } handler.assignGroupData(groupData); }
public static PlayerData fromFile(String key, YamlConfiguration file) { if (!file.contains("Players." + key)) return null; PlayerData data = new PlayerData(); data.setUuid(UUID.fromString(key)); data.setName(file.getString("Players." + key + ".Name")); data.setPrefix(file.getString("Players." + key + ".Prefix", "")); data.setSuffix(file.getString("Players." + key + ".Suffix", "")); data.setSortPriority(file.getInt("Players." + key + ".SortPriority", -1)); return data; }
private boolean handleMigrations() { File versionFile = loadFile("version"); YamlConfiguration previousVersion = YamlConfiguration.loadConfiguration(versionFile); if (previousVersion.get("version") == null) { previousVersion.set("version", Migrations.CURRENT_DATABASE_VERSION); try { previousVersion.save(versionFile); } catch (IOException e) { e.printStackTrace(); } } int lastVersion = previousVersion.getInt("version"); int newVersion = Migrations.migrate(lastVersion); if (newVersion == -1) { plugin.getLogger().log(java.util.logging.Level.SEVERE, "Error while migrating! ChestShop can not run with a broken/outdated database..."); plugin.getServer().getPluginManager().disablePlugin(this); return false; } else if (lastVersion != newVersion) { previousVersion.set("version", newVersion); try { previousVersion.save(versionFile); } catch (IOException e) { e.printStackTrace(); } } return true; }
itemStorage.loadFromString(v); String origin = itemStorage.getString("name"); int uid = itemStorage.getInt("uid");
@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))); }
if (metaFile.exists()) { metaYaml.load(metaFile); groundLevelY = Math.max(0, metaYaml.getInt(tagGroundLevelY, groundLevelY)); flipableX = metaYaml.getBoolean(tagFlipableX, flipableX); flipableZ = metaYaml.getBoolean(tagFlipableZ, flipableZ);
int z = l.getBlockZ(); if (plugin.getSigns().getKeys(false).contains(world + ";;" + x + ";;" + y + ";;" + z)) { int num = PlayerVaults.getInstance().getSigns().getInt(world + ";;" + x + ";;" + y + ";;" + z + ".chest", 1); if (player.hasPermission("playervaults.signs.use") || player.hasPermission("playervaults.signs.bypass")) { boolean self = PlayerVaults.getInstance().getSigns().getBoolean(world + ";;" + x + ";;" + y + ";;" + z + ".self", false);