Skip to content

Commit a35353a

Browse files
authored
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.
1 parent 63d092d commit a35353a

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

src/main/java/world/bentobox/bentobox/listeners/teleports/EntityTeleportListener.java

+6-24
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,9 @@ public void onEntityEnterPortal(EntityPortalEnterEvent event)
150150
// Entities are teleported instantly.
151151
if (!Bukkit.getAllowNether() && type.equals(Material.NETHER_PORTAL))
152152
{
153-
if (fromWorld == overWorld)
154-
{
155-
this.portalProcess(
156-
new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0),
157-
World.Environment.NETHER);
158-
}
159-
else
160-
{
161-
this.portalProcess(
162-
new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0),
163-
World.Environment.NORMAL);
164-
}
153+
this.portalProcess(
154+
new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0),
155+
World.Environment.NETHER);
165156

166157
// Do not process anything else.
167158
return;
@@ -170,18 +161,9 @@ public void onEntityEnterPortal(EntityPortalEnterEvent event)
170161
// Entities are teleported instantly.
171162
if (!Bukkit.getAllowEnd() && (type.equals(Material.END_PORTAL) || type.equals(Material.END_GATEWAY)))
172163
{
173-
if (fromWorld == this.getNetherEndWorld(overWorld, World.Environment.THE_END))
174-
{
175-
this.portalProcess(
176-
new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0),
177-
World.Environment.NORMAL);
178-
}
179-
else
180-
{
181-
this.portalProcess(
182-
new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0),
183-
World.Environment.THE_END);
184-
}
164+
this.portalProcess(
165+
new EntityPortalEvent(entity, event.getLocation(), event.getLocation(), 0),
166+
World.Environment.THE_END);
185167
}
186168
}
187169

0 commit comments

Comments
 (0)