PlayerHasBuildPermission hook (#8)

This commit is contained in:
Anzhelika 2021-01-20 18:54:26 +03:00 committed by Killia0
parent 4ceb039f82
commit b19a928fd8
2 changed files with 58 additions and 0 deletions

View file

@ -651,6 +651,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.