本文整理了Java中org.bukkit.configuration.file.YamlConfiguration.getInt()
方法的一些代码示例,展示了YamlConfiguration.getInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.getInt()
方法的具体详情如下:
包路径:org.bukkit.configuration.file.YamlConfiguration
类名称:YamlConfiguration
方法名:getInt
暂无
代码示例来源:origin: GlowstoneMC/Glowstone
@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;
}
代码示例来源:origin: GlowstoneMC/Glowstone
@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;
}
代码示例来源:origin: com.greatmancode/tools
@Override
public int getInt(String path) {
return configFile.getInt(path);
}
代码示例来源:origin: DevLeoko/AdvancedBan
@Override
public Integer getInteger(Object file, String path) {
return ((YamlConfiguration) file).getInt(path);
}
代码示例来源:origin: DevLeoko/AdvancedBan
@Override
public int getInteger(Object file, String path, int def) {
return ((YamlConfiguration) file).getInt(path, def);
}
代码示例来源:origin: mcMMO-Dev/mcMMO
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);
}
}
代码示例来源:origin: games647/LagMonitor
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;
}
}
代码示例来源:origin: SkyWars/SkyWars
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;
}
}
代码示例来源:origin: gvlfm78/BukkitOldCombatMechanics
/**
* @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;
}
代码示例来源:origin: SkyWars/SkyWars
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()) {
代码示例来源:origin: SkyWars/SkyWars
if (config.getInt("configuration-version") <= 1) {
if (config.getInt("configuration-version") <= 0) {
updateVersion0To1(config);
代码示例来源:origin: sgtcaze/NametagEdit
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);
}
代码示例来源:origin: sgtcaze/NametagEdit
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;
}
代码示例来源:origin: ChestShop-authors/ChestShop-3
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;
}
代码示例来源:origin: mcMMO-Dev/mcMMO
party.setPassword(partiesFile.getString(partyName + ".Password"));
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
party.setLevel(partiesFile.getInt(partyName + ".Level"));
party.setXp(partiesFile.getInt(partyName + ".Xp"));
代码示例来源:origin: NyaaCat/RPGItems-reloaded
itemStorage.loadFromString(v);
String origin = itemStorage.getString("name");
int uid = itemStorage.getInt("uid");
代码示例来源:origin: mcMMO-Dev/mcMMO
party.setPassword(partiesFile.getString(partyName + ".Password"));
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
party.setLevel(partiesFile.getInt(partyName + ".Level"));
party.setXp(partiesFile.getInt(partyName + ".Xp"));
代码示例来源:origin: lucko/helper
@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)));
}
代码示例来源:origin: echurchill/CityWorld
if (metaFile.exists()) {
metaYaml.load(metaFile);
groundLevelY = Math.max(0, metaYaml.getInt(tagGroundLevelY, groundLevelY));
flipableX = metaYaml.getBoolean(tagFlipableX, flipableX);
flipableZ = metaYaml.getBoolean(tagFlipableZ, flipableZ);
代码示例来源:origin: drtshock/PlayerVaults
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);
内容来源于网络,如有侵权,请联系作者删除!