Fix 65f8883 breaking offline home listing (#3446)

This commit is contained in:
Josh Roy 2020-07-02 21:59:40 -04:00 committed by GitHub
parent 0b4ee9e73e
commit 8f86849aec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -62,11 +62,9 @@ public class Commandhome extends EssentialsCommand {
}
goHome(user, player, homeName.toLowerCase(Locale.ENGLISH), charge, getNewExceptionFuture(user.getSource(), commandLabel));
} catch (NotEnoughArgumentsException e) {
if (!player.getBase().isOnline() || player.getBase() instanceof OfflinePlayer) {
throw new Exception(tl("bedOffline"));
}
final User finalPlayer = player;
PaperLib.getBedSpawnLocationAsync(player.getBase(), true).thenAccept(bed -> {
CompletableFuture<Location> message = new CompletableFuture<>();
message.thenAccept(bed -> {
final List<String> homes = finalPlayer.getHomes();
if (homes.isEmpty() && finalPlayer.equals(user)) {
if (ess.getSettings().isSpawnIfNoHome()) {
@ -94,6 +92,11 @@ public class Commandhome extends EssentialsCommand {
user.sendMessage(tl("homes", StringUtil.joinList(homes), count, getHomeLimit(finalPlayer)));
}
});
if (!player.getBase().isOnline() || player.getBase() instanceof OfflinePlayer) {
message.complete(null);
return;
}
PaperLib.getBedSpawnLocationAsync(player.getBase(), true).thenAccept(message::complete);
}
}