本文整理匯總了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));
}
}