From bed94dc936d45552fb475d56e6936e420fcd2a46 Mon Sep 17 00:00:00 2001 From: sekwah Date: Thu, 22 Feb 2018 02:59:12 +0000 Subject: [PATCH] updated listener --- src/com/sekwah/advancedportals/spigot/Listeners.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/sekwah/advancedportals/spigot/Listeners.java b/src/com/sekwah/advancedportals/spigot/Listeners.java index f7d1ac63..8d1bae6d 100644 --- a/src/com/sekwah/advancedportals/spigot/Listeners.java +++ b/src/com/sekwah/advancedportals/spigot/Listeners.java @@ -27,12 +27,13 @@ public class Listeners implements Listener { @EventHandler public void onItemInteract(PlayerInteractEvent event) { - if ((event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK) && event.getItem() != null) { + if (!event.isCancelled() && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK) && event.getItem() != null) { Location blockloc = event.getClickedBlock().getLocation(); - this.coreListeners.playerInteractWithBlock(new PlayerContainer(event.getPlayer()), event.getMaterial().toString(), + boolean allowEvent = this.coreListeners.playerInteractWithBlock(new PlayerContainer(event.getPlayer()), event.getMaterial().toString(), event.getItem().getItemMeta().getDisplayName(), new PortalLocation(blockloc.getWorld().getName(), blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ()), event.getAction() == Action.LEFT_CLICK_BLOCK); + event.setCancelled(!allowEvent); } }