diff --git a/core/src/main/java/me/pikamug/quests/listeners/BukkitItemListener.java b/core/src/main/java/me/pikamug/quests/listeners/BukkitItemListener.java index ad73759a3..6732f63ce 100644 --- a/core/src/main/java/me/pikamug/quests/listeners/BukkitItemListener.java +++ b/core/src/main/java/me/pikamug/quests/listeners/BukkitItemListener.java @@ -22,6 +22,7 @@ import org.bukkit.event.enchantment.EnchantItemEvent; import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType.SlotType; import org.bukkit.event.player.PlayerItemConsumeEvent; @@ -162,6 +163,25 @@ public class BukkitItemListener implements Listener { } } + @EventHandler + public void onInventoryDrag(final InventoryDragEvent event) { + if (event.isCancelled()) { + return; + } + if (event.getWhoClicked() instanceof Player) { + if (event.getInventory().getType() == InventoryType.BREWING) { + final Quester quester = plugin.getQuester(event.getWhoClicked().getUniqueId()); + for (final Quest quest : plugin.getLoadedQuests()) { + if (quester.getCurrentQuests().containsKey(quest) + && quester.getCurrentStage(quest).containsObjective(ObjectiveType.BREW_ITEM)) { + event.setCancelled(true); + return; + } + } + } + } + } + public boolean isAllowedBrewingAction(final InventoryClickEvent event) { if (event.getCursor() != null && isWaterBottle(event.getCursor())) { return true;