From f0168224ad86121500497c3c4c7585bf85bba98d Mon Sep 17 00:00:00 2001 From: Frank van der Heijden Date: Wed, 4 Aug 2021 00:59:11 +0200 Subject: [PATCH] Fix VelocityTomlConfig#set --- .../velocity/entities/VelocityTomlConfig.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Velocity/src/main/java/net/frankheijden/serverutils/velocity/entities/VelocityTomlConfig.java b/Velocity/src/main/java/net/frankheijden/serverutils/velocity/entities/VelocityTomlConfig.java index 3b68643..a19c619 100644 --- a/Velocity/src/main/java/net/frankheijden/serverutils/velocity/entities/VelocityTomlConfig.java +++ b/Velocity/src/main/java/net/frankheijden/serverutils/velocity/entities/VelocityTomlConfig.java @@ -60,6 +60,15 @@ public class VelocityTomlConfig implements ServerUtilsConfig { if (value == null) { config.remove(path); } else { + int lastDotIndex = path.lastIndexOf('.'); + if (lastDotIndex != -1) { + String parentPath = path.substring(0, lastDotIndex); + try { + CommentedConfig parent = config.get(parentPath); + } catch (ClassCastException ex) { + config.remove(parentPath); + } + } config.set(path, value); } }