13
0
geforkt von Mirrors/Velocity

Fix some tab-complete regressions

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-04-19 09:07:17 -04:00
Ursprung 5c93fd3866
Commit d0cbcf65e9
2 geänderte Dateien mit 12 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -167,7 +167,14 @@ public class VelocityCommandManager implements CommandManager {
if (line.isEmpty()) { if (line.isEmpty()) {
return new String[0]; return new String[0];
} }
return line.trim().split(" ", -1);
String[] trimmed = line.trim().split(" ", -1);
if (line.endsWith(" ") && !line.trim().isEmpty()) {
// To work around a 1.13+ specific bug we have to inject a space at the end of the arguments
trimmed = Arrays.copyOf(trimmed, trimmed.length + 1);
trimmed[trimmed.length - 1] = "";
}
return trimmed;
} }
@Override @Override

Datei anzeigen

@ -365,12 +365,12 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
private boolean handleCommandTabComplete(TabCompleteRequest packet) { private boolean handleCommandTabComplete(TabCompleteRequest packet) {
// In 1.13+, we need to do additional work for the richer suggestions available. // In 1.13+, we need to do additional work for the richer suggestions available.
String command = packet.getCommand().substring(1); String command = packet.getCommand().substring(1);
int spacePos = command.indexOf(' '); int commandEndPosition = command.indexOf(' ');
if (spacePos == -1) { if (commandEndPosition == -1) {
spacePos = command.length(); commandEndPosition = command.length();
} }
String commandLabel = command.substring(0, spacePos); String commandLabel = command.substring(0, commandEndPosition);
if (!server.getCommandManager().hasCommand(commandLabel)) { if (!server.getCommandManager().hasCommand(commandLabel)) {
if (player.getProtocolVersion().compareTo(MINECRAFT_1_13) < 0) { if (player.getProtocolVersion().compareTo(MINECRAFT_1_13) < 0) {
// Outstanding tab completes are recorded for use with 1.12 clients and below to provide // Outstanding tab completes are recorded for use with 1.12 clients and below to provide