diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7286ea27..f5bdcc2d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -60,6 +60,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Added `TSPlayer.CheckIgnores()` and removed `TShock.CheckIgnores(TSPlayer)`. (@hakusaro)
* Hooks inside TShock can now be registered with their `Register` method and can be prioritized according to the TShock HandlerList system. (@hakusaro)
* Fix message requiring login not using the command specifier set in the config file. (@hakusaro)
+* Move `TShock.CheckSpawn` to `Utils.IsInSpawn`. (@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.
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index 44c6b9f1..f7cae3a2 100644
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -1846,7 +1846,7 @@ namespace TShockAPI
{
if (!player.HasPermission(Permissions.editspawn))
{
- if (CheckSpawn(tileX, tileY))
+ if (Utils.IsInSpawn(tileX, tileY))
{
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.SPm) > 2000)
{
@@ -1913,7 +1913,7 @@ namespace TShockAPI
{
if (!player.HasPermission(Permissions.editspawn))
{
- if (CheckSpawn(tileX, tileY))
+ if (Utils.IsInSpawn(tileX, tileY))
{
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.SPm) > 1000)
{
@@ -1927,16 +1927,7 @@ namespace TShockAPI
return false;
}
- /// CheckSpawn - Checks to see if a location is inside the spawn protection zone.
- /// x - The x coordinate to check.
- /// y - The y coordinate to check.
- /// bool - True if the location is inside the spawn protection zone.
- public static bool CheckSpawn(int x, int y)
- {
- Vector2 tile = new Vector2(x, y);
- Vector2 spawn = new Vector2(Main.spawnTileX, Main.spawnTileY);
- return Utils.Distance(spawn, tile) <= Config.SpawnProtectionRadius;
- }
+
/// Distance - Determines the distance between two vectors.
/// value1 - The first vector location.
diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs
index b27bee5d..82791065 100644
--- a/TShockAPI/Utils.cs
+++ b/TShockAPI/Utils.cs
@@ -1525,6 +1525,17 @@ namespace TShockAPI
return (float)Math.Sqrt(num3);
}
+ /// Checks to see if a location is in the spawn protection area.
+ /// The x coordinate to check.
+ /// The y coordinate to check.
+ /// If the given x,y location is in the spawn area.
+ public static bool IsInSpawn(int x, int y)
+ {
+ Vector2 tile = new Vector2(x, y);
+ Vector2 spawn = new Vector2(Main.spawnTileX, Main.spawnTileY);
+ return Distance(spawn, tile) <= TShock.Config.SpawnProtectionRadius;
+ }
+
/// Computes the max styles...
internal void ComputeMaxStyles()
{