From f2dcbce4905309f219a50f04194b57e32aa3fd3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sat, 25 Jul 2020 03:16:36 +0200 Subject: [PATCH] Fix problem where servers created in v5 (not converted from v4) would fail to start properly. This is a quite major issue and I hope this fix resolves it. Although, it should be tested with migration from v4 to v5 and then a fresh v5 server. --- .../main/java/com/plotsquared/core/PlotSquared.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 1cab0ba4c..5355db56b 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -1735,10 +1735,11 @@ public class PlotSquared { if (this.worlds.contains("worlds")) { if (!this.worlds.contains("configuration_version") || ( - !this.worlds.getString("configuration_version") - .equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worlds - .getString("configuration_version").equalsIgnoreCase("v5"))) { - // Conversion needed + !this.worlds.getString("configuration_version").equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && + !this.worlds.getString("configuration_version").equalsIgnoreCase("v5"))) { + // This means that the server is updating from version 3 to version 5. For this to be possible, + // it must first go through v3->v4 (post_flattening), then on next restart + // it must do v4 (post_flattening) -> v5 log(Captions.LEGACY_CONFIG_FOUND.getTranslated()); try { com.google.common.io.Files @@ -1760,7 +1761,9 @@ public class PlotSquared { return false; } } else { - this.worlds.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION); + // If the server does not have a worlds section in their + // worlds.yml, we assume they generated their database using v5 + this.setConfigurationVersion("v5"); } } catch (IOException ignored) { PlotSquared.log("Failed to save settings.yml");