fix: hotfix for the bot not being able to reconnect
This commit is contained in:
@@ -12,6 +12,7 @@ import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntryAction;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundCommandSuggestionsPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundPlayerInfoRemovePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundPlayerInfoUpdatePacket;
|
||||
|
||||
@@ -167,9 +168,15 @@ public class PlayersPlugin extends Bot.Listener {
|
||||
}
|
||||
|
||||
private void onTabCompleteTick () {
|
||||
if (tabCompleteQueue.isEmpty()) return;
|
||||
if (!bot.loggedIn || tabCompleteQueue.isEmpty()) return;
|
||||
|
||||
bot.tabComplete.tabComplete("/minecraft:scoreboard players add ").thenApplyAsync(packet -> {
|
||||
final CompletableFuture<ClientboundCommandSuggestionsPacket> future = bot.tabComplete.tabComplete(
|
||||
"/minecraft:scoreboard players add "
|
||||
);
|
||||
|
||||
if (future == null) return;
|
||||
|
||||
future.thenApplyAsync(packet -> {
|
||||
final String[] matches = packet.getMatches();
|
||||
final Component[] tooltips = packet.getTooltips();
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ public class TabCompletePlugin extends Bot.Listener {
|
||||
}
|
||||
|
||||
public CompletableFuture<ClientboundCommandSuggestionsPacket> tabComplete (String command) {
|
||||
if (!bot.loggedIn) return null;
|
||||
|
||||
final int transactionId = nextTransactionId++;
|
||||
|
||||
bot.session.send(new ServerboundCommandSuggestionPacket(transactionId, command));
|
||||
|
||||
Reference in New Issue
Block a user