mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-24 19:46:34 +01:00
Prevent brew result drag, fixes #2203
This commit is contained in:
parent
d0c1f92acf
commit
74a3d093fa
@ -22,6 +22,7 @@ import org.bukkit.event.enchantment.EnchantItemEvent;
|
|||||||
import org.bukkit.event.inventory.CraftItemEvent;
|
import org.bukkit.event.inventory.CraftItemEvent;
|
||||||
import org.bukkit.event.inventory.InventoryAction;
|
import org.bukkit.event.inventory.InventoryAction;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
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) {
|
public boolean isAllowedBrewingAction(final InventoryClickEvent event) {
|
||||||
if (event.getCursor() != null && isWaterBottle(event.getCursor())) {
|
if (event.getCursor() != null && isWaterBottle(event.getCursor())) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user