mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Fix #125, IllegalStateException when attempting to teleport with a passenger attached
This commit is contained in:
1 parent
54206f110e
commit
be6ec03e52
2 files changed
+15
-11
No files matched your search
@@ -106,10 +106,12 @@ public class PlayerListener implements Listener {
|
||||
|
||||
private void teleportToSpawn(Player player) {
|
||||
if (TeleportManager.getSpawnLocation() != null) {
|
||||
if (!player.isEmpty()) {
|
||||
player.eject(); // Eject passengers before teleporting
|
||||
}
|
||||
Bukkit.getScheduler().runTask(plugin, () -> PaperLib.teleportAsync(player, TeleportManager.getSpawnLocation().getLocation()));
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (!player.isEmpty()) {
|
||||
player.eject(); // Eject passengers before teleporting
|
||||
}
|
||||
PaperLib.teleportAsync(player, TeleportManager.getSpawnLocation().getLocation());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,13 +92,15 @@ public class TeleportManager {
|
||||
DataManager.setPlayerTeleporting(player, false, connection);
|
||||
DataManager.deletePlayerDestination(player.getName(), connection);
|
||||
Location targetLocation = targetPoint[0].getLocation();
|
||||
if (!player.isEmpty()) {
|
||||
player.eject(); // Eject passengers before teleporting
|
||||
}
|
||||
Bukkit.getScheduler().runTask(plugin, () -> PaperLib.teleportAsync(player, targetLocation).thenRun(() -> {
|
||||
player.playSound(targetLocation, HuskHomes.getSettings().getTeleportationCompleteSound(), 1, 1);
|
||||
MessageManager.sendMessage(player, "teleporting_complete");
|
||||
}));
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (!player.isEmpty()) {
|
||||
player.eject(); // Eject passengers before teleporting
|
||||
}
|
||||
PaperLib.teleportAsync(player, targetLocation).thenRun(() -> {
|
||||
player.playSound(targetLocation, HuskHomes.getSettings().getTeleportationCompleteSound(), 1, 1);
|
||||
MessageManager.sendMessage(player, "teleporting_complete");
|
||||
});
|
||||
});
|
||||
} else if (HuskHomes.getSettings().doBungee()) {
|
||||
DataManager.setPlayerDestinationLocation(player, targetPoint[0], connection);
|
||||
DataManager.setPlayerTeleporting(player, true, connection);
|
||||
|
||||
Reference in new issue
Block a user