diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 6bfe0c44..284d9a31 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1863,6 +1863,8 @@ namespace TShockAPI /// The team color index. public virtual void SetTeam(int team) { + if (team < 0 || team >= Main.teamColor.Length) + throw new ArgumentException("The player's team is not in the range of available."); Main.player[Index].team = team; NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index); }