mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +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
@@ -174,10 +174,10 @@ public interface HuskHomes {
|
||||
*
|
||||
* @return the {@link Position} of the spawn, or an empty {@link Optional} if it has not been set
|
||||
*/
|
||||
default Optional<? extends Position> getSpawn() {
|
||||
return getSettings().crossServer && getSettings().globalSpawn
|
||||
default CompletableFuture<Optional<? extends Position>> getSpawn() {
|
||||
return CompletableFuture.supplyAsync(() -> getSettings().crossServer && getSettings().globalSpawn
|
||||
? getDatabase().getWarp(getSettings().globalSpawnName).join()
|
||||
: getLocalCachedSpawn().flatMap(spawn -> spawn.getPosition(getPluginServer()));
|
||||
: getLocalCachedSpawn().flatMap(spawn -> spawn.getPosition(getPluginServer())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user