OnServerShutdown
OxideCarbonServerCalled when server shutdown occurs.
void OnServerShutdown()Works — the game method in this build is the one the hook was written for.
Parameters
No parameters.
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnServerShutdown()
{
Puts("OnServerShutdown");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Where it is called
Oxide core (Oxide.Rust)
RustCore::IOnServerShutdown()
Oxide core code — the hook is called from here
private void IOnServerShutdown()
{
Interface.Oxide.CallHook("OnServerShutdown");
Interface.Oxide.OnShutdown();
Covalence.PlayerManager.SavePlayerData();
}Injection point
Rust.opj (Oxide)
void ServerMgr.Shutdown()
Injected internal hook IOnServerShutdown — this hook is called by its handler in the Oxide/Carbon core
WorksReturnBehavior: ContinueArgumentBehavior: NoneAssembly-CSharp.dll
Where it is called (this branch's game code)
internal void Shutdown()
{
Interface.CallHook("IOnServerShutdown");
BasePlayer[] array = BasePlayer.activePlayerList.ToArray();
for (int i = 0; i < array.Length; i++)
{
array[i].Kick("Server Shutting Down");
}
ConsoleSystem.Run(ConsoleSystem.Option.Server, "server.save");
try
{
// …Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.