diff --git a/AATool/Saves/MinecraftServer.cs b/AATool/Saves/MinecraftServer.cs index 6347a475..abb3faa8 100644 --- a/AATool/Saves/MinecraftServer.cs +++ b/AATool/Saves/MinecraftServer.cs @@ -84,7 +84,6 @@ public static void Sync() return; if (!TryGetWorldSaveTime(sftp, out DateTime latest)) return; - DateTime next = latest.Add(TimeSpan.FromSeconds(SaveInterval)); remaining = (next - DateTime.UtcNow).TotalSeconds; if (remaining > 0) @@ -278,10 +277,10 @@ private static bool TryDownloadServerProperties(SftpClient sftp, int failures = //download server properties string path = Path.Combine(Config.Sftp.ServerRoot, "server.properties"); string[] properties = sftp.ReadAllText(path).Split('\n'); - if (TryGetProperty(properties, "level-name", out string word)) - WorldName = word; + if (TryGetProperty(properties, "level-name", out string world)) + WorldName = world.TrimEnd(); if (TryGetProperty(properties, "motd", out string message)) - MessageOfTheDay = message; + MessageOfTheDay = message.TrimEnd(); return true; } catch (Exception exception) @@ -304,7 +303,7 @@ private static bool TryDownloadServerProperties(SftpClient sftp, int failures = private static bool TryGetWorldSaveTime(SftpClient sftp, out DateTime lastWorldSave, int failures = 0) { SetState(SyncState.LastAutoSave); - string remote = Path.Combine(Config.Sftp.ServerRoot, $"{WorldName}/level.dat"); + string remote = Path.Combine(Config.Sftp.ServerRoot, WorldName, "level.dat"); lastWorldSave = default; try @@ -346,7 +345,7 @@ public static bool TryDownloadFolder(SftpClient sftp, string name, int failures SmoothDownloadPercent = 0; string localPath = Path.Combine(Paths.System.SftpWorldsFolder, WorldName, name); - string remotePath = Path.Combine(Config.Sftp.ServerRoot, $"{WorldName}/{name}"); + string remotePath = Path.Combine(Config.Sftp.ServerRoot, WorldName, name); try { //make sure directory exists