Check RegionProtectGemLocks before enforcing perms

Fixes #2485. Bouncer now checks to ensure that RegionProtectGemLocks is
enabled before attempting to reject changes from gem locks from players
that don't have build permissions.
This commit is contained in:
Lucas Nicodemus 2021-11-20 18:19:47 -08:00
parent 6bcd9753c7
commit f523d38300
2 changed files with 8 additions and 4 deletions

View file

@ -30,6 +30,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Updated Open Terraria API (OTAPI) and TSAPI for preliminary support of Terraria 1.4.3.0. This functionally changes OTAPI and points to 2.0.0.45 from 2.0.0.43 in previous versions. Developer note: `SendData` takes an extra arg in this version of Terraria but that's slated to be removed in a Terraria hotfix. This is vestigial and OTAPI "hacks that out" to preserve plugin compatibility. That's why it'll differ from the source code. (@Patrikkk, @DeathCradle, honorable mention: @Moneylover3246)
* Added Deerclops to `/spawnboss` command. (@hakusaro, @HiddenStriker)
* Fixed [GHSA-6w5v-hxr3-m2wx](https://github.com/Pryaxis/TShock/security/advisories/GHSA-6w5v-hxr3-m2wx). (@Yoraiz0r, @Arthri)
* Fixed an issue where player build permissions would reject gem lock changes, even if `RegionProtectGemLocks` was disabled in the config file. Now, players will be permitted to use gem locks if they don't have build permission in a region, but `RegionProtectGemLocks` is disabled. If `RegionProtectGemLocks` is enabled, players will be unable to use gem locks in a build region. (@hakusaro, @Kojirremer, @Arthri)
## TShock 4.5.5
* Changed the world autosave message so that it no longer warns of a "potential lag spike." (@hakusaro)

View file

@ -1922,11 +1922,14 @@ namespace TShockAPI
return;
}
if (!args.Player.HasBuildPermission(args.X, args.Y))
if (TShock.Config.Settings.RegionProtectGemLocks)
{
TShock.Log.ConsoleDebug("Bouncer / OnGemLockToggle rejected permissions check from {0}", args.Player.Name);
args.Handled = true;
return;
if (!args.Player.HasBuildPermission(args.X, args.Y))
{
TShock.Log.ConsoleDebug("Bouncer / OnGemLockToggle rejected permissions check from {0}", args.Player.Name);
args.Handled = true;
return;
}
}
}