mirror of
https://github.com/PaperMC/Velocity.git
synced 2025-03-07 15:57:17 +08:00
Manually backport e29e20b
from Velocity 1.1.0
This commit is contained in:
parent
da63406ee7
commit
893391202b
@ -175,31 +175,19 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Offer> offers = new ArrayList<>();
|
List<Offer> offers = new ArrayList<>();
|
||||||
int longestLength = 0;
|
|
||||||
for (String suggestion : suggestions) {
|
for (String suggestion : suggestions) {
|
||||||
offers.add(new Offer(suggestion));
|
offers.add(new Offer(suggestion));
|
||||||
if (suggestion.length() > longestLength) {
|
|
||||||
longestLength = suggestion.length();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TabCompleteResponse resp = new TabCompleteResponse();
|
|
||||||
resp.setTransactionId(packet.getTransactionId());
|
|
||||||
|
|
||||||
int startPos = packet.getCommand().lastIndexOf(' ') + 1;
|
int startPos = packet.getCommand().lastIndexOf(' ') + 1;
|
||||||
int length;
|
if (startPos > 0) {
|
||||||
if (startPos == 0) {
|
TabCompleteResponse resp = new TabCompleteResponse();
|
||||||
startPos = packet.getCommand().length() + 1;
|
resp.setTransactionId(packet.getTransactionId());
|
||||||
length = longestLength;
|
resp.setStart(startPos);
|
||||||
} else {
|
resp.setLength(packet.getCommand().length() - startPos);
|
||||||
length = packet.getCommand().length() - startPos;
|
resp.getOffers().addAll(offers);
|
||||||
|
player.getMinecraftConnection().write(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.setStart(startPos);
|
|
||||||
resp.setLength(length);
|
|
||||||
resp.getOffers().addAll(offers);
|
|
||||||
|
|
||||||
player.getMinecraftConnection().write(resp);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user