Skip to content

Commit

Permalink
Ensure player is dismounted before teleport, fix #496
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Sep 25, 2023
1 parent e579b2b commit 2145d69
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public void teleportLocally(@NotNull Location location, boolean async) throws Te
// 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void teleportLocally(@NotNull Location location, boolean async) throws Te
throw new TeleportationException(TeleportationException.Type.ILLEGAL_TARGET_COORDINATES, plugin);
}

player.dismountVehicle();
FabricDimensions.teleport(
player,
server.getWorld(server.getWorldRegistryKeys().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public void teleportLocally(@NotNull Location location, boolean async) {
if (serverLocation.isEmpty()) {
return;
}
player.vehicle().ifPresent(vehicle -> vehicle.get().passengers().remove(player));
player.setLocation(serverLocation.get());
});
}
Expand Down

0 comments on commit 2145d69

Please sign in to comment.