mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
Fix createSection getting sections from itself. Fixes BUKKIT-1513
By: feildmaster <admin@feildmaster.com>
This commit is contained in:
parent
e700def943
commit
e115cf3efa
2 changed files with 22 additions and 1 deletions
|
@ -243,7 +243,7 @@ public class MemorySection implements ConfigurationSection {
|
|||
for (int i = 0; i < split.length - 1; i++) {
|
||||
ConfigurationSection last = section;
|
||||
|
||||
section = getConfigurationSection(split[i]);
|
||||
section = last.getConfigurationSection(split[i]);
|
||||
|
||||
if (section == null) {
|
||||
section = last.createSection(split[i]);
|
||||
|
|
|
@ -3,7 +3,9 @@ package org.bukkit.configuration;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -120,6 +122,25 @@ public abstract class ConfigurationTest {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test creation of ConfigurationSection
|
||||
*/
|
||||
@Test
|
||||
public void testCreateSection() {
|
||||
Configuration config = getConfig();
|
||||
|
||||
Set<String> set = new HashSet<String>();
|
||||
set.add("this");
|
||||
set.add("this.test.sub");
|
||||
set.add("this.test");
|
||||
set.add("this.test.other");
|
||||
|
||||
config.createSection("this.test.sub");
|
||||
config.createSection("this.test.other");
|
||||
|
||||
assertEquals(set, config.getKeys(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getDefaults method, of class Configuration.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue