From 22b5e5c5f07f6921dfe4048efa0995812b394833 Mon Sep 17 00:00:00 2001 From: Archy-X Date: Wed, 27 Dec 2023 14:08:38 -0700 Subject: [PATCH] Fix ability data migration causing errors --- .../common/migration/FileUserMigrator.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/dev/aurelium/auraskills/common/migration/FileUserMigrator.java b/common/src/main/java/dev/aurelium/auraskills/common/migration/FileUserMigrator.java index b21b9f2e0..748d1aa47 100644 --- a/common/src/main/java/dev/aurelium/auraskills/common/migration/FileUserMigrator.java +++ b/common/src/main/java/dev/aurelium/auraskills/common/migration/FileUserMigrator.java @@ -61,8 +61,10 @@ private void applyFormatChanges(ConfigurationNode config) throws SerializationEx ConfigurationNode skillsNode = config.node("skills"); for (ConfigurationNode oldNode : skillsNode.childrenMap().values()) { String oldKey = (String) oldNode.key(); - skillsNode.node(PLUGIN_NAME + "/" + oldKey).set(oldNode.raw()); - skillsNode.removeChild(oldKey); + if (oldKey != null) { + skillsNode.node(PLUGIN_NAME + "/" + oldKey).set(oldNode.raw()); + skillsNode.removeChild(oldKey); + } } // Add namespaces to stat modifiers ConfigurationNode statModifiersNode = config.node("stat_modifiers"); @@ -74,8 +76,10 @@ private void applyFormatChanges(ConfigurationNode config) throws SerializationEx ConfigurationNode abilityDataNode = config.node("ability_data"); for (ConfigurationNode oldNode : abilityDataNode.childrenMap().values()) { String oldKey = (String) oldNode.key(); - skillsNode.node(PLUGIN_NAME + "/" + oldKey).set(oldNode.raw()); - skillsNode.removeChild(oldKey); + if (oldKey != null) { + abilityDataNode.node(PLUGIN_NAME + "/" + oldKey).set(oldNode.raw()); + abilityDataNode.removeChild(oldKey); + } } }