mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-25 01:25:03 +01:00
Fixed removing entries in the new Configuration (via set(x, null))
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
f22a79981c
commit
510ec3a467
2 changed files with 13 additions and 1 deletions
|
@ -186,7 +186,11 @@ public class MemorySection implements ConfigurationSection {
|
|||
String key = split[split.length - 1];
|
||||
|
||||
if (section == this) {
|
||||
map.put(key, prepForStorage(value));
|
||||
if (value == null) {
|
||||
map.remove(key);
|
||||
} else {
|
||||
map.put(key, prepForStorage(value));
|
||||
}
|
||||
} else {
|
||||
section.set(key, value);
|
||||
}
|
||||
|
|
|
@ -162,7 +162,15 @@ public abstract class ConfigurationSectionTest {
|
|||
ConfigurationSection section = getConfigurationSection();
|
||||
|
||||
section.set("exists", "hello world");
|
||||
|
||||
assertTrue(section.contains("exists"));
|
||||
assertTrue(section.isSet("exists"));
|
||||
assertEquals("hello world", section.get("exists"));
|
||||
|
||||
section.set("exists", null);
|
||||
|
||||
assertFalse(section.contains("exists"));
|
||||
assertFalse(section.isSet("exists"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Reference in a new issue