mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-22 18:46:35 +01:00
updated listener
This commit is contained in:
parent
b55952942a
commit
bed94dc936
@ -27,12 +27,13 @@ public class Listeners implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onItemInteract(PlayerInteractEvent event) {
|
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();
|
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(),
|
event.getItem().getItemMeta().getDisplayName(),
|
||||||
new PortalLocation(blockloc.getWorld().getName(), blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ()),
|
new PortalLocation(blockloc.getWorld().getName(), blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ()),
|
||||||
event.getAction() == Action.LEFT_CLICK_BLOCK);
|
event.getAction() == Action.LEFT_CLICK_BLOCK);
|
||||||
|
event.setCancelled(!allowEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user