From 56bddb4983de5d6852607c128ed0a83e3a6b99a5 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 19 Apr 2017 09:07:21 -0400 Subject: [PATCH] Unwind MUD event before looping --- ShiftOS.WinForms/OobeStory.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ShiftOS.WinForms/OobeStory.cs b/ShiftOS.WinForms/OobeStory.cs index 06f2c08..d4d066b 100644 --- a/ShiftOS.WinForms/OobeStory.cs +++ b/ShiftOS.WinForms/OobeStory.cs @@ -218,7 +218,7 @@ namespace ShiftOS.WinForms bool goBack = false; int incorrectChances = 2; Console.WriteLine("Checking sentience records..."); - ServerManager.MessageReceived += (msg) => + ServerMessageReceived smr = (msg) => { if (position == 2) { @@ -262,6 +262,7 @@ namespace ShiftOS.WinForms } } }; + ServerManager.MessageReceived += smr; ServerManager.SendMessage("mud_checkuserexists", JsonConvert.SerializeObject(new { username = SaveSystem.CurrentSave.Username })); while (position == 2) { @@ -272,7 +273,10 @@ namespace ShiftOS.WinForms Thread.Sleep(10); } if (goBack) + { + ServerManager.MessageReceived -= smr; goto UsernameWait; + } Console.WriteLine("Sentience linkup successful."); Console.WriteLine("We will bring you to your system in 5 seconds."); Thread.Sleep(5000);