geforkt von Mirrors/Velocity
Tiny legacy player info forwarding forwarding micro-optimization.
Dieser Commit ist enthalten in:
Ursprung
8a9d1b1ac9
Commit
65ff9ebb39
@ -100,14 +100,19 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createBungeeForwardingAddress() {
|
private String createLegacyForwardingAddress() {
|
||||||
// BungeeCord IP forwarding is simply a special injection after the "address" in the handshake,
|
// BungeeCord IP forwarding is simply a special injection after the "address" in the handshake,
|
||||||
// separated by \0 (the null byte). In order, you send the original host, the player's IP, their
|
// separated by \0 (the null byte). In order, you send the original host, the player's IP, their
|
||||||
// UUID (undashed), and if you are in online-mode, their login properties (from Mojang).
|
// UUID (undashed), and if you are in online-mode, their login properties (from Mojang).
|
||||||
return registeredServer.getServerInfo().getAddress().getHostString() + "\0"
|
StringBuilder data = new StringBuilder(2048)
|
||||||
+ proxyPlayer.getRemoteAddress().getHostString() + "\0"
|
.append(registeredServer.getServerInfo().getAddress().getHostString())
|
||||||
+ proxyPlayer.getProfile().getId() + "\0"
|
.append('\0')
|
||||||
+ GSON.toJson(proxyPlayer.getProfile().getProperties());
|
.append(proxyPlayer.getRemoteAddress().getHostString())
|
||||||
|
.append('\0')
|
||||||
|
.append(proxyPlayer.getProfile().getId())
|
||||||
|
.append('\0');
|
||||||
|
GSON.toJson(proxyPlayer.getProfile().getProperties(), data);
|
||||||
|
return data.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startHandshake() {
|
private void startHandshake() {
|
||||||
@ -123,7 +128,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
|
|||||||
handshake.setNextStatus(StateRegistry.LOGIN_ID);
|
handshake.setNextStatus(StateRegistry.LOGIN_ID);
|
||||||
handshake.setProtocolVersion(proxyPlayer.getConnection().getNextProtocolVersion());
|
handshake.setProtocolVersion(proxyPlayer.getConnection().getNextProtocolVersion());
|
||||||
if (forwardingMode == PlayerInfoForwarding.LEGACY) {
|
if (forwardingMode == PlayerInfoForwarding.LEGACY) {
|
||||||
handshake.setServerAddress(createBungeeForwardingAddress());
|
handshake.setServerAddress(createLegacyForwardingAddress());
|
||||||
} else if (proxyPlayer.getConnection().isLegacyForge()) {
|
} else if (proxyPlayer.getConnection().isLegacyForge()) {
|
||||||
handshake.setServerAddress(handshake.getServerAddress() + "\0FML\0");
|
handshake.setServerAddress(handshake.getServerAddress() + "\0FML\0");
|
||||||
} else {
|
} else {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren