mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +00:00
Correct unsafe future joining
This commit is contained in:
1 parent
adac00ea47
commit
950a51c140
14 files changed
+42
-42
No files matched your search
@@ -197,7 +197,7 @@ public class TeleportManager {
|
||||
*/
|
||||
public CompletableFuture<Optional<TeleportResult>> teleportNamedPlayers(@NotNull String playerName, @NotNull String targetPlayer,
|
||||
@NotNull OnlineUser requester, final boolean timed) {
|
||||
return getPlayerPositionByName(requester, targetPlayer).thenApply(position -> {
|
||||
return getPlayerPositionByName(requester, targetPlayer).thenApplyAsync(position -> {
|
||||
if (position.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
@@ -375,7 +375,7 @@ public class TeleportManager {
|
||||
private CompletableFuture<TeleportResult> teleportCrossServer(@NotNull OnlineUser onlineUser, @NotNull Teleport teleport) {
|
||||
|
||||
return plugin.getDatabase().setCurrentTeleport(teleport.player, teleport)
|
||||
.thenApply(ignored -> plugin.getNetworkMessenger().sendPlayer(onlineUser, teleport.target.server)
|
||||
.thenApplyAsync(ignored -> plugin.getNetworkMessenger().sendPlayer(onlineUser, teleport.target.server)
|
||||
.thenApply(completed -> completed ? TeleportResult.COMPLETED_CROSS_SERVER :
|
||||
TeleportResult.FAILED_INVALID_SERVER)
|
||||
.join());
|
||||
|
||||
Reference in new issue
Block a user