From cc839859a8de4fc5c1dc31614a9e2ae95128b8be Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 16 Jun 2022 22:11:24 +0200 Subject: [PATCH] Hotfix SWCommand --- src/de/steamwar/command/SWCommand.java | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/command/SWCommand.java b/src/de/steamwar/command/SWCommand.java index 211bb60..4dbdd67 100644 --- a/src/de/steamwar/command/SWCommand.java +++ b/src/de/steamwar/command/SWCommand.java @@ -22,6 +22,7 @@ package de.steamwar.command; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.messages.ChatSender; +import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -30,6 +31,7 @@ import net.md_5.bungee.api.plugin.TabExecutor; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; import java.util.logging.Level; @@ -61,17 +63,19 @@ public class SWCommand extends AbstractSWCommand { @Override protected void createAndSafeCommand(String command, String[] aliases) { - this.command = new TabCompletableCommand(command, permission, aliases) { - @Override - public void execute(CommandSender commandSender, String[] strings) { - SWCommand.this.execute(commandSender, null, strings); - } + BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { + this.command = new TabCompletableCommand(command, permission, aliases) { + @Override + public void execute(CommandSender commandSender, String[] strings) { + SWCommand.this.execute(commandSender, null, strings); + } - @Override - public Iterable onTabComplete(CommandSender commandSender, String[] strings) { - return SWCommand.this.tabComplete(commandSender, null, strings); - } - }; + @Override + public Iterable onTabComplete(CommandSender commandSender, String[] strings) { + return SWCommand.this.tabComplete(commandSender, null, strings); + } + }; + }, 100, TimeUnit.MILLISECONDS); } private abstract static class TabCompletableCommand extends Command implements TabExecutor {