geforkt von Mirrors/Paper
SPIGOT-6313: Revert "SPIGOT-6274: Reloading configuration does not clear previous values"
This reverts commit 885c2247d1
.
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
885c2247d1
Commit
c73564ed4b
@ -68,13 +68,10 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
|
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
convertMapsToSections(input, this);
|
convertMapsToSections(input, this);
|
||||||
} else {
|
|
||||||
this.map.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void convertMapsToSections(@NotNull Map<?, ?> input, @NotNull ConfigurationSection section) {
|
protected void convertMapsToSections(@NotNull Map<?, ?> input, @NotNull ConfigurationSection section) {
|
||||||
this.map.clear();
|
|
||||||
for (Map.Entry<?, ?> entry : input.entrySet()) {
|
for (Map.Entry<?, ?> entry : input.entrySet()) {
|
||||||
String key = entry.getKey().toString();
|
String key = entry.getKey().toString();
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
|
@ -206,44 +206,4 @@ public abstract class FileConfigurationTest extends MemoryConfigurationTest {
|
|||||||
|
|
||||||
assertEquals("", config.saveToString());
|
assertEquals("", config.saveToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testReloadClear() throws Exception {
|
|
||||||
// Test for SPIGOT-6274 - load does not clear values
|
|
||||||
FileConfiguration config = getConfig();
|
|
||||||
|
|
||||||
assertFalse(config.contains("test"));
|
|
||||||
assertFalse(config.getBoolean("test"));
|
|
||||||
|
|
||||||
config.set("test", true);
|
|
||||||
assertTrue(config.contains("test"));
|
|
||||||
assertTrue(config.getBoolean("test"));
|
|
||||||
|
|
||||||
config.loadFromString("");
|
|
||||||
assertFalse(config.contains("test"));
|
|
||||||
assertFalse(config.getBoolean("test"));
|
|
||||||
|
|
||||||
assertFalse(config.contains("test"));
|
|
||||||
assertFalse(config.getBoolean("test"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testReloadClear2() throws Exception {
|
|
||||||
// Test for SPIGOT-6274 - load does not clear values
|
|
||||||
FileConfiguration config = getConfig();
|
|
||||||
|
|
||||||
assertFalse(config.contains("test"));
|
|
||||||
assertFalse(config.getBoolean("test"));
|
|
||||||
|
|
||||||
config.set("test", true);
|
|
||||||
assertTrue(config.contains("test"));
|
|
||||||
assertTrue(config.getBoolean("test"));
|
|
||||||
|
|
||||||
config.loadFromString("other: false"); // Test both null and non-null code paths
|
|
||||||
assertFalse(config.contains("test"));
|
|
||||||
assertFalse(config.getBoolean("test"));
|
|
||||||
|
|
||||||
assertFalse(config.contains("test"));
|
|
||||||
assertFalse(config.getBoolean("test"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren