Correct unsafe future joining

This commit is contained in:
William278 committed 2022-09-07 22:36:06 +03:00
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())));
}
/**