Fixes end portals completely hijacking BungeeCord teleportation

This commit is contained in:
Kristian Knarvik 2022-06-25 10:54:19 +02:00
parent 524130c4e0
commit 2076fda4d1

View File

@ -70,13 +70,15 @@ public class PortalEventListener implements Listener {
//Remove any old player teleportations in case weird things happen
playersFromTheEnd.removeIf((teleportation -> teleportation.getPlayer() == player));
//Decide if the anything stops the player from teleporting
if (PermissionHelper.playerCannotTeleport(portal, portal.getPortalActivator().getDestination(), player, null)) {
if (PermissionHelper.playerCannotTeleport(portal, portal.getPortalActivator().getDestination(), player, null) ||
portal.getOptions().isBungee()) {
//Teleport the player back to the portal they came in, just in case
playersFromTheEnd.add(new FromTheEndTeleportation(player, portal));
}
} else {
playersFromTheEnd.add(new FromTheEndTeleportation(player, portal.getPortalActivator().getDestination()));
}
}
}
/**
* Listen for the respawn event to catch players teleporting from the end in an artificial end portal