Skip to content

Commit

Permalink
Fixes an issue with entity teleportation if nether/end worlds are dis…
Browse files Browse the repository at this point in the history
…abled (#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.
  • Loading branch information
BONNe authored Nov 15, 2023
1 parent 63d092d commit a35353a
Showing 1 changed file with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}

Expand Down

0 comments on commit a35353a

Please sign in to comment.