本文整理了Java中org.bukkit.configuration.file.YamlConfiguration.isConfigurationSection()
方法的一些代码示例,展示了YamlConfiguration.isConfigurationSection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.isConfigurationSection()
方法的具体详情如下:
包路径:org.bukkit.configuration.file.YamlConfiguration
类名称:YamlConfiguration
方法名:isConfigurationSection
暂无
代码示例来源:origin: SkyWars/SkyWars
public Map<String, String> getSetStringMap(String path, Map<String, String> defaultValues) throws InvalidConfigurationException {
if (config.isConfigurationSection(path)) {
ConfigurationSection section = config.getConfigurationSection(path);
Map<String, Object> entries = section.getValues(false);
Map<String, String> values = new HashMap<>(entries.size());
for (Map.Entry<String, Object> entry : entries.entrySet()) {
Object obj = entry.getValue();
if (obj instanceof String) {
values.put(entry.getKey(), (String) obj);
} else if (obj instanceof Double || obj instanceof Integer || obj instanceof Boolean) {
values.put(entry.getKey(), obj.toString());
} else {
throw new InvalidConfigurationException("Object " + obj + " found in map " + path + " in file " + configFile.toAbsolutePath() + " is not an integerr");
}
}
return values;
} else if (config.contains(path)) {
throw new InvalidConfigurationException("Object " + config.get(path) + " found under " + path + " in file " + configFile + " is not a map");
} else {
logger.log(Level.INFO, "Setting {0} to {1} in file {2}", new Object[]{path, defaultValues, configFile});
ConfigurationSection section = config.createSection(path);
for (Map.Entry<String, String> entry : defaultValues.entrySet()) {
section.set(entry.getKey(), entry.getValue());
}
return defaultValues;
}
}
代码示例来源:origin: SkyWars/SkyWars
public ConfigurationSection getSetSection(String path, Map<String, String> defaultValues) throws InvalidConfigurationException {
if (config.isConfigurationSection(path)) {
return config.getConfigurationSection(path);
} else if (config.contains(path)) {
throw new InvalidConfigurationException("Object " + config.get(path) + " found under " + path + " in file " + configFile + " is not a configuration section");
} else {
logger.log(Level.INFO, "Setting {0} to {1} in file {2}", new Object[]{path, defaultValues, configFile});
ConfigurationSection section = config.createSection(path);
for (Map.Entry<String, String> entry : defaultValues.entrySet()) {
section.set(entry.getKey(), entry.getValue());
}
return section;
}
}
代码示例来源:origin: elBukkit/MagicPlugin
protected void describeParameters(CommandSender sender) {
Collection<String> keys = parameters.getKeys(false);
if (keys.size() == 0) {
sender.sendMessage(ChatColor.GRAY + " (None)");
}
for (String key : keys) {
String value = null;
if (parameters.isConfigurationSection(key)) {
ConfigurationSection child = parameters.getConfigurationSection(key);
value = "(" + child.getKeys(false).size() + " values)";
} else {
value = parameters.getString(key);
}
sender.sendMessage(ChatColor.LIGHT_PURPLE + " " + key + ": " + value);
}
}
代码示例来源:origin: BentoBoxWorld/BentoBox
addon.setDescription(asDescription(data));
if (data.isConfigurationSection("permissions")) {
ConfigurationSection perms = data.getConfigurationSection("permissions");
perms.getKeys(true).forEach(perm -> {
代码示例来源:origin: SkyWars/SkyWars
if (config.isConfigurationSection(key)) {
SkyKit kit;
try {
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
if (cfg.isConfigurationSection("spawner")) {
spawner = cfg.getConfigurationSection("spawner").getValues(false);
代码示例来源:origin: BedwarsRel/BedwarsRel
if (cfg.isConfigurationSection("spawner")) {
spawner = cfg.getConfigurationSection("spawner").getValues(false);
内容来源于网络,如有侵权,请联系作者删除!