Added an exception that occurs when the developer changes team.
This commit is contained in:
parent
3647bbaf54
commit
d9352d6902
1 changed files with 2 additions and 0 deletions
|
|
@ -1863,6 +1863,8 @@ namespace TShockAPI
|
||||||
/// <param name="team">The team color index.</param>
|
/// <param name="team">The team color index.</param>
|
||||||
public virtual void SetTeam(int team)
|
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;
|
Main.player[Index].team = team;
|
||||||
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index);
|
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue