Skip to content

Commit

Permalink
Fix lwc.mod perm container access
Browse files Browse the repository at this point in the history
  • Loading branch information
pop4959 committed Sep 24, 2023
1 parent fd28db8 commit fa8ca3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.jvmargs=-Xmx2G
group=com.griefcraft
version=2.3.1
version=2.3.2-dev
description=Inventory protection & management utilizing SQLite or MySQL as its backend.
github=https://github.com/pop4959/LWCX
8 changes: 5 additions & 3 deletions src/main/java/com/griefcraft/listeners/LWCPlayerListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ public void onInventoryClick(InventoryClickEvent event) {
// Can they admin it?
boolean canAdmin = lwc.canAdminProtection(player, protection);
// Can they access it? (using getAccess instead of canAccessProtection since that is only for opening)
boolean canAccess = false;
boolean canAccess = lwc.isMod(player);
if (protection.getAccess(player.getUniqueId().toString(), Permission.Type.PLAYER) == Permission.Access.PLAYER) {
canAccess = true;
} else if (protection.getAccess(player.getName(), Permission.Type.PLAYER) == Permission.Access.PLAYER) {
Expand Down Expand Up @@ -957,21 +957,23 @@ public void onInventoryDrag(InventoryDragEvent event) {
// If it's a display chest, check permission.
if (protection.getType() == Protection.Type.DISPLAY) {
// Can they admin it? (remove items/etc)
boolean canMod = lwc.isMod(player);
boolean canAdmin = lwc.canAdminProtection(player, protection);

// nope.avi
if (!canAdmin) {
if (!canMod && !canAdmin) {
event.setCancelled(true);
}

// If it's a supply chest and player drag items on its slot, check permission.
} else if (protection.getType() == Protection.Type.SUPPLY &&
event.getRawSlots().stream().anyMatch(slot -> isRawSlotInTopInventory(event.getView(), slot))) {
// Can they admin it? (remove items/etc)
boolean canMod = lwc.isMod(player);
boolean canAdmin = lwc.canAdminProtection(player, protection);

// nope.avi
if (!canAdmin) {
if (!canMod && !canAdmin) {
event.setCancelled(true);
}
}
Expand Down

0 comments on commit fa8ca3f

Please sign in to comment.