Skip to content

Commit 49500b8

Browse files
committed
Fix CSharpPlugin missing some server startup hooks
1 parent 461e91a commit 49500b8

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/CSharpPluginLoader.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,15 @@ public override Plugin Load(string directory, string name)
106106
return null;
107107
}
108108

109-
// Attempt to compile the plugin before unloading the old version
110-
timer.Once(0.5f, () => Load(compilablePlugin));
109+
if (LoadedPlugins.ContainsKey(compilablePlugin.Name))
110+
{
111+
// Attempt to compile the plugin before unloading the old version
112+
timer.Once(0.5f, () => Load(compilablePlugin));
113+
}
114+
else
115+
{
116+
Load(compilablePlugin);
117+
}
111118

112119
return null;
113120
}
@@ -173,6 +180,8 @@ public override void Unloading(Plugin pluginBase)
173180

174181
public void Load(CompilablePlugin plugin)
175182
{
183+
PluginLoadingStarted(plugin);
184+
176185
plugin.Compile(compiled =>
177186
{
178187
if (!compiled)
@@ -244,7 +253,11 @@ public void CompilationRequested(CompilablePlugin plugin)
244253
public void PluginLoadingStarted(CompilablePlugin plugin)
245254
{
246255
// Let the Oxide core know that this plugin will be loading asynchronously
247-
LoadingPlugins.Add(plugin.Name);
256+
if (!LoadingPlugins.Contains(plugin.Name))
257+
{
258+
LoadingPlugins.Add(plugin.Name);
259+
}
260+
248261
plugin.IsLoading = true;
249262
}
250263

0 commit comments

Comments
 (0)