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.
This commit is contained in:
BONNe 2023-11-15 23:34:13 +02:00 committed by GitHub
parent 63d092db93
commit a35353a802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 24 deletions

View File

@ -150,18 +150,9 @@ public class EntityTeleportListener extends AbstractTeleportListener implements
// 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 class EntityTeleportListener extends AbstractTeleportListener implements
// 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);
}
}