From 097afe3dfe6af3ed10753434c1475a8771b4d3c8 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 1 May 2017 14:56:56 -0400 Subject: [PATCH] Unbind save handshake after message receive. --- ShiftOS_TheReturn/SaveSystem.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 2df914e..a27b04f 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -159,17 +159,23 @@ namespace ShiftOS.Engine { KernelWatchdog.Log("mud_handshake", "handshake successful: kernel watchdog access code is \"" + ServerManager.thisGuid.ToString() + "\""); - ServerManager.MessageReceived += (msg) => + ServerMessageReceived savehandshake = null; + + savehandshake = (msg) => { if (msg.Name == "mud_savefile") { CurrentSave = JsonConvert.DeserializeObject(msg.Contents); + ServerManager.MessageReceived -= savehandshake; } else if (msg.Name == "mud_login_denied") { oobe.PromptForLogin(); + ServerManager.MessageReceived -= savehandshake; } }; + ServerManager.MessageReceived += savehandshake; + ReadSave();