mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-03-12 06:42:49 +01:00
Fixes player teleportation in void. (#1716)
The issue happens mostly with the end portals. Apparently, teleportation to the end is processed before the Bukkit task that runs SafeSpotTeleport. The first check if a player is in the starting world fails, and SafeSpotTeleport is not called. I set the event to be cancelled in all situations when we do not create portals, so it always triggers SafeSpotTeleport. This should fix the bug with players appearing in the void.
This commit is contained in:
parent
8ce30a7cb5
commit
592b4e3d1f
@ -215,6 +215,14 @@ public class PortalTeleportationListener implements Listener {
|
||||
e.getEntity().setVelocity(new Vector(0,0,0));
|
||||
e.getEntity().setFallDistance(0);
|
||||
}
|
||||
|
||||
// If we do not generate portals, teleporation should happen manually with safe spot builder.
|
||||
// Otherwise, we could end up with situations when player is placed in mid air, if teleporation
|
||||
// is done instantly.
|
||||
// Our safe spot task is triggered in next tick, however, end teleporation happens in the same tick.
|
||||
// It is placed outside THE_END check, as technically it could happen with the nether portal too.
|
||||
e.setCancelled(true);
|
||||
|
||||
// If there is a portal to go to already, then the player will go there
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (!e.getEntity().getWorld().equals(toWorld)) {
|
||||
|
Loading…
Reference in New Issue
Block a user