From a35353a802bab25a6c1f14dc9204a483324889e4 Mon Sep 17 00:00:00 2001 From: BONNe Date: Wed, 15 Nov 2023 23:34:13 +0200 Subject: [PATCH] Fixes an issue with entity teleportation if nether/end worlds are disabled (#2227) There was a bug that used old code (environment switching) for teleportation out of dimension. The issue should be fixed with calling just calling teleportation with portal environment. --- .../teleports/EntityTeleportListener.java | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/listeners/teleports/EntityTeleportListener.java b/src/main/java/world/bentobox/bentobox/listeners/teleports/EntityTeleportListener.java index 3cf5b0904..c312099d3 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/teleports/EntityTeleportListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/teleports/EntityTeleportListener.java @@ -150,18 +150,9 @@ public void onEntityEnterPortal(EntityPortalEnterEvent event) // Entities are teleported instantly. if (!Bukkit.getAllowNether() && type.equals(Material.NETHER_PORTAL)) { - if (fromWorld == overWorld) - { - this.portalProcess( - new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0), - World.Environment.NETHER); - } - else - { - this.portalProcess( - new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0), - World.Environment.NORMAL); - } + this.portalProcess( + new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0), + World.Environment.NETHER); // Do not process anything else. return; @@ -170,18 +161,9 @@ public void onEntityEnterPortal(EntityPortalEnterEvent event) // Entities are teleported instantly. if (!Bukkit.getAllowEnd() && (type.equals(Material.END_PORTAL) || type.equals(Material.END_GATEWAY))) { - if (fromWorld == this.getNetherEndWorld(overWorld, World.Environment.THE_END)) - { - this.portalProcess( - new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0), - World.Environment.NORMAL); - } - else - { - this.portalProcess( - new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0), - World.Environment.THE_END); - } + this.portalProcess( + new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0), + World.Environment.THE_END); } }