mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 23:52:11 -07:00
Added createSection(String path, Map<String, object> map)
By: Feildmaster <admin@feildmaster.com>
This commit is contained in:
@@ -164,6 +164,17 @@ public interface ConfigurationSection {
|
||||
* @return Newly created section
|
||||
*/
|
||||
public ConfigurationSection createSection(String path);
|
||||
|
||||
/**
|
||||
* Creates a {@link ConfigurationSection} at the specified path, with specified values.
|
||||
* <p>
|
||||
* Any value that was previously set at this path will be overwritten. If the
|
||||
* previous value was itself a {@link ConfigurationSection}, it will be orphaned.
|
||||
*
|
||||
* @param path Path to create the section at.
|
||||
* @return Newly created section
|
||||
*/
|
||||
public ConfigurationSection createSection(String path, Map<String, Object> map);
|
||||
|
||||
// Primitives
|
||||
/**
|
||||
|
@@ -266,6 +266,20 @@ public class MemorySection implements ConfigurationSection {
|
||||
return section.createSection(key);
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigurationSection createSection(String path, Map<String, Object> map) {
|
||||
ConfigurationSection section = createSection(path);
|
||||
|
||||
for(Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
if(entry.getValue() instanceof Map) {
|
||||
section.createSection(entry.getKey(), (Map<String, Object>)entry.getValue());
|
||||
} else {
|
||||
section.set(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
// Primitives
|
||||
public String getString(String path) {
|
||||
|
Reference in New Issue
Block a user