From 13708c8ab4b7dcda26afe5cfe8bfc4d0d7c28b4c Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Sat, 19 Aug 2023 16:20:54 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9A=92=EF=B8=8F=20fix=20ItemStack=20can't=20?= =?UTF-8?q?be=20null/air/amount=20of=200!=20for=20anvils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Took 4 minutes --- .../java/ca/tweetzy/auctionhouse/listeners/CMIListener.java | 5 +++-- .../ca/tweetzy/auctionhouse/listeners/PlayerListeners.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/ca/tweetzy/auctionhouse/listeners/CMIListener.java b/src/main/java/ca/tweetzy/auctionhouse/listeners/CMIListener.java index 486b01c..7876291 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/listeners/CMIListener.java +++ b/src/main/java/ca/tweetzy/auctionhouse/listeners/CMIListener.java @@ -18,8 +18,9 @@ package ca.tweetzy.auctionhouse.listeners; -import com.Zrips.CMI.events.CMIAnvilItemRepairEvent; +import ca.tweetzy.core.compatibility.XMaterial; import ca.tweetzy.flight.nbtapi.NBT; +import com.Zrips.CMI.events.CMIAnvilItemRepairEvent; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; @@ -35,7 +36,7 @@ public final class CMIListener implements Listener { @EventHandler public void onCMIRepair(CMIAnvilItemRepairEvent event) { ItemStack stack = event.getItemTo(); - if (stack == null) return; + if (stack == null || stack.getType() == XMaterial.AIR.parseMaterial() || stack.getAmount() == 0) return; NBT.modify(stack, nbt -> { nbt.setBoolean("AuctionHouseRepaired", true); diff --git a/src/main/java/ca/tweetzy/auctionhouse/listeners/PlayerListeners.java b/src/main/java/ca/tweetzy/auctionhouse/listeners/PlayerListeners.java index 707c060..4727aec 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/listeners/PlayerListeners.java +++ b/src/main/java/ca/tweetzy/auctionhouse/listeners/PlayerListeners.java @@ -191,7 +191,7 @@ public class PlayerListeners implements Listener { @EventHandler public void onInventoryClick(PrepareAnvilEvent event) { ItemStack stack = event.getResult(); - if (stack == null) return; + if (stack == null || stack.getType() == XMaterial.AIR.parseMaterial() || stack.getAmount() == 0) return; NBT.modify(stack, nbt -> { nbt.setBoolean("AuctionHouseRepaired", true);