Return cancelled objective events, part 2

This commit is contained in:
PikaMug 2022-12-10 05:20:26 -05:00
parent cd4818bfee
commit 5604392814

View File

@ -42,6 +42,9 @@ public class ItemListener implements Listener {
@EventHandler @EventHandler
public void onCraftItem(final CraftItemEvent event) { public void onCraftItem(final CraftItemEvent event) {
if (event.isCancelled()) {
return;
}
if (event.getAction().equals(InventoryAction.NOTHING)) { if (event.getAction().equals(InventoryAction.NOTHING)) {
return; return;
} }
@ -94,6 +97,9 @@ public class ItemListener implements Listener {
@EventHandler @EventHandler
public void onInventoryClick(final InventoryClickEvent event) { public void onInventoryClick(final InventoryClickEvent event) {
if (event.isCancelled()) {
return;
}
if (event.getWhoClicked() instanceof Player) { if (event.getWhoClicked() instanceof Player) {
final Player player = (Player) event.getWhoClicked(); final Player player = (Player) event.getWhoClicked();
if (event.getInventory().getType() == InventoryType.FURNACE if (event.getInventory().getType() == InventoryType.FURNACE
@ -150,6 +156,9 @@ public class ItemListener implements Listener {
@EventHandler @EventHandler
public void onEnchantItem(final EnchantItemEvent event) { public void onEnchantItem(final EnchantItemEvent event) {
if (event.isCancelled()) {
return;
}
if (plugin.canUseQuests(event.getEnchanter().getUniqueId())) { if (plugin.canUseQuests(event.getEnchanter().getUniqueId())) {
final ItemStack enchantedItem = event.getItem().clone(); final ItemStack enchantedItem = event.getItem().clone();
enchantedItem.setAmount(1); enchantedItem.setAmount(1);
@ -188,6 +197,9 @@ public class ItemListener implements Listener {
@EventHandler @EventHandler
public void onConsumeItem(final PlayerItemConsumeEvent event) { public void onConsumeItem(final PlayerItemConsumeEvent event) {
if (event.isCancelled()) {
return;
}
if (plugin.canUseQuests(event.getPlayer().getUniqueId())) { if (plugin.canUseQuests(event.getPlayer().getUniqueId())) {
final ItemStack consumedItem = event.getItem().clone(); final ItemStack consumedItem = event.getItem().clone();
consumedItem.setAmount(1); consumedItem.setAmount(1);