From 064ef978dce9bc57c633f4ffbaccbcafdd6af1c8 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Sat, 1 Feb 2020 04:16:34 -0500 Subject: [PATCH] Disallow placing of the Quests Journal within Lecterns --- .../java/me/blackvein/quests/listeners/PlayerListener.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main/src/main/java/me/blackvein/quests/listeners/PlayerListener.java b/main/src/main/java/me/blackvein/quests/listeners/PlayerListener.java index b673feb6e..b0b7d8ac2 100644 --- a/main/src/main/java/me/blackvein/quests/listeners/PlayerListener.java +++ b/main/src/main/java/me/blackvein/quests/listeners/PlayerListener.java @@ -211,6 +211,13 @@ public class PlayerListener implements Listener { // Do nothing, getHand() not present pre-1.9 } if (e == null || e.equals(EquipmentSlot.HAND)) { //If the event is fired by HAND (main hand) + if (evt.hasBlock() && evt.getClickedBlock().getType().name().equals("LECTERN")) { + if (ItemUtil.isJournal(evt.getPlayer().getItemInHand())) { + evt.setCancelled(true); + evt.getPlayer().sendMessage(ChatColor.RED + Lang.get(evt.getPlayer(), "journalDenied")); + return; + } + } if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) { if (evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { final Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());