diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 7dfc377b..e6ceac32 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -1562,6 +1562,18 @@ namespace TShockAPI
Main.player[Index].team = team;
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index);
}
+
+ ///
+ /// Sets the player's pvp.
+ ///
+ /// The state of the pvp mode.
+ public virtual void SetPvP(bool mode, bool withMsg = false)
+ {
+ Main.player[Index].hostile = mode;
+ NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, NetworkText.Empty, Index);
+ if (withMsg)
+ TSPlayer.All.SendMessage(Language.GetTextValue(mode ? "LegacyMultiplayer.11" : "LegacyMultiplayer.12", Name), Main.teamColor[Team]);
+ }
private DateTime LastDisableNotification = DateTime.UtcNow;