Merge branch 'general-devel' into otapi3

This commit is contained in:
Luke 2022-09-06 22:23:34 +10:00
commit aa0bd7deb2
7 changed files with 263 additions and 77 deletions

View file

@ -650,6 +650,12 @@ namespace TShockAPI
/// <returns>True if the player can build at the given point from build, spawn, and region protection.</returns>
public bool HasBuildPermission(int x, int y, bool shouldWarnPlayer = true)
{
PermissionHookResult hookResult = PlayerHooks.OnPlayerHasBuildPermission(this, x, y);
if (hookResult != PermissionHookResult.Unhandled)
{
return hookResult == PermissionHookResult.Granted;
}
BuildPermissionFailPoint failure = BuildPermissionFailPoint.GeneralBuild;
// The goal is to short circuit on easy stuff as much as possible.
// Don't compute permissions unless needed, and don't compute taxing stuff unless needed.