mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
fix: dismount before changing servers, close #555
This commit is contained in:
5 files changed
+61
-5
No files matched your search
@@ -98,12 +98,14 @@ public class PluginMessageBroker extends Broker {
|
||||
|
||||
@Override
|
||||
public void changeServer(@NotNull OnlineUser user, @NotNull String server) {
|
||||
final ByteArrayDataOutput outputStream = ByteStreams.newDataOutput();
|
||||
user.dismount().thenRun(() -> {
|
||||
final ByteArrayDataOutput outputStream = ByteStreams.newDataOutput();
|
||||
|
||||
outputStream.writeUTF("Connect");
|
||||
outputStream.writeUTF(server);
|
||||
outputStream.writeUTF("Connect");
|
||||
outputStream.writeUTF(server);
|
||||
|
||||
user.sendPluginMessage(BUNGEE_CHANNEL_ID, outputStream.toByteArray());
|
||||
user.sendPluginMessage(BUNGEE_CHANNEL_ID, outputStream.toByteArray());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.intellij.lang.annotations.Subst;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* A cross-platform representation of a logged-in {@link User}.
|
||||
@@ -180,6 +181,13 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs
|
||||
return plugin.getAudience(getUuid());
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismount the player, readying them for teleportation.
|
||||
*
|
||||
* @return a {@link CompletableFuture} that completes when the player has dismounted
|
||||
*/
|
||||
public abstract CompletableFuture<Void> dismount();
|
||||
|
||||
/**
|
||||
* Teleport a player to the specified local {@link Location}.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user