From d9352d690240ad34d142fae30b2e37c26e2e9b86 Mon Sep 17 00:00:00 2001 From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com> Date: Sun, 14 May 2023 09:23:42 +0700 Subject: [PATCH] Added an exception that occurs when the developer changes team. --- TShockAPI/TSPlayer.cs | 2 ++ 1 file changed, 2 insertions(+) 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); }