Move TShock.CheckRangePermission to TSPlayer
TShock.CheckRangePermission is now TSPlayer.IsInRange, but the most important thing is that this method returns the opposite of what the original did, so all of the calls that would go to it are now inverted.
This commit is contained in:
parent
d4cb07379b
commit
09121368e4
5 changed files with 35 additions and 38 deletions
|
|
@ -585,7 +585,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (CheckRangePermission(tsplr, args.Chest.x, args.Chest.y))
|
||||
if (!tsplr.IsInRange(args.Chest.x, args.Chest.y))
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
|
|
@ -1757,24 +1757,6 @@ namespace TShockAPI
|
|||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>CheckRangePermission - Checks if a player has permission to modify a tile dependent on range checks.</summary>
|
||||
/// <param name="player">player - The TSPlayer object.</param>
|
||||
/// <param name="x">x - The x coordinate of the tile.</param>
|
||||
/// <param name="y">y - The y coordinate of the tile.</param>
|
||||
/// <param name="range">range - The range to check for.</param>
|
||||
/// <returns>bool - True if the player should not be able to place the tile. False if they can, or if range checks are off.</returns>
|
||||
public static bool CheckRangePermission(TSPlayer player, int x, int y, int range = 32)
|
||||
{
|
||||
if (Config.RangeChecks && ((Math.Abs(player.TileX - x) > range) || (Math.Abs(player.TileY - y) > range)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>CheckTilePermission - Checks to see if a player has permission to modify a tile in general.</summary>
|
||||
/// <param name="player">player - The TSPlayer object.</param>
|
||||
/// <param name="tileX">tileX - The x coordinate of the tile.</param>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue