From 34f33c92788bd27628887d5a4fb2fc32db784849 Mon Sep 17 00:00:00 2001 From: hsgamer Date: Fri, 23 Aug 2024 19:11:13 +0700 Subject: [PATCH] only start teleporting if the entity is still in the portal --- .../me/hsgamer/morefoworld/listener/PortalListener.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/me/hsgamer/morefoworld/listener/PortalListener.java b/src/main/java/me/hsgamer/morefoworld/listener/PortalListener.java index c80305c..e97d012 100644 --- a/src/main/java/me/hsgamer/morefoworld/listener/PortalListener.java +++ b/src/main/java/me/hsgamer/morefoworld/listener/PortalListener.java @@ -135,6 +135,13 @@ public void onEntityInsidePortal(final EntityInsideBlockEvent event) { event.setCancelled(true); entity.getScheduler().execute(plugin, () -> { + Block currentBlock = entity.getLocation().getBlock(); + if (currentBlock.getType() != blockTypeInside) { + debug.debug("The entity is not in the portal"); + portalTeleportCache.remove(entity.getUniqueId()); + return; + } + World.Environment fromEnvironment = from.getWorld().getEnvironment(); World.Environment toEnvironment = toWorld.getEnvironment(); Location to;