コード例 #1
0
ファイル: MemorySection.java プロジェクト: Worzaii/Bukkit
  public Map<String, Object> getValues(boolean deep) {
    Map<String, Object> result = new LinkedHashMap<String, Object>();

    if (getRoot().options().copyDefaults()) {
      ConfigurationSection defaults = getDefaultSection();

      if (defaults != null) {
        result.putAll(defaults.getValues(deep));
      }
    }

    mapChildrenValues(result, this, deep);

    return result;
  }
コード例 #2
0
  protected void mapChildrenValues(
      Map<String, Object> output, ConfigurationSection section, boolean deep) {
    if (section instanceof MemorySection) {
      MemorySection sec = (MemorySection) section;

      for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
        output.put(createPath(section, entry.getKey(), this), entry.getValue());

        if (entry.getValue() instanceof ConfigurationSection) {
          if (deep) {
            mapChildrenValues(output, (ConfigurationSection) entry.getValue(), deep);
          }
        }
      }
    } else {
      Map<String, Object> values = section.getValues(deep);

      for (Map.Entry<String, Object> entry : values.entrySet()) {
        output.put(createPath(section, entry.getKey(), this), entry.getValue());
      }
    }
  }