Skip to content

Commit

Permalink
Fix error getting logged when starting a fresh server due to plugins …
Browse files Browse the repository at this point in the history
…folder not existing, introduced by d912fe9

Note that since IScripting.AutoloadPlugins() was the last thing called in the scheduled task anyways, this didn't actually cause any problems
  • Loading branch information
UnknownShadow200 committed Aug 28, 2022
1 parent a036098 commit 84534f4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion MCGalaxy/Modules/Compiling/Compiler.cs
Expand Up @@ -138,7 +138,7 @@ public abstract class ICompiler
srcPaths[i] = path;
}

referenced.Add(Server.GetServerDLL());
referenced.Add(Server.GetServerDLLPath());
return referenced;
}

Expand Down
11 changes: 5 additions & 6 deletions MCGalaxy/Scripting/Scripting.cs
Expand Up @@ -147,15 +147,14 @@ public static class IScripting
public static void AutoloadPlugins() {
string[] files = AtomicIO.TryGetFiles(PLUGINS_DLL_DIR, "*.dll");

if (files == null) {
Directory.CreateDirectory(PLUGINS_DLL_DIR); return;
}

// Ensure that plugin files are loaded in a consistent order,
// in case plugins have a dependency on other plugins
Array.Sort<string>(files);

if (files != null) {
foreach (string path in files) { LoadPlugin(path, true); }
} else {
Directory.CreateDirectory(PLUGINS_DLL_DIR);
}
foreach (string path in files) { LoadPlugin(path, true); }
}

/// <summary> Loads all plugins from the given .dll path. </summary>
Expand Down
2 changes: 1 addition & 1 deletion MCGalaxy/Server/Maintenance/Updater.cs
Expand Up @@ -90,7 +90,7 @@ public static class Updater {

Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) pl.SaveStats();
string serverDLL = Server.GetServerDLL();
string serverDLL = Server.GetServerDLLPath();

// Move current files to previous files (by moving instead of copying,
// can overwrite original the files without breaking the server)
Expand Down
2 changes: 1 addition & 1 deletion MCGalaxy/Server/Server.cs
Expand Up @@ -277,7 +277,7 @@ public sealed partial class Server
}


public static string GetServerDLL() {
public static string GetServerDLLPath() {
return Assembly.GetExecutingAssembly().Location;
}

Expand Down

0 comments on commit 84534f4

Please sign in to comment.