Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions AATool/Saves/MinecraftServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down