diff --git a/src/main/java/org/mvplugins/multiverse/netherportals/listeners/MVNPEntityListener.java b/src/main/java/org/mvplugins/multiverse/netherportals/listeners/MVNPEntityListener.java index 6ef6ecb..9abceee 100644 --- a/src/main/java/org/mvplugins/multiverse/netherportals/listeners/MVNPEntityListener.java +++ b/src/main/java/org/mvplugins/multiverse/netherportals/listeners/MVNPEntityListener.java @@ -191,10 +191,6 @@ public void onEntityPortalEnter(EntityPortalEnterEvent event) { Location currentLocation = this.locationManipulation.getBlockLocation(event.getLocation()); - if (customPortalsHandler.isHandledByCustomPortals(event.getEntity(), currentLocation)) { - return; - } - // determine what kind of portal the player is using PortalType type = switch (currentLocation.getBlock().getType()) { case END_PORTAL -> PortalType.ENDER; @@ -213,9 +209,17 @@ public void onEntityPortalEnter(EntityPortalEnterEvent event) { // in a portal. they'll automatically be removed when they leave eventRecord.addToRecord(type, player.getUniqueId()); + if (customPortalsHandler.isHandledByCustomPortals(player, event.getLocation().clone())) { + return; + } + MVPlayerTouchedPortalEvent playerTouchedPortalEvent = new MVPlayerTouchedPortalEvent(player, event.getLocation()); Bukkit.getPluginManager().callEvent(playerTouchedPortalEvent); Location eventLocation = event.getLocation().clone(); + if (playerTouchedPortalEvent.isCancelled()) { + Logging.finest("Another plugin cancelled the enter Event for NetherPortals!"); + return; + } if (!playerTouchedPortalEvent.canUseThisPortal()) { // Someone else said the player is not allowed to go here. if (this.shootPlayer(player, eventLocation.getBlock(), type)) { @@ -224,10 +228,6 @@ public void onEntityPortalEnter(EntityPortalEnterEvent event) { Logging.finest("Someone requested that this player be bounced back!"); } - if (playerTouchedPortalEvent.isCancelled()) { - Logging.finest("Someone cancelled the enter Event for NetherPortals!"); - return; - } if (this.playerErrors.containsKey(player.getName())) { Date lastTry = this.playerErrors.get(player.getName());