From df2e9767825e8974c38726bd4460d650948a88dd Mon Sep 17 00:00:00 2001 From: Sanae Date: Wed, 27 Apr 2022 14:09:50 -0600 Subject: [PATCH] balls --- Server/Client.cs | 17 +++++++++++------ Server/Program.cs | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Server/Client.cs b/Server/Client.cs index 4a79f58..409105c 100644 --- a/Server/Client.cs +++ b/Server/Client.cs @@ -40,12 +40,17 @@ public class Client : IDisposable { PacketAttribute packetAttribute = Constants.PacketMap[typeof(T)]; if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player) Logger.Info($"Pre-header {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}"); - PacketHeader header = new PacketHeader { - Id = sender?.Id ?? Id, - Type = packetAttribute.Type, - PacketSize = packet.Size - }; - Server.FillPacket(header, packet, memory.Memory); + try { + PacketHeader header = new PacketHeader { + Id = sender?.Id ?? Id, + Type = packetAttribute.Type, + PacketSize = packet.Size + }; + Server.FillPacket(header, packet, memory.Memory); + } + catch (Exception e) { + Logger.Error($"I will lose my shit {e}"); + } if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player) Logger.Info($"About to receive {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}"); diff --git a/Server/Program.cs b/Server/Program.cs index bedabfa..afbecdd 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -14,7 +14,7 @@ Logger consoleLogger = new Logger("Console"); server.ClientJoined += (c, _) => { c.Metadata["shineSync"] = new ConcurrentBag(); c.Metadata["loadedSave"] = false; - c.Metadata["scenario"] = 0; + c.Metadata["scenario"] = (byte?)0; c.Metadata["2d"] = false; c.Metadata["speedrun"] = false; foreach (Client client in server.Clients.Where(client => client.Metadata.ContainsKey("lastGamePacket")).ToArray()) {