mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
fix: dismount before changing servers, close #555
This commit is contained in:
5 files changed
+61
-5
No files matched your search
@@ -34,6 +34,7 @@ import space.arim.morepaperlib.scheduling.GracefulScheduling;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -106,6 +107,23 @@ public class BukkitUser extends OnlineUser {
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> dismount() {
|
||||
final CompletableFuture<Void> future = new CompletableFuture<>();
|
||||
((BukkitHuskHomes) plugin).getScheduler().entitySpecificScheduler(player).run(
|
||||
() -> {
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
future.complete(null);
|
||||
},
|
||||
() -> {
|
||||
plugin.log(Level.WARNING, "User offline when dismounting: " + player.getName());
|
||||
future.complete(null);
|
||||
}
|
||||
);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleportLocally(@NotNull Location location, boolean async) throws TeleportationException {
|
||||
// Ensure the world exists
|
||||
|
||||
Reference in new issue
Block a user