Make getting warp lists async due to blocking event

This commit is contained in:
William278 committed 2022-09-05 19:06:18 +03:00
1 parent 4db869abf1
commit 2c5486dd35
2 files changed
+2 -2

No files matched your search

@@ -21,7 +21,7 @@ public class WarpCommand extends CommandBase implements TabCompletable, ConsoleE
@Override
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
switch (args.length) {
case 0 -> plugin.getDatabase().getWarps().thenAccept(warps -> {
case 0 -> plugin.getDatabase().getWarps().thenAcceptAsync(warps -> {
if (warps.isEmpty()) {
plugin.getLocales().getLocale("error_no_warps_set").ifPresent(onlineUser::sendMessage);
return;
@@ -48,7 +48,7 @@ public class WarpListCommand extends CommandBase implements ConsoleExecutable {
}
// Dispatch the warp list event
plugin.getDatabase().getWarps().thenAccept(warps -> {
plugin.getDatabase().getWarps().thenAcceptAsync(warps -> {
if (warps.isEmpty()) {
plugin.getLocales().getLocale("error_no_warps_set").ifPresent(onlineUser::sendMessage);
return;