From b66ecb23d10ee9a876085993bd4dce14508d4534 Mon Sep 17 00:00:00 2001 From: tastybento Date: Wed, 18 Sep 2024 14:49:29 -0700 Subject: [PATCH 1/2] Fixes an issue where items can be a block but not an item #332 --- src/main/java/world/bentobox/level/panels/ValuePanel.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/world/bentobox/level/panels/ValuePanel.java b/src/main/java/world/bentobox/level/panels/ValuePanel.java index 5af78e4..2d57283 100644 --- a/src/main/java/world/bentobox/level/panels/ValuePanel.java +++ b/src/main/java/world/bentobox/level/panels/ValuePanel.java @@ -11,6 +11,8 @@ import org.bukkit.Material; import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; @@ -58,6 +60,7 @@ private ValuePanel(Level addon, this.activeFilter = Filter.NAME_ASC; this.materialRecordList = Arrays.stream(Material.values()). filter(Material::isBlock). + filter(Material::isItem). // Remove things like PITCHER_CROP filter(m -> !m.name().startsWith("LEGACY_")). filter(this.addon.getBlockConfig()::isNotHiddenBlock). map(material -> @@ -584,6 +587,7 @@ private PanelItem createMaterialButton(ItemTemplateRecord template, TemplatedPan return null; } + @SuppressWarnings("deprecation") int index = this.pageIndex * slot.amountMap().getOrDefault(BLOCK, 1) + slot.slot(); if (index >= this.elementList.size()) From db2ebac45de1934c8efc65efbcb9bc19550dbb87 Mon Sep 17 00:00:00 2001 From: tastybento Date: Wed, 18 Sep 2024 14:50:13 -0700 Subject: [PATCH 2/2] Remove unused import --- src/main/java/world/bentobox/level/panels/ValuePanel.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/world/bentobox/level/panels/ValuePanel.java b/src/main/java/world/bentobox/level/panels/ValuePanel.java index 2d57283..df59b12 100644 --- a/src/main/java/world/bentobox/level/panels/ValuePanel.java +++ b/src/main/java/world/bentobox/level/panels/ValuePanel.java @@ -11,8 +11,6 @@ import org.bukkit.Material; import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack;