From a64729191f0d5bc059318cef227577c1c92a3724 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 16 Apr 2016 16:08:35 +0200 Subject: [PATCH] SPIGOT-2180: Empty ConfigurationSections created when removing value at end of path By: Lukas Hennig --- .../src/main/java/org/bukkit/configuration/MemorySection.java | 4 ++++ 1 file changed, 4 insertions(+) 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 3b92c64420..1f4c8ce461 100644 --- a/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java +++ b/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java @@ -180,6 +180,10 @@ public class MemorySection implements ConfigurationSection { String node = path.substring(i2, i1); ConfigurationSection subSection = section.getConfigurationSection(node); if (subSection == null) { + if (value == null) { + // no need to create missing sub-sections if we want to remove the value: + return; + } section = section.createSection(node); } else { section = subSection;