diff --git a/paper-api/src/main/java/org/bukkit/configuration/ConfigurationSection.java b/paper-api/src/main/java/org/bukkit/configuration/ConfigurationSection.java
index 0843c04ec4..3bd6fe3749 100644
--- a/paper-api/src/main/java/org/bukkit/configuration/ConfigurationSection.java
+++ b/paper-api/src/main/java/org/bukkit/configuration/ConfigurationSection.java
@@ -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.
+ *
+ * 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 map);
// Primitives
/**
diff --git a/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java b/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java
index 46965c2312..68254d0a3e 100644
--- a/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java
+++ b/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java
@@ -266,6 +266,20 @@ public class MemorySection implements ConfigurationSection {
return section.createSection(key);
}
}
+
+ public ConfigurationSection createSection(String path, Map map) {
+ ConfigurationSection section = createSection(path);
+
+ for(Map.Entry entry : map.entrySet()) {
+ if(entry.getValue() instanceof Map) {
+ section.createSection(entry.getKey(), (Map)entry.getValue());
+ } else {
+ section.set(entry.getKey(), entry.getValue());
+ }
+ }
+
+ return section;
+ }
// Primitives
public String getString(String path) {
diff --git a/paper-api/src/test/java/org/bukkit/configuration/ConfigurationSectionTest.java b/paper-api/src/test/java/org/bukkit/configuration/ConfigurationSectionTest.java
index 6834bfda8d..6810f81763 100644
--- a/paper-api/src/test/java/org/bukkit/configuration/ConfigurationSectionTest.java
+++ b/paper-api/src/test/java/org/bukkit/configuration/ConfigurationSectionTest.java
@@ -3,6 +3,7 @@ package org.bukkit.configuration;
import org.bukkit.Material;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.inventory.ItemStack;
@@ -182,6 +183,19 @@ public abstract class ConfigurationSectionTest {
assertEquals("subsection", subsection.getName());
}
+ @Test
+ public void testSectionMap() {
+ ConfigurationSection config = getConfigurationSection();
+ Map testMap = new LinkedHashMap();
+
+ testMap.put("string", "Hello World");
+ testMap.put("integer", 15);
+
+ config.createSection("test.path", testMap);
+
+ assertEquals(testMap, config.getConfigurationSection("test.path").getValues(false));
+ }
+
@Test
public void testGetString_String() {
ConfigurationSection section = getConfigurationSection();
diff --git a/paper-api/src/test/java/org/bukkit/configuration/ConfigurationTest.java b/paper-api/src/test/java/org/bukkit/configuration/ConfigurationTest.java
index 20e6f21da8..a1671d35eb 100644
--- a/paper-api/src/test/java/org/bukkit/configuration/ConfigurationTest.java
+++ b/paper-api/src/test/java/org/bukkit/configuration/ConfigurationTest.java
@@ -1,7 +1,6 @@
package org.bukkit.configuration;
import java.util.LinkedHashMap;
-import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;