Hey @Wulf is there a hook that is called only when the server is initialized every time a plugin is loaded?
Calling OnServerInitialized only once on startup?
Discussion in 'Rust Development' started by Austinv900, Mar 10, 2017.
-
Doesn't OnServerInitialized do that?
-
It calls after the server is initialized. But I don't think it calls every time a plugin is loaded when the server is initialized. Or does it?
-
Yep, it does. The difference (that I've seen) is that OnPluginLoaded fires immediately when the plugin is loaded, but OnServerInitialized fires only if the server startup has been completed.
-
Wulf Community Admin
OnServerInitialized is called every time the plugin is loaded and on server startup as plugins can be hotloaded. If you want to only check it once, use a bool and check against that.
-
I see. I was looking in the wrong spot for the OnServerInitalized hook. But found it in RustCore.cs
Code:/// <summary> /// Called when another plugin has been loaded /// </summary> /// <param name="plugin"></param> [HookMethod("OnPluginLoaded")] private void OnPluginLoaded(Plugin plugin) { if (serverInitialized) plugin.CallHook("OnServerInitialized"); }