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

@ -20,7 +20,9 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Fixed `CTRL + C` / interactive console interrupt not safely shutting down the server. Now, interrupts will cause a safe shutdown (saving the world and disconnecting all players before fully shutting down). Previously, interrupts caused an unsafe shutdown (not saving the world). (@hakusaro)
* Changed "success message" color to `Color.LimeGreen` instead of `Color.Green`. `Color.Green` looks ugly. `Color.LimeGreen` looks less ugly but isn't as offensively bright as pure green. (@hakusaro)
* Changed the default respawn timer to 10 seconds, so as to not desynchronize from the game by default. (@hakusaro)
* Fixed `/home` allowing players to bypass the respawn timer. (@hakusaro)
* Fixed `/home` allowing players to bypass the respawn timer. (@hakusaro, @moisterrific, @Arthri)
* Added the config option `SuppressPermissionFailureNotices`. When set to `true`, the server will not send warning messages to players when they fail a build permission check from `TSPlayer.HasBuildPermission` (even if `shouldWarnPlayer` is set to true. (@hakusaro)
## TShock 4.5.4
* Fixed ridiculous typo in `GetDataHandlers` which caused TShock to read the wrong field in the packet for `usingBiomeTorches`. (@hakusaro, @Arthri)
* Fixed torchgod settings to include whether or not torchgod has been fought by the player before and respect `usingBiomeTorches` setting. (@Quinci135)

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;