private void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
 {
     if (GameStarted)
     {
         if (info == null || entity == null)
         {
             return;
         }
         if (entity is BaseNpc)
         {
             return;
         }
         BasePlayer victim = entity.ToPlayer();
         if (info?.Initiator?.ToPlayer() == null)
         {
             return;
         }
         BasePlayer killer = info.Initiator.ToPlayer();
         if (victim == null || killer == null)
         {
             return;
         }
         if (BlueTeam.Contains(killer.userID))
         {
             BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentKill, String.Format(CurrentBlue, killer.displayName), String.Format(CurrentRed, victim.displayName)));
         }
         else if (RedTeam.Contains(killer.userID))
         {
             BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentKill, String.Format(CurrentRed, killer.displayName), String.Format(CurrentBlue, victim.displayName)));
         }
     }
 }
 private void ReadyCommandChat(BasePlayer player, string command, string[] args)
 {
     if (GameStarted)
     {
         return;
     }
     if (RedTeam.Contains(player.userID) && !RedReady.Contains(player.userID))
     {
         RedReady.Add(player.userID);
         BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentReady, player.displayName));
     }
     else if (BlueTeam.Contains(player.userID) && !BlueReady.Contains(player.userID))
     {
         BlueReady.Add(player.userID);
         BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentReady, player.displayName));
     }
     else if (!RedTeam.Contains(player.userID) && !BlueReady.Contains(player.userID))
     {
         SendChatMessage(player, CurrentChoose);
     }
     if (RedReady.Count == TeamSize && BlueReady.Count == TeamSize)
     {
         BeginGame();
     }
 }
 private void OnEntitySpawned(BaseEntity entity, UnityEngine.GameObject gameObject)
 {
     if (entity.ShortPrefabName.Contains("cupboard.tool"))
     {
         BasePlayer player = BasePlayer.FindByID(entity.OwnerID);
         if (player == null)
         {
             return;
         }
         if (!GameStarted)
         {
             entity.KillMessage();
             var itemtogive = ItemManager.CreateByItemID(-97956382, 1);
             if (itemtogive != null)
             {
                 player.inventory.GiveItem(itemtogive);
             }
             SendChatMessage(player, CurrentStartCup);
             return;
         }
         if (RedTeam.Contains(player.userID) && CupBoardRed)
         {
             entity.KillMessage();
             var itemtogive = ItemManager.CreateByItemID(-97956382, 1);
             if (itemtogive != null)
             {
                 player.inventory.GiveItem(itemtogive);
             }
             SendChatMessage(player, CurrentCupLimit);
             return;
         }
         if (BlueTeam.Contains(player.userID) && CupBoardBlue)
         {
             entity.KillMessage();
             var itemtogive = ItemManager.CreateByItemID(-97956382, 1);
             if (itemtogive != null)
             {
                 player.inventory.GiveItem(itemtogive);
             }
             SendChatMessage(player, CurrentCupLimit);
             return;
         }
         if (RedTeam.Contains(player.userID))
         {
             CupBoardRed       = true;
             CupBoardRedString = entity.ToString();
             SendChatMessage(player, CurrentCupPlaced);
             return;
         }
         if (BlueTeam.Contains(player.userID))
         {
             CupBoardBlue       = true;
             CupBoardBlueString = entity.ToString();
             SendChatMessage(player, CurrentCupPlaced);
             return;
         }
     }
 }
 private void OnPlayerInit(BasePlayer player)
 {
     if (GameStarted && !player.IsAdmin)
     {
         if (!BlueTeam.Contains(player.userID) || !RedTeam.Contains(player.userID))
         {
             player.Kick("Game started. Please connect when the servername is updated.");
         }
     }
     NotifyPlayerConnection(true, player.displayName);
     RefreshServerName();
     if (UnlockedBP)
     {
         UnlockBP(player);
     }
 }
 private void SurrendCommandChat(BasePlayer player, string command, string[] args)
 {
     if (!GameStarted)
     {
         if (RedTeam.Contains(player.userID))
         {
             BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentSurrend, CurrentRedUpper, CurrentBlueUpper));
             ClearGame();
         }
         else if (BlueTeam.Contains(player.userID))
         {
             BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentSurrend, CurrentBlueUpper, CurrentRedUpper));
             ClearGame();
         }
     }
 }
 private void JoinBlue(BasePlayer player)
 {
     if (BlueTeam.Count == TeamSize)
     {
         SendChatMessage(player, CurrentTeamFull);
         return;
     }
     if (RedTeam.Contains(player.userID))
     {
         RedTeam.Remove(player.userID);
         RedReady.Remove(player.userID);
         RedParty.RemovePlayer(player.userID);
     }
     if (!BlueTeam.Contains(player.userID))
     {
         BlueTeam.Add(player.userID);
         BlueParty.AddPlayer(player);
     }
     BasePlayer.activePlayerList.ForEach(x => SendChatMessage(x, CurrentNow, player.displayName, CurrentBlueLower));
 }
 private void OnPlayerRespawned(BasePlayer player)
 {
     if (RedTeam.Contains(player.userID))
     {
         var i = ItemManager.CreateByItemID(1751045826, 1, (ulong)RedHoodie);
         if (i != null)
         {
             player.inventory.GiveItem(i, player.inventory.containerWear);
         }
         return;
     }
     if (BlueTeam.Contains(player.userID))
     {
         var i = ItemManager.CreateByItemID(1751045826, 1, (ulong)BlueHoodie);
         if (i != null)
         {
             player.inventory.GiveItem(i, player.inventory.containerWear);
         }
         return;
     }
     return;
 }
 private void JoinRed(BasePlayer player)
 {
     if (RedTeam.Count == TeamSize)
     {
         SendChatMessage(player, CurrentTeamFull);
         return;
     }
     if (BlueTeam.Contains(player.userID))
     {
         BlueTeam.Remove(player.userID);
         BlueReady.Remove(player.userID);
         BlueParty.RemovePlayer(player.userID);
     }
     if (!RedTeam.Contains(player.userID))
     {
         RedTeam.Add(player.userID);
         RedParty.AddPlayer(player);
     }
     foreach (BasePlayer x in BasePlayer.activePlayerList)
     {
         SendChatMessage(x, CurrentNow, player.displayName, CurrentRedLower);
     }
 }