Skip to content

Commit

Permalink
Fix view-only ender chest (#278)
Browse files Browse the repository at this point in the history
Fixes access permissions being checked against self
  • Loading branch information
Jikoo authored Jan 18, 2025
1 parent 206fff2 commit 8a388b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ protected OpenChestMenu(
protected void preSlotSetup() {}

protected @NotNull Slot getUpperSlot(int index, int x, int y) {
Slot slot = new Slot(container, index, x, y);
if (viewOnly) {
return new SlotViewOnly(container, index, x, y);
return SlotViewOnly.wrap(slot);
}
return new Slot(container, index, x, y);
return slot;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ protected OpenChestMenu(
protected void preSlotSetup() {}

protected @NotNull Slot getUpperSlot(int index, int x, int y) {
Slot slot = new Slot(container, index, x, y);
if (viewOnly) {
return new SlotViewOnly(container, index, x, y);
return SlotViewOnly.wrap(slot);
}
return new Slot(container, index, x, y);
return slot;
}


Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/java/com/lishid/openinv/OpenInv.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public void setSilentContainerStatus(@NotNull final OfflinePlayer offline, final
boolean viewOnly = edit != null && !edit.hasPermission(player);

if (ownContainer || viewOnly && config.getAccessEqualMode() != AccessEqualMode.DENY) {
this.accessor.openInventory(player, inventory, viewOnly);
return this.accessor.openInventory(player, inventory, viewOnly);
}

for (int level = 4; level > 0; --level) {
Expand Down

0 comments on commit 8a388b5

Please sign in to comment.