Skip to content

Commit

Permalink
Fixed problem with HuskClaims (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdev03 authored May 26, 2024
1 parent 21ed541 commit 8e28fe3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public boolean canBuild(Player player, Location target) {
Position position = huskClaimsBukkit.getPosition(target);

Optional<TrustLevel> trustLevel = huskClaimsBukkit.getTrustLevelAt(position, onlineUser);
return trustLevel.isPresent() && trustLevel.get().getFlags().contains(OperationType.BLOCK_PLACE);
return trustLevel.isEmpty() || trustLevel.get().getFlags().contains(OperationType.BLOCK_PLACE);
}

@Override
Expand All @@ -40,7 +40,7 @@ public boolean canBreak(Player player, Location target) {
Position position = huskClaimsBukkit.getPosition(target);

Optional<TrustLevel> trustLevel = huskClaimsBukkit.getTrustLevelAt(position, onlineUser);
return trustLevel.isPresent() && trustLevel.get().getFlags().contains(OperationType.BLOCK_BREAK);
return trustLevel.isEmpty() || trustLevel.get().getFlags().contains(OperationType.BLOCK_BREAK);
}

@Override
Expand All @@ -50,7 +50,7 @@ public boolean canInteract(Player player, Location target) {

OperationType operationType = target.getBlock().getType().isBlock() ? OperationType.BLOCK_INTERACT : OperationType.ENTITY_INTERACT;
Optional<TrustLevel> trustLevel = huskClaimsBukkit.getTrustLevelAt(position, onlineUser);
return trustLevel.isPresent() && trustLevel.get().getFlags().contains(operationType);
return trustLevel.isEmpty() || trustLevel.get().getFlags().contains(operationType);
}

@Override
Expand All @@ -59,6 +59,6 @@ public boolean canUse(Player player, Location target) {
Position position = huskClaimsBukkit.getPosition(target);

Optional<TrustLevel> trustLevel = huskClaimsBukkit.getTrustLevelAt(position, onlineUser);
return trustLevel.isPresent() && trustLevel.get().getFlags().contains(OperationType.BLOCK_INTERACT);
return trustLevel.isEmpty() || trustLevel.get().getFlags().contains(OperationType.BLOCK_INTERACT);
}
}

0 comments on commit 8e28fe3

Please sign in to comment.