Fixed removing entries in the new Configuration (via set(x, null))
This commit is contained in:
parent
c97dbc198d
commit
252fc76816
@ -186,7 +186,11 @@ public class MemorySection implements ConfigurationSection {
|
|||||||
String key = split[split.length - 1];
|
String key = split[split.length - 1];
|
||||||
|
|
||||||
if (section == this) {
|
if (section == this) {
|
||||||
|
if (value == null) {
|
||||||
|
map.remove(key);
|
||||||
|
} else {
|
||||||
map.put(key, prepForStorage(value));
|
map.put(key, prepForStorage(value));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
section.set(key, value);
|
section.set(key, value);
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,15 @@ public abstract class ConfigurationSectionTest {
|
|||||||
ConfigurationSection section = getConfigurationSection();
|
ConfigurationSection section = getConfigurationSection();
|
||||||
|
|
||||||
section.set("exists", "hello world");
|
section.set("exists", "hello world");
|
||||||
|
|
||||||
|
assertTrue(section.contains("exists"));
|
||||||
|
assertTrue(section.isSet("exists"));
|
||||||
assertEquals("hello world", section.get("exists"));
|
assertEquals("hello world", section.get("exists"));
|
||||||
|
|
||||||
|
section.set("exists", null);
|
||||||
|
|
||||||
|
assertFalse(section.contains("exists"));
|
||||||
|
assertFalse(section.isSet("exists"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user