Ensure player is dismounted before teleport, fix #496

This commit is contained in:
William278 committed 2023-09-25 13:23:53 +01:00
1 parent e579b2b05e
commit 2145d6925f
3 files changed
+3

No files matched your search

@@ -136,6 +136,7 @@ public class BukkitUser extends OnlineUser {
// Run on the appropriate thread scheduler for this platform
plugin.getScheduler().entitySpecificScheduler(player).run(
() -> {
player.leaveVehicle();
if (async || plugin.getScheduler().isUsingFolia()) {
PaperLib.teleportAsync(player, bukkitLocation, PlayerTeleportEvent.TeleportCause.PLUGIN);
return;
@@ -131,6 +131,7 @@ public class FabricUser extends OnlineUser {
throw new TeleportationException(TeleportationException.Type.ILLEGAL_TARGET_COORDINATES, plugin);
}
player.dismountVehicle();
FabricDimensions.teleport(
player,
server.getWorld(server.getWorldRegistryKeys().stream()
@@ -113,6 +113,7 @@ public class SpongeUser extends OnlineUser {
if (serverLocation.isEmpty()) {
return;
}
player.vehicle().ifPresent(vehicle -> vehicle.get().passengers().remove(player));
player.setLocation(serverLocation.get());
});
}