diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index cb418b0e..6569ef01 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -2102,27 +2102,26 @@ namespace TShockAPI SendData(PacketTypes.PlayerAddBuff, number: Index, number2: type, number3: time); } + /// + /// The list of necessary packets to make sure gets through to the player upon connection (before they finish the handshake). + /// + private static readonly HashSet NecessaryPackets = new() + { + PacketTypes.ContinueConnecting, + PacketTypes.WorldInfo, + PacketTypes.Status, + PacketTypes.Disconnect, + PacketTypes.TileFrameSection, + PacketTypes.TileSendSection, + PacketTypes.PlayerSpawnSelf + }; /// /// Determines if an outgoing packet is necessary to send to a player before they have finished the connection handshake. /// /// The packet type to check against the necessary list. - /// - private bool NecessaryPacket(PacketTypes msgType) - { - List ConnectionPackets = new List() - { - PacketTypes.ContinueConnecting, - PacketTypes.WorldInfo, - PacketTypes.Status, - PacketTypes.Disconnect, - PacketTypes.TileFrameSection, - PacketTypes.TileSendSection, - PacketTypes.PlayerSpawnSelf - }; - - return ConnectionPackets.Contains(msgType); - } + /// Whether the packet is necessary for connection or not + private bool NecessaryPacket(PacketTypes msgType) => NecessaryPackets.Contains(msgType); //Todo: Separate this into a few functions. SendTo, SendToAll, etc ///