From 29a1b06301ea22d391df5e82c05ace198d1b54c5 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 6 Aug 2022 15:36:21 +1000 Subject: [PATCH] Fix old database migration bugs In detail: 1) BlockDB upgrader didn't convert time from local to UTC, which meant that times in /b were e.g. 10 hours off 2) Zone migrator accidentally set minX/maxX to imported minZ/maxZ and left minZ/maxZ as 0. Bug introduced four years ago in f1a8544308094586a3a1b5d61cd96d03391ad448 --- MCGalaxy/Database/BlockDB/BlockDBTableDumper.cs | 3 ++- MCGalaxy/Levels/LevelDB.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/MCGalaxy/Database/BlockDB/BlockDBTableDumper.cs b/MCGalaxy/Database/BlockDB/BlockDBTableDumper.cs index 224e4475b..8d9692860 100644 --- a/MCGalaxy/Database/BlockDB/BlockDBTableDumper.cs +++ b/MCGalaxy/Database/BlockDB/BlockDBTableDumper.cs @@ -169,7 +169,8 @@ namespace MCGalaxy.DB { int sec = (date[17] - '0') * 10 + (date[18] - '0'); DateTime time = new DateTime(year, month, day, hour, min, sec); - entry.TimeDelta = (int)time.Subtract(BlockDB.Epoch).TotalSeconds; + DateTime utc = time.ToUniversalTime(); + entry.TimeDelta = (int)utc.Subtract(BlockDB.Epoch).TotalSeconds; } } } \ No newline at end of file diff --git a/MCGalaxy/Levels/LevelDB.cs b/MCGalaxy/Levels/LevelDB.cs index d73453629..dbc9bd13d 100644 --- a/MCGalaxy/Levels/LevelDB.cs +++ b/MCGalaxy/Levels/LevelDB.cs @@ -44,11 +44,11 @@ namespace MCGalaxy { Zone z = new Zone(); z.MinX = (ushort)record.GetInt("SmallX"); z.MinY = (ushort)record.GetInt("SmallY"); - z.MinX = (ushort)record.GetInt("SmallZ"); + z.MinZ = (ushort)record.GetInt("SmallZ"); z.MaxX = (ushort)record.GetInt("BigX"); z.MaxY = (ushort)record.GetInt("BigY"); - z.MaxX = (ushort)record.GetInt("BigZ"); + z.MaxZ = (ushort)record.GetInt("BigZ"); z.Config.Name = record.GetText("Owner"); return z; }