public static bool DestroyRoom(uint roomId, string reason = "") { #if DEBUG Logger.Instance.Log("Destroying room " + roomId); #endif if (rooms.Any(x => x.roomId == roomId)) { BaseRoom room = rooms.First(x => x.roomId == roomId); room.StopRoom(); WebSocketListener.DestroyRoom(room); if (string.IsNullOrEmpty(reason)) { reason = "Room destroyed!"; } NetOutgoingMessage outMsg = HubListener.ListenerServer.CreateMessage(); outMsg.Write((byte)CommandType.Disconnect); outMsg.Write(reason); room.BroadcastPacket(outMsg, NetDeliveryMethod.ReliableOrdered); rooms.Remove(room); return(true); } else { return(false); } }