gpt4 book ai didi

org.bukkit.configuration.file.YamlConfiguration.isConfigurationSection()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 21:18:40 25 4
gpt4 key购买 nike

本文整理了Java中org.bukkit.configuration.file.YamlConfiguration.isConfigurationSection()方法的一些代码示例,展示了YamlConfiguration.isConfigurationSection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.isConfigurationSection()方法的具体详情如下:
包路径:org.bukkit.configuration.file.YamlConfiguration
类名称:YamlConfiguration
方法名:isConfigurationSection

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);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com