Adds 1 sec delay between each notification of Area protected (no more spam)
This commit is contained in:
parent
31cf5c1ae7
commit
2a6454f60b
2 changed files with 18 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue