diff --git a/paper-server/patches/sources/net/minecraft/server/Main.java.patch b/paper-server/patches/sources/net/minecraft/server/Main.java.patch index 3e045b797299..2637e1d50f20 100644 --- a/paper-server/patches/sources/net/minecraft/server/Main.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/Main.java.patch @@ -117,9 +117,11 @@ LevelStorageSource levelStorageSource = LevelStorageSource.createDefault(universePath.toPath()); LevelStorageSource.LevelStorageAccess access = levelStorageSource.validateAndCreateAccess(levelName); Dynamic levelDataTag; -@@ -150,12 +_,36 @@ +@@ -149,13 +_,38 @@ + } else { levelDataTag = null; } ++ io.papermc.paper.world.migration.WorldFolderMigration.didInitialLoad = true; // Paper - boolean safeModeEnabled = options.has(safeMode); + boolean safeModeEnabled = options.has("safeMode"); // CraftBukkit diff --git a/paper-server/patches/sources/net/minecraft/util/filefix/FileFixerUpper.java.patch b/paper-server/patches/sources/net/minecraft/util/filefix/FileFixerUpper.java.patch new file mode 100644 index 000000000000..934e40c3fc7d --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/util/filefix/FileFixerUpper.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/util/filefix/FileFixerUpper.java ++++ b/net/minecraft/util/filefix/FileFixerUpper.java +@@ -82,6 +_,7 @@ + ) throws FileFixException { + int loadedVersion = NbtUtils.getDataVersion(levelDataTag); + if (this.requiresFileFixing(loadedVersion)) { ++ if (!io.papermc.paper.world.migration.WorldFolderMigration.didInitialLoad) io.papermc.paper.world.migration.WorldFolderMigration.warnAndDelayStartupMigration(); // Paper + LOGGER.info("Starting upgrade for world \"{}\"", worldAccess.getLevelId()); + Path worldFolder = worldAccess.getLevelDirectory().path(); + Path fileFixDirectory = worldFolder.resolve("filefix"); diff --git a/paper-server/src/main/java/io/papermc/paper/world/migration/WorldFolderMigration.java b/paper-server/src/main/java/io/papermc/paper/world/migration/WorldFolderMigration.java index 9b6da34e53e5..77fb09a15bce 100644 --- a/paper-server/src/main/java/io/papermc/paper/world/migration/WorldFolderMigration.java +++ b/paper-server/src/main/java/io/papermc/paper/world/migration/WorldFolderMigration.java @@ -20,6 +20,7 @@ public final class WorldFolderMigration { private static final Logger LOGGER = LogUtils.getClassLogger(); private static final boolean DISABLE_MIGRATION_DELAY = Boolean.getBoolean("paper.disableMigrationDelay"); + public static boolean didInitialLoad; private static boolean startupMigrationWarningShown; private WorldFolderMigration() { @@ -60,7 +61,7 @@ public static void migrateApiWorld( LegacyCraftBukkitWorldMigration.migrateApiWorld(new WorldMigrationContext(rootAccess, registryAccess, worldName, stemKey, dimensionKey)); } - private static synchronized void warnAndDelayStartupMigration() throws IOException { + public static synchronized void warnAndDelayStartupMigration() { if (startupMigrationWarningShown) { return; } @@ -77,7 +78,7 @@ private static synchronized void warnAndDelayStartupMigration() throws IOExcepti Thread.sleep(30_000L); } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); - throw new IOException("Interrupted while waiting before startup world migration", ex); + throw new RuntimeException("Interrupted while waiting before startup world migration", ex); } } LOGGER.info("Continuing with startup world migration."); diff --git a/paper-server/src/main/java/io/papermc/paper/world/saveddata/PaperLevelOverrides.java b/paper-server/src/main/java/io/papermc/paper/world/saveddata/PaperLevelOverrides.java index b0bed5d36339..fb575b634de6 100644 --- a/paper-server/src/main/java/io/papermc/paper/world/saveddata/PaperLevelOverrides.java +++ b/paper-server/src/main/java/io/papermc/paper/world/saveddata/PaperLevelOverrides.java @@ -198,7 +198,7 @@ public boolean isDifficultyLocked() { private PrimaryLevelData rootDataOrThrow() { if (this.rootData == null) { - throw new IllegalStateException("PaperWorldLevelOverrides not attached"); + throw new IllegalStateException(this.getClass().getName() + " not attached"); } return this.rootData; }