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
This commit is contained in:
UnknownShadow200 2022-08-06 15:36:21 +10:00
parent b776d685a6
commit 29a1b06301
2 changed files with 4 additions and 3 deletions

View File

@ -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;
}
}
}

View File

@ -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;
}