Fixed "/region info -d" possibly not hiding the boundaries properly sometimes.

This commit is contained in:
CoderCow 2013-07-02 09:03:51 +02:00
parent 86b03466a3
commit 899fd6f299

View file

@ -2843,9 +2843,7 @@ namespace TShockAPI
} }
case "info": case "info":
{ {
if (args.Parameters.Count > 1) if (args.Parameters.Count == 1 || args.Parameters.Count > 4)
{
if (args.Parameters.Count > 4)
{ {
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /region info <region> [-d] [page]"); args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /region info <region> [-d] [page]");
break; break;
@ -2936,19 +2934,20 @@ namespace TShockAPI
} }
} }
new Timer((dummy) => { Timer boundaryHideTimer = null;
boundaryHideTimer = new Timer((state) => {
foreach (Point boundaryPoint in Utils.Instance.EnumerateRegionBoundaries(regionArea)) foreach (Point boundaryPoint in Utils.Instance.EnumerateRegionBoundaries(regionArea))
if ((boundaryPoint.X + boundaryPoint.Y & 1) == 0) if ((boundaryPoint.X + boundaryPoint.Y & 1) == 0)
args.Player.SendTileSquare(boundaryPoint.X, boundaryPoint.Y, 1); args.Player.SendTileSquare(boundaryPoint.X, boundaryPoint.Y, 1);
// ReSharper disable AccessToModifiedClosure
Debug.Assert(boundaryHideTimer != null);
boundaryHideTimer.Dispose();
// ReSharper restore AccessToModifiedClosure
}, },
null, 5000, Timeout.Infinite null, 5000, Timeout.Infinite
); );
} }
}
else
{
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /region info <name>");
}
break; break;
} }