Remove IPv6 scope if present

This commit is contained in:
Tim203 2022-01-28 13:08:10 +01:00
parent f682cf1326
commit 5ce2c113ae
No known key found for this signature in database
GPG Key ID: 064EE9F5BF7C3EE8
1 changed files with 8 additions and 1 deletions

View File

@ -796,6 +796,13 @@ public class GeyserSession implements GeyserConnection, CommandSender {
FloodgateSkinUploader skinUploader = geyser.getSkinUploader();
FloodgateCipher cipher = geyser.getCipher();
String bedrockAddress = upstream.getAddress().getAddress().getHostAddress();
// both BungeeCord and Velocity remove the IPv6 scope (if there is one) for Spigot
int ipv6ScopeIndex = bedrockAddress.indexOf('%');
if (ipv6ScopeIndex != -1) {
bedrockAddress = bedrockAddress.substring(0, ipv6ScopeIndex);
}
encryptedData = cipher.encryptFromString(BedrockData.of(
clientData.getGameVersion(),
authData.name(),
@ -804,7 +811,7 @@ public class GeyserSession implements GeyserConnection, CommandSender {
clientData.getLanguageCode(),
clientData.getUiProfile().ordinal(),
clientData.getCurrentInputMode().ordinal(),
upstream.getAddress().getAddress().getHostAddress(),
bedrockAddress,
skinUploader.getId(),
skinUploader.getVerifyCode()
).toString());