Renamed TSPlayer.CheckIgnores() -> TSPlayer.IsBeingDisabled()
Since all of the flags it was checking have been demystified, this is pretty self explanatory now.
This commit is contained in:
parent
8e5ee7d286
commit
97f48d6d41
4 changed files with 31 additions and 28 deletions
|
|
@ -56,7 +56,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
|||
* Added `TSPlayer` to `GetDataHandlers.GemLockToggle`. (@hakusaro)
|
||||
* Added `GetDataHandlers.PlaceItemFrame` hook and related arguments. (@hakusaro)
|
||||
* Added `TSPlayer.IsBouncerThrottled()`. (@hakusaro)
|
||||
* Added `TSPlayer.CheckIgnores()` and removed `TShock.CheckIgnores(TSPlayer)`. (@hakusaro)
|
||||
* Added `TSPlayer.IsBeingDisabled()` and removed `TShock.CheckIgnores(TSPlayer)`. (@hakusaro)
|
||||
|
||||
## TShock 4.3.25
|
||||
* Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6.
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace TShockAPI
|
|||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
internal void OnPlaceItemFrame(object sender, GetDataHandlers.PlaceItemFrameEventArgs args)
|
||||
{
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, NetworkText.Empty, args.ItemFrame.ID, 0, 1);
|
||||
args.Handled = true;
|
||||
|
|
@ -108,7 +108,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
|
|
@ -126,7 +126,7 @@ namespace TShockAPI
|
|||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
internal void OnPlaceTileEntity(object sender, GetDataHandlers.PlaceTileEntityEventArgs args)
|
||||
{
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
|
|
@ -177,7 +177,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
|
|
@ -196,7 +196,7 @@ namespace TShockAPI
|
|||
/// <param name="args">args</param>
|
||||
internal void OnPlayerAnimation(object sender, GetDataHandlers.PlayerAnimationEventArgs args)
|
||||
{
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PlayerAnimation, "", args.Player.Index);
|
||||
args.Handled = true;
|
||||
|
|
@ -245,7 +245,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
|
||||
args.Handled = true;
|
||||
|
|
@ -311,7 +311,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PlayerHp, "", id);
|
||||
args.Player.SendData(PacketTypes.PlayerUpdate, "", id);
|
||||
|
|
@ -421,7 +421,7 @@ namespace TShockAPI
|
|||
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
||||
args.Handled = true;
|
||||
|
|
@ -444,7 +444,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PlayerAddBuff, "", id);
|
||||
args.Handled = true;
|
||||
|
|
@ -503,7 +503,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendData(PacketTypes.ChestItem, "", id, slot);
|
||||
args.Handled = true;
|
||||
|
|
@ -558,7 +558,7 @@ namespace TShockAPI
|
|||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
internal void OnChestOpen(object sender, GetDataHandlers.ChestOpenEventArgs args)
|
||||
{
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
|
|
@ -595,7 +595,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY, 3);
|
||||
args.Handled = true;
|
||||
|
|
@ -656,7 +656,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY, 1);
|
||||
args.Handled = true;
|
||||
|
|
@ -791,7 +791,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.RemoveProjectile(args.ProjectileIdentity, args.ProjectileOwner);
|
||||
args.Handled = true;
|
||||
|
|
@ -841,7 +841,7 @@ namespace TShockAPI
|
|||
float distance = Vector2.Distance(new Vector2(pos.X / 16f, pos.Y / 16f),
|
||||
new Vector2(args.Player.LastNetPosition.X / 16f, args.Player.LastNetPosition.Y / 16f));
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
// If the player has moved outside the disabled zone...
|
||||
if (distance > TShock.Config.MaxRangeForDisabled)
|
||||
|
|
@ -982,7 +982,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.RemoveProjectile(ident, owner);
|
||||
args.Handled = true;
|
||||
|
|
@ -1115,7 +1115,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendTileSquare(x, y, 4);
|
||||
args.Handled = true;
|
||||
|
|
@ -1470,7 +1470,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY, 4);
|
||||
args.Handled = true;
|
||||
|
|
@ -1586,7 +1586,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores() || args.Player.IsBouncerThrottled())
|
||||
if (args.Player.IsBeingDisabled() || args.Player.IsBouncerThrottled())
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
|
|
@ -1627,7 +1627,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.CheckIgnores())
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY, size);
|
||||
args.Handled = true;
|
||||
|
|
|
|||
|
|
@ -296,12 +296,15 @@ namespace TShockAPI
|
|||
return (DateTime.UtcNow - LastThreat).TotalMilliseconds < 5000;
|
||||
}
|
||||
|
||||
/// <summary>CheckIgnores - Checks a players ignores...?</summary>
|
||||
/// <param name="player">player - The TSPlayer object.</param>
|
||||
/// <returns>bool - True if any ignore is not none, false, or login state differs from the required state.</returns>
|
||||
public bool CheckIgnores()
|
||||
/// <summary>Easy check if a player has any of IsDisabledForSSC, IsDisabledForStackDetection, IsDisabledForBannedWearable, or IsDisabledPendingTrashRemoval set. Or if they're not logged in and a login is required.</summary>
|
||||
/// <returns>If any of the checks that warrant disabling are set on this player. If true, Disable() is repeatedly called on them.</returns>
|
||||
public bool IsBeingDisabled()
|
||||
{
|
||||
return IsDisabledForSSC || IsDisabledForStackDetection || IsDisabledForBannedWearable || IsDisabledPendingTrashRemoval || !IsLoggedIn && TShock.Config.RequireLogin;
|
||||
return IsDisabledForSSC
|
||||
|| IsDisabledForStackDetection
|
||||
|| IsDisabledForBannedWearable
|
||||
|| IsDisabledPendingTrashRemoval
|
||||
|| !IsLoggedIn && TShock.Config.RequireLogin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1083,7 +1083,7 @@ namespace TShockAPI
|
|||
|
||||
if (Main.ServerSideCharacter && !player.IsLoggedIn)
|
||||
{
|
||||
if (player.CheckIgnores())
|
||||
if (player.IsBeingDisabled())
|
||||
{
|
||||
player.Disable(flags: flags);
|
||||
}
|
||||
|
|
@ -1163,7 +1163,7 @@ namespace TShockAPI
|
|||
}
|
||||
player.IsDisabledForBannedWearable = true;
|
||||
|
||||
if (player.CheckIgnores())
|
||||
if (player.IsBeingDisabled())
|
||||
{
|
||||
player.Disable(flags: flags);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue