本文整理汇总了Java中org.bukkit.configuration.Configuration.isConfigurationSection方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.isConfigurationSection方法的具体用法?Java Configuration.isConfigurationSection怎么用?Java Configuration.isConfigurationSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.isConfigurationSection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
@Override
public void load() {
Configuration config = YamlLoader.loadResource(plugin, "config.yml");
for (String k : config.getKeys(true)) {
if (!config.isConfigurationSection(k)) {
this.put(k, config.getString(k));
}
}
}
示例2: load
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void load() {
Configuration config = YamlLoader.loadResource(plugin, "messages.yml");
for (String k : config.getKeys(true)) {
if (!config.isConfigurationSection(k)) {
this.put(k, config.getString(k));
}
}
}
示例3: validateWorldSection
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
/**
* Validates a specific world's configuration.
*
* @param worldName The name of the world.
* @param config The root configuration.
* @param warnTo The player to complain to if something is wrong.
* @param plugin The instance of the plugin.
*/
private static void validateWorldSection(String worldName,
Configuration config, CommandSender warnTo, WDLCompanion plugin) {
String fullKey = "wdl.per-world." + worldName;
if (!config.isSet(fullKey)) {
warnTo.sendMessage("�e[WDL] WARNING: Per-world config validation " +
"issue -- tested wdl.per-world." + worldName + ", but it " +
"doesn't exist! This should NOT happen!");
return;
}
if (!config.isConfigurationSection(fullKey)) {
warnTo.sendMessage("�c[WDL] ERROR: Config setting " +
fullKey + " is not a mapping! The global values " +
"will be used instead!");
}
ConfigurationSection section = config.getConfigurationSection(fullKey);
validateIsBoolOrUnset("canDoNewThings", section, warnTo);
validateIsBoolOrUnset("canDownloadInGeneral", section, warnTo);
validateIsIntOrUnset("saveRadius", section, warnTo);
validateIsBoolOrUnset("canCacheChunks", section, warnTo);
validateIsBoolOrUnset("canSaveEntities", section, warnTo);
validateIsBoolOrUnset("canSaveTileEntities", section, warnTo);
validateIsBoolOrUnset("canSaveContainers", section, warnTo);
validateIsBoolOrUnset("sendEntityRanges", section, warnTo);
validateIsStringOrUnset("requestMessage", section, warnTo);
validateStringLength("requestMessage", section, 15000, warnTo);
List<String> keys = new ArrayList<>(section.getKeys(false));
keys.removeAll(worldConfigOptions);
if (!keys.isEmpty()) {
warnTo.sendMessage("�c[WDL] WARNING: There are config settings " +
"that are not recongised! They are:");
for (String key : keys) {
warnTo.sendMessage("�c[WDL] * " + section.getCurrentPath()
+ "." + key);
}
}
}
示例4: loadFromConfiguration
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public void loadFromConfiguration(Configuration config) {
elementsMap.clear();
if (!config.isConfigurationSection("scoreboard-elements")) {
return;
}
ConfigurationSection elementsRoot = config.getConfigurationSection("scoreboard-elements");
String textPath, priorityPath, delayPath;
for (String child : elementsRoot.getKeys(false)) {
if (!elementsRoot.isConfigurationSection(child)) {
continue;
}
textPath = child + ".text";
priorityPath = child + ".priority";
delayPath = child + ".delay";
if (!elementsRoot.isInt(priorityPath)) {
plugin.getLogger().severe(
"Scoreboard element '" + child + "' in config has no priority property");
continue;
} else if (!elementsRoot.contains(textPath)) {
plugin.getLogger().severe(
"Scoreboard element '" + child + "' in config has no text property");
continue;
}
int priority = elementsRoot.getInt(priorityPath);
long delay = elementsRoot.getLong(delayPath, -1);
List<FrameSupply> supplyList = Lists.newArrayList();
if (elementsRoot.isConfigurationSection(textPath)) {
for (String line : elementsRoot.getConfigurationSection(textPath).getKeys(false)) {
String linePath = textPath + "." + line;
addSupply(supplyList, elementsRoot, linePath);
}
} else {
addSupply(supplyList, elementsRoot, textPath);
}
if (supplyList.isEmpty()) {
plugin.getLogger().severe("Scoreboard element '" + child
+ "' text property is incorrectly defined");
continue;
}
elementsMap.put(child, ScoreboardElement.of(plugin, priority, delay, supplyList));
}
}