Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-23 23:00:35 +01:00
Fix some tab-complete regressions
Dieser Commit ist enthalten in:
Ursprung
5c93fd3866
Commit
d0cbcf65e9
@ -167,7 +167,14 @@ public class VelocityCommandManager implements CommandManager {
|
||||
if (line.isEmpty()) {
|
||||
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
|
||||
|
@ -365,12 +365,12 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
private boolean handleCommandTabComplete(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(' ');
|
||||
if (spacePos == -1) {
|
||||
spacePos = command.length();
|
||||
int commandEndPosition = command.indexOf(' ');
|
||||
if (commandEndPosition == -1) {
|
||||
commandEndPosition = command.length();
|
||||
}
|
||||
|
||||
String commandLabel = command.substring(0, spacePos);
|
||||
String commandLabel = command.substring(0, commandEndPosition);
|
||||
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
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren