From 5604392814d154a62aeb88cb624862d3129337fb Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Sat, 10 Dec 2022 05:20:26 -0500 Subject: [PATCH] Return cancelled objective events, part 2 --- .../me/blackvein/quests/listeners/ItemListener.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/main/java/me/blackvein/quests/listeners/ItemListener.java b/core/src/main/java/me/blackvein/quests/listeners/ItemListener.java index 97f81e026..ca237a253 100644 --- a/core/src/main/java/me/blackvein/quests/listeners/ItemListener.java +++ b/core/src/main/java/me/blackvein/quests/listeners/ItemListener.java @@ -42,6 +42,9 @@ public class ItemListener implements Listener { @EventHandler public void onCraftItem(final CraftItemEvent event) { + if (event.isCancelled()) { + return; + } if (event.getAction().equals(InventoryAction.NOTHING)) { return; } @@ -94,6 +97,9 @@ public class ItemListener implements Listener { @EventHandler public void onInventoryClick(final InventoryClickEvent event) { + if (event.isCancelled()) { + return; + } if (event.getWhoClicked() instanceof Player) { final Player player = (Player) event.getWhoClicked(); if (event.getInventory().getType() == InventoryType.FURNACE @@ -150,6 +156,9 @@ public class ItemListener implements Listener { @EventHandler public void onEnchantItem(final EnchantItemEvent event) { + if (event.isCancelled()) { + return; + } if (plugin.canUseQuests(event.getEnchanter().getUniqueId())) { final ItemStack enchantedItem = event.getItem().clone(); enchantedItem.setAmount(1); @@ -188,6 +197,9 @@ public class ItemListener implements Listener { @EventHandler public void onConsumeItem(final PlayerItemConsumeEvent event) { + if (event.isCancelled()) { + return; + } if (plugin.canUseQuests(event.getPlayer().getUniqueId())) { final ItemStack consumedItem = event.getItem().clone(); consumedItem.setAmount(1);