1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Don't append a \0 on the last element

This commit is contained in:
Tim203
2022-02-07 00:11:09 +01:00
parent 4e60f9a1ed
commit 51c828d5e7

View File

@@ -95,7 +95,7 @@ public final class FloodgateHandshakeHandler {
String floodgateData = null;
int dataVersion = -1;
StringBuilder hostnameBuilder = new StringBuilder();
StringBuilder builder = new StringBuilder();
for (String value : hostnameItems) {
int version = FloodgateCipher.version(value);
if (floodgateData == null && version != -1) {
@@ -103,10 +103,14 @@ public final class FloodgateHandshakeHandler {
dataVersion = version;
continue;
}
hostnameBuilder.append(value).append('\0');
if (builder.length() > 0) {
builder.append('\0');
}
builder.append(value);
}
// hostname now doesn't have Floodgate data anymore if it had
return new HostnameSeparationResult(floodgateData, dataVersion, hostnameBuilder.toString());
// the new hostname doesn't have Floodgate data anymore, if it had Floodgate data.
return new HostnameSeparationResult(floodgateData, dataVersion, builder.toString());
}
public CompletableFuture<HandshakeResult> handle(