Fetch home lists asynchronously due to new event

This commit is contained in:
William278 committed 2022-09-05 01:04:39 +03:00
1 parent a5d8b6ff35
commit 10b7f1629f
2 files changed
+2 -2

No files matched your search

@@ -25,7 +25,7 @@ public class HomeCommand extends CommandBase implements TabCompletable, ConsoleE
@Override
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
switch (args.length) {
case 0 -> plugin.getDatabase().getHomes(onlineUser).thenAccept(homes -> {
case 0 -> plugin.getDatabase().getHomes(onlineUser).thenAcceptAsync(homes -> {
// Send the home list if they have homes set. If they have just one home set, teleport the player
switch (homes.size()) {
case 0 -> plugin.getLocales().getLocale("error_no_homes_set").ifPresent(onlineUser::sendMessage);
@@ -64,7 +64,7 @@ public class HomeListCommand extends CommandBase implements ConsoleExecutable {
return;
}
}
plugin.getDatabase().getHomes(userData.user()).thenAccept(homes -> {
plugin.getDatabase().getHomes(userData.user()).thenAcceptAsync(homes -> {
if (homes.isEmpty()) {
if (!onlineUser.uuid.equals(userData.user().uuid)) {
plugin.getLocales().getLocale("error_no_homes_set_other",