Added an exception that occurs when the developer changes team.

This commit is contained in:
AkjaHAsLk1IALk0MasH 2023-05-14 09:23:42 +07:00
parent 3647bbaf54
commit d9352d6902

View file

@ -1863,6 +1863,8 @@ namespace TShockAPI
/// <param name="team">The team color index.</param>
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);
}