Skip to content

Commit

Permalink
修复配置版本key问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lt-name committed Jul 14, 2024
1 parent 800d97b commit c53761a
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,20 @@ private static void updateRsNPC2_0_0_To_RsNPC2_2_3() {
}
Config config = new Config(file, Config.YAML);

// key更新 configVersion -> RsNpcConfig.NPC_CONFIG_VERSION_KEY
boolean needSave = false;
if (config.exists("configVersion")) {
if (!config.exists(RsNpcConfig.NPC_CONFIG_VERSION_KEY)) {
config.set(RsNpcConfig.NPC_CONFIG_VERSION_KEY, config.getString("configVersion"));
}
config.remove("configVersion");
needSave = true;
}

if (VersionUtils.compareVersion(config.getString(RsNpcConfig.NPC_CONFIG_VERSION_KEY, "2.0.0"), "2.2.3") >= 0) {
if (needSave) {
config.save();
}
continue;
}

Expand All @@ -84,6 +97,8 @@ private static void updateRsNPC2_0_0_To_RsNPC2_2_3() {
config.set(RsNpcConfig.NPC_CONFIG_VERSION_KEY, "2.2.3");

config.save();

RsNPC.getInstance().getLogger().info("[ConfigUpdateUtils](updateRsNPC2_0_0_To_RsNPC2_2_3) 配置文件更新成功!");
}
}
}
Expand Down

0 comments on commit c53761a

Please sign in to comment.