Disallow placing of the Quests Journal within Lecterns

This commit is contained in:
PikaMug 2020-02-01 04:16:34 -05:00
parent 4bc5e989e0
commit 064ef978dc

View File

@ -211,6 +211,13 @@ public class PlayerListener implements Listener {
// Do nothing, getHand() not present pre-1.9 // 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 (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 (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
if (evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { if (evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
final Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId()); final Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());