Skip to content

Commit

Permalink
Fix: Don't show inspect contents on objects without contents (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDiscordian authored Feb 17, 2024
1 parent fc7e5e0 commit a2dc550
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -163,7 +164,7 @@ public Inventory fill(@NotNull Player player, Material material, BlockNBTHandler
}

// We insert a 'inspect contents' button if the player does not own the block and has admin permissions.
var rightItemOffset = !isNotProtected && !handler.isOwner(player.getUniqueId()) && player.hasPermission(Permissions.ADMIN.key()) ? 1 : 0;
var rightItemOffset = !isNotProtected && !handler.isOwner(player.getUniqueId()) && (state.getBlock().getState() instanceof InventoryHolder) && player.hasPermission(Permissions.ADMIN.key()) ? 1 : 0;
if (rightItemOffset == 1) {
setItemStack(
getSize() - 2,
Expand Down

0 comments on commit a2dc550

Please sign in to comment.