From 7b706e10549e8700baecd7c0f4c85bb2a481d6cb Mon Sep 17 00:00:00 2001 From: Boy0000 Date: Fri, 24 Mar 2023 19:32:49 +0100 Subject: [PATCH] bypass stuff (#21) --- gradle.properties | 2 +- .../compatibilities/CrashClaimCompat.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 56f980b..9d9b238 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -pluginVersion=1.2.6 +pluginVersion=1.2.7 diff --git a/src/main/java/io/th0rgal/protectionlib/compatibilities/CrashClaimCompat.java b/src/main/java/io/th0rgal/protectionlib/compatibilities/CrashClaimCompat.java index 6d00d88..fd59045 100644 --- a/src/main/java/io/th0rgal/protectionlib/compatibilities/CrashClaimCompat.java +++ b/src/main/java/io/th0rgal/protectionlib/compatibilities/CrashClaimCompat.java @@ -11,6 +11,7 @@ public class CrashClaimCompat extends ProtectionCompatibility { private static CrashClaimAPI crashClaim; + public CrashClaimCompat(JavaPlugin mainPlugin, Plugin plugin) { super(mainPlugin, plugin); crashClaim = new CrashClaimAPI((CrashClaim) plugin); @@ -23,7 +24,9 @@ public CrashClaimCompat(JavaPlugin mainPlugin, Plugin plugin) { */ @Override public boolean canBuild(Player player, Location target) { - return crashClaim.getClaim(target) == null || crashClaim.getClaim(target).hasPermission(player.getUniqueId(), target, PermissionRoute.BUILD); + return crashClaim.getClaim(target) == null || + crashClaim.getPermissionHelper().getBypassManager().isBypass(player.getUniqueId()) || + crashClaim.getClaim(target).hasPermission(player.getUniqueId(), target, PermissionRoute.BUILD); } /** @@ -33,7 +36,9 @@ public boolean canBuild(Player player, Location target) { */ @Override public boolean canBreak(Player player, Location target) { - return crashClaim.getClaim(target) == null || crashClaim.getClaim(target).hasPermission(player.getUniqueId(), target, PermissionRoute.BUILD); + return crashClaim.getClaim(target) == null || + crashClaim.getPermissionHelper().getBypassManager().isBypass(player.getUniqueId()) || + crashClaim.getClaim(target).hasPermission(player.getUniqueId(), target, PermissionRoute.BUILD); } /** @@ -43,7 +48,9 @@ public boolean canBreak(Player player, Location target) { */ @Override public boolean canInteract(Player player, Location target) { - return crashClaim.getClaim(target) == null || crashClaim.getClaim(target).hasPermission(player.getUniqueId(), target, PermissionRoute.INTERACTIONS); + return crashClaim.getClaim(target) == null || + crashClaim.getPermissionHelper().getBypassManager().isBypass(player.getUniqueId()) || + crashClaim.getClaim(target).hasPermission(player.getUniqueId(), target, PermissionRoute.INTERACTIONS); } /** @@ -52,6 +59,8 @@ public boolean canInteract(Player player, Location target) { * @return true if he can use the item at the location */ public boolean canUse(Player player, Location target) { - return crashClaim.getClaim(target) == null || crashClaim.getClaim(target).hasPermission(player.getUniqueId(), target, PermissionRoute.INTERACTIONS); + return crashClaim.getClaim(target) == null || + crashClaim.getPermissionHelper().getBypassManager().isBypass(player.getUniqueId()) || + crashClaim.getClaim(target).hasPermission(player.getUniqueId(), target, PermissionRoute.INTERACTIONS); } }