From eb4fc7df406df8a13d5f09493cf9aeab6e4b54b8 Mon Sep 17 00:00:00 2001 From: Alan Moon Date: Wed, 10 Jul 2024 02:15:28 -0700 Subject: [PATCH] Implement ``JL`` - Join Limbo (#2) --- src/CommandHandlers/JoinLimboHandler.cs | 24 ++++++++++++++++++++++++ src/Core/Client.cs | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/CommandHandlers/JoinLimboHandler.cs diff --git a/src/CommandHandlers/JoinLimboHandler.cs b/src/CommandHandlers/JoinLimboHandler.cs new file mode 100644 index 0000000..b3b59ca --- /dev/null +++ b/src/CommandHandlers/JoinLimboHandler.cs @@ -0,0 +1,24 @@ +using sodoffmmo.Attributes; +using sodoffmmo.Core; +using sodoffmmo.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace sodoffmmo.CommandHandlers +{ + [ExtensionCommandHandler("JL")] + public class JoinLimboHandler : CommandHandler + { + public override Task Handle(Client client, NetworkObject receivedObject) + { + // set client room to limbo + Room limbo = Room.GetOrAdd("LIMBO"); + if (limbo != null) client.SetRoom(limbo); + + return Task.CompletedTask; + } + } +} diff --git a/src/Core/Client.cs b/src/Core/Client.cs index 455a6a3..0ff7659 100644 --- a/src/Core/Client.cs +++ b/src/Core/Client.cs @@ -69,7 +69,7 @@ public class Client { Room.AddClient(this); Send(Room.SubscribeRoom()); - UpdatePlayerUserVariables(); + if (Room.Name != "LIMBO") UpdatePlayerUserVariables(); // do not update user vars if room is limbo } } }