mirror of
https://github.com/YouHaveTrouble/YardWatch.git
synced 2026-05-11 22:16:58 +00:00
Modify permission check in GriefPreventionProtection
Refactored the permission checks in GriefPreventionProtection.java to use the Inventory permission rather than the Access permission. This change is in the methods canInteract and canDamage, and as a result enhances their functionalities under GriefPrevention's claim-based protection system.
This commit is contained in:
@@ -53,13 +53,13 @@ public class GriefPreventionProtection implements Protection {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canInteract(Player player, Entity target) {
|
public boolean canInteract(Player player, Entity target) {
|
||||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(target.getLocation(), true, null);
|
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(target.getLocation(), true, null);
|
||||||
return claim == null || claim.hasExplicitPermission(player.getUniqueId(), ClaimPermission.Access);
|
return claim == null || claim.hasExplicitPermission(player.getUniqueId(), ClaimPermission.Inventory); // do not ask why it's "inventory"...
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDamage(Entity damager, Entity target) {
|
public boolean canDamage(Entity damager, Entity target) {
|
||||||
if (!(damager instanceof Player player)) return true;
|
if (!(damager instanceof Player player)) return true;
|
||||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(target.getLocation(), true, null);
|
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(target.getLocation(), true, null);
|
||||||
return claim == null || claim.hasExplicitPermission(player.getUniqueId(), ClaimPermission.Access);
|
return claim == null || claim.hasExplicitPermission(player.getUniqueId(), ClaimPermission.Inventory); // do not ask why it's "inventory"...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user