Allow operators to disable build permission notices

This commit allows server operators to disable build permission failure
notices. This is because some servers wish to have a "silent" operation
mode where the server doesn't send out these messages to users. This
makes sense, e.g., when the server is a "museum" and isn't intended to
be changed.
This commit is contained in:
Lucas Nicodemus 2021-06-12 23:53:17 -07:00
parent f567486c47
commit da163b80ac
3 changed files with 20 additions and 12 deletions

View file

@ -443,6 +443,10 @@ namespace TShockAPI.Configuration
/// <summary>Whether or not to kick users when they surpass the TileRectangleSize threshold.</summary>
[Description("Whether or not to kick users when they surpass the TileRectangleSize threshold.")]
public bool KickOnTileRectangleSizeThresholdBroken = false;
/// <summary>Whether or not the server should suppress build permission failure warnings from regions, spawn point, or server edit failure.</summary>
[Description("Whether or not the server should suppress build permission failure warnings from regions, spawn point, or server edit failure.")]
public bool SuppressPermissionFailureNotices = false;
#endregion

View file

@ -687,19 +687,21 @@ namespace TShockAPI
}
// If they should be warned, warn them.
switch (failure)
if (!TShock.Config.Settings.SuppressPermissionFailureNotices)
{
case BuildPermissionFailPoint.GeneralBuild:
SendErrorMessage("You do not have permission to build on this server.");
break;
case BuildPermissionFailPoint.SpawnProtect:
SendErrorMessage("You do not have permission to build in the spawn point.");
break;
case BuildPermissionFailPoint.Regions:
SendErrorMessage("You do not have permission to build in this region.");
break;
switch (failure)
{
case BuildPermissionFailPoint.GeneralBuild:
SendErrorMessage("You do not have permission to build on this server.");
break;
case BuildPermissionFailPoint.SpawnProtect:
SendErrorMessage("You do not have permission to build in the spawn point.");
break;
case BuildPermissionFailPoint.Regions:
SendErrorMessage("You do not have permission to build in this region.");
break;
}
}
// Set the last warning time to now.
lastPermissionWarning = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;