diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 377f736d..9b27ff9f 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -261,7 +261,11 @@ namespace TShockAPI } if (!args.Player.Group.HasPermission("editspawn") && RegionManager.InProtectedArea(x, y, Tools.GetPlayerIP(args.Player.Name))) { - args.Player.SendMessage("Region protected from changes.", Color.Red); + if ((DateTime.UtcNow - args.Player.LastTileChangeNotify).TotalMilliseconds > 1000) + { + args.Player.SendMessage("Region protected from changes.", Color.Red); + args.Player.LastTileChangeNotify = DateTime.UtcNow; + } args.Player.SendTileSquare(x, y); return true; } @@ -269,7 +273,11 @@ namespace TShockAPI { if (!args.Player.Group.HasPermission("editspawn")) { - args.Player.SendMessage("World protected from changes.", Color.Red); + if ((DateTime.UtcNow - args.Player.LastTileChangeNotify).TotalMilliseconds > 1000) + { + args.Player.SendMessage("World protected from changes.", Color.Red); + args.Player.LastTileChangeNotify = DateTime.UtcNow; + } args.Player.SendTileSquare(x, y); return true; } @@ -281,8 +289,12 @@ namespace TShockAPI var flag = TShock.CheckSpawn(x, y); if (flag) { - args.Player.SendMessage("Spawn protected from changes.", Color.Red); - args.Player.SendTileSquare(x, y); + if ((DateTime.UtcNow - args.Player.LastTileChangeNotify).TotalMilliseconds > 1000) + { + args.Player.SendMessage("Spawn protected from changes.", Color.Red); + args.Player.LastTileChangeNotify = DateTime.UtcNow; + } + args.Player.SendTileSquare(x, y); return true; } } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 90708586..4ecab034 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -37,6 +37,7 @@ namespace TShockAPI public DateTime LastPvpChange { get; protected set; } public Rectangle TempArea = new Rectangle(); public DateTime LastExplosive { get; set; } + public DateTime LastTileChangeNotify { get; set; } public bool InitSpawn = false; public bool DisplayLogs = true; public Vector2 oldSpawn = Vector2.Zero; @@ -159,6 +160,7 @@ namespace TShockAPI //The error occurs when a tile trys to update which the client hasnt load yet, Clients only update tiles withen 150 blocks //Try 300 if it does not work (Higher number - Longer load times - Less chance of error) SendTileSquare(tileX, tileY, 150); + if (TPlayer.SpawnX > 0 && TPlayer.SpawnY > 0) { int spX = TPlayer.SpawnX;