From a0e1359557b0d852953b8057fac7a561dde9fe86 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 15 Feb 2019 16:07:19 -0500 Subject: [PATCH] Fix build --- .../client/ClientPlaySessionHandler.java | 44 +++---------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index a70f2952c..dddfbef02 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -143,14 +143,6 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { return false; } - if (player.getProtocolVersion().compareTo(MINECRAFT_1_13) >= 0) { - return handleTabCompleteModern(packet); - } else { - return handleTabCompleteLegacy(packet); - } - } - - private boolean handleTabCompleteModern(TabCompleteRequest packet) { // In 1.13+, we need to do additional work for the richer suggestions available. String command = packet.getCommand().substring(1); int spacePos = command.indexOf(' '); @@ -160,6 +152,12 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { String commandLabel = command.substring(0, spacePos); if (!server.getCommandManager().hasCommand(commandLabel)) { + if (player.getProtocolVersion().compareTo(MINECRAFT_1_13) < 0) { + // Outstanding tab completes are recorded for use with 1.12 clients and below to provide + // tab list completion support for command names. In 1.13, Brigadier handles everything for + // us. + legacyCommandTabComplete = packet; + } return false; } @@ -198,36 +196,6 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { return true; } - private boolean handleTabCompleteLegacy(TabCompleteRequest packet) { - // Let us check for a possible proxy command. - String command = packet.getCommand().substring(1); - int spacePos = command.indexOf(' '); - if (spacePos >= 0) { - String commandLabel = command.substring(0, spacePos); - if (server.getCommandManager().hasCommand(commandLabel)) { - List suggestions = server.getCommandManager().offerSuggestions(player, command); - if (!suggestions.isEmpty()) { - List offers = new ArrayList<>(); - for (String suggestion : suggestions) { - offers.add(new Offer(suggestion)); - } - TabCompleteResponse resp = new TabCompleteResponse(); - resp.getOffers().addAll(offers); - - player.getMinecraftConnection().write(resp); - return true; - } - } - } - - // Outstanding tab completes are recorded for use with 1.12 clients and below to provide - // tab list completion support for command names. In 1.13, Brigadier handles everything for - // us. - legacyCommandTabComplete = packet; - - return false; - } - @Override public boolean handle(PluginMessage packet) { VelocityServerConnection serverConn = player.getConnectedServer();