update to 1.9.4

This commit is contained in:
HoosierTransfer 2024-05-11 10:17:00 -04:00
parent 06f03a918c
commit 82665ab9d6
4 changed files with 778 additions and 697 deletions

Binary file not shown.

View File

@ -81,14 +81,21 @@ import net.md_5.bungee.api.event.ServerConnectEvent;
/** /**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved. * Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -141,7 +148,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (ctx.channel().isActive()) { if (ctx.channel().isActive()) {
EaglerXBungee.logger().warning("[Yee][" + ctx.channel().remoteAddress() + "]: Exception Caught: " + cause.toString()); EaglerXBungee.logger()
.warning("[Yee][" + ctx.channel().remoteAddress() + "]: Exception Caught: " + cause.toString());
} }
} }
@ -162,7 +170,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
BungeeCord bungus = BungeeCord.getInstance(); BungeeCord bungus = BungeeCord.getInstance();
int limit = bungus.config.getPlayerLimit(); int limit = bungus.config.getPlayerLimit();
if (limit > 0 && bungus.getOnlineCount() >= limit) { if (limit > 0 && bungus.getOnlineCount() >= limit) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, bungus.getTranslation("proxy_full")) sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
bungus.getTranslation("proxy_full"))
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
connectionClosed = true; connectionClosed = true;
return; return;
@ -177,7 +186,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
} }
if (i >= conf.getMaxPlayer()) { if (i >= conf.getMaxPlayer()) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, bungus.getTranslation("proxy_full")) sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
bungus.getTranslation("proxy_full"))
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
connectionClosed = true; connectionClosed = true;
return; return;
@ -248,13 +258,14 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
EaglerXBungee eaglerXBungee = EaglerXBungee.getEagler(); EaglerXBungee eaglerXBungee = EaglerXBungee.getEagler();
EaglerAuthConfig authConfig = eaglerXBungee.getConfig().getAuthConfig(); EaglerAuthConfig authConfig = eaglerXBungee.getConfig().getAuthConfig();
final int minecraftProtocolVersion = 47; final int minecraftProtocolVersion = 110;
int eaglerLegacyProtocolVersion = buffer.readUnsignedByte(); int eaglerLegacyProtocolVersion = buffer.readUnsignedByte();
if (eaglerLegacyProtocolVersion == 1) { if (eaglerLegacyProtocolVersion == 1) {
if (authConfig.isEnableAuthentication()) { if (authConfig.isEnableAuthentication()) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, "Please update your client to register on this server!") sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
"Please update your client to register on this server!")
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
return; return;
} else if (buffer.readUnsignedByte() != minecraftProtocolVersion) { } else if (buffer.readUnsignedByte() != minecraftProtocolVersion) {
@ -267,7 +278,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
String str = "Outdated Client"; String str = "Outdated Client";
buf.writeByte(str.length()); buf.writeByte(str.length());
buf.writeCharSequence(str, StandardCharsets.US_ASCII); buf.writeCharSequence(str, StandardCharsets.US_ASCII);
ctx.writeAndFlush(new BinaryWebSocketFrame(buf)).addListener(ChannelFutureListener.CLOSE); ctx.writeAndFlush(new BinaryWebSocketFrame(buf))
.addListener(ChannelFutureListener.CLOSE);
return; return;
} }
} else if (eaglerLegacyProtocolVersion == 2) { } else if (eaglerLegacyProtocolVersion == 2) {
@ -320,12 +332,16 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
boolean isClientProbablyOutdated = false; boolean isClientProbablyOutdated = false;
if (!hasV2InList && !hasV3InList) { if (!hasV2InList && !hasV3InList) {
versMisMatch = true; versMisMatch = true;
isServerProbablyOutdated = minProtVers > 3 && maxProtVers > 3; //make sure to update VersionQueryHandler too isServerProbablyOutdated = minProtVers > 3 && maxProtVers > 3; // make sure to update
// VersionQueryHandler
// too
isClientProbablyOutdated = minProtVers < 2 && maxProtVers < 2; isClientProbablyOutdated = minProtVers < 2 && maxProtVers < 2;
} else if (!has47InList) { } else if (!has47InList) {
versMisMatch = true; versMisMatch = true;
isServerProbablyOutdated = minGameVers > minecraftProtocolVersion && maxGameVers > minecraftProtocolVersion; isServerProbablyOutdated = minGameVers > minecraftProtocolVersion
isClientProbablyOutdated = minGameVers < minecraftProtocolVersion && maxGameVers < minecraftProtocolVersion; && maxGameVers > minecraftProtocolVersion;
isClientProbablyOutdated = minGameVers < minecraftProtocolVersion
&& maxGameVers < minecraftProtocolVersion;
} }
clientProtocolVersion = hasV3InList ? 3 : 2; clientProtocolVersion = hasV3InList ? 3 : 2;
@ -342,14 +358,17 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
buf.writeShort(1); buf.writeShort(1);
buf.writeShort(minecraftProtocolVersion); // want game version 47 buf.writeShort(minecraftProtocolVersion); // want game version 47
String str = isClientProbablyOutdated ? "Outdated Client" : (isServerProbablyOutdated ? "Outdated Server" : "Unsupported Client Version"); String str = isClientProbablyOutdated ? "Outdated Client"
: (isServerProbablyOutdated ? "Outdated Server" : "Unsupported Client Version");
buf.writeByte(str.length()); buf.writeByte(str.length());
buf.writeCharSequence(str, StandardCharsets.US_ASCII); buf.writeCharSequence(str, StandardCharsets.US_ASCII);
ctx.writeAndFlush(new BinaryWebSocketFrame(buf)).addListener(ChannelFutureListener.CLOSE); ctx.writeAndFlush(new BinaryWebSocketFrame(buf))
.addListener(ChannelFutureListener.CLOSE);
return; return;
} }
} else { } else {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, "Legacy protocol version should always be '2' on post-snapshot clients") sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
"Legacy protocol version should always be '2' on post-snapshot clients")
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
return; return;
} }
@ -390,7 +409,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
final boolean final_useSnapshotFallbackProtocol = useSnapshotFallbackProtocol; final boolean final_useSnapshotFallbackProtocol = useSnapshotFallbackProtocol;
Runnable continueThread = () -> { Runnable continueThread = () -> {
clientLoginState = HandshakePacketTypes.STATE_CLIENT_VERSION; clientLoginState = HandshakePacketTypes.STATE_CLIENT_VERSION;
gameProtocolVersion = 47; gameProtocolVersion = 110;
clientBrandString = eaglerBrand; clientBrandString = eaglerBrand;
clientVersionString = eaglerVersionString; clientVersionString = eaglerVersionString;
@ -419,9 +438,12 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
int meth = getAuthMethodId(authRequireEvent.getUseAuthType()); int meth = getAuthMethodId(authRequireEvent.getUseAuthType());
if (meth == -1) { if (meth == -1) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, "Unsupported authentication method resolved") sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
"Unsupported authentication method resolved")
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
EaglerXBungee.logger().severe("[" + localAddrString + "]: Disconnecting, unsupported AuthMethod: " + authRequireEvent.getUseAuthType()); EaglerXBungee.logger()
.severe("[" + localAddrString + "]: Disconnecting, unsupported AuthMethod: "
+ authRequireEvent.getUseAuthType());
return; return;
} }
@ -447,52 +469,66 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
authRequireEvent = new EaglercraftIsAuthRequiredEvent(conf, remoteAddress, origin, authRequireEvent = new EaglercraftIsAuthRequiredEvent(conf, remoteAddress, origin,
clientAuth, clientAuthUsername, (reqAuthEvent) -> { clientAuth, clientAuthUsername, (reqAuthEvent) -> {
if (authRequireEvent.shouldKickUser()) { if (authRequireEvent.shouldKickUser()) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, authRequireEvent.getKickMessage()) sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
authRequireEvent.getKickMessage())
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
return; return;
} }
AuthResponse resp = authRequireEvent.getAuthRequired(); AuthResponse resp = authRequireEvent.getAuthRequired();
if (resp == null) { if (resp == null) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, "IsAuthRequiredEvent was not handled") sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
"IsAuthRequiredEvent was not handled")
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
EaglerXBungee.logger().severe("[" + localAddrString + "]: Disconnecting, no installed authentication system handled: " + authRequireEvent.toString()); EaglerXBungee.logger().severe("[" + localAddrString
+ "]: Disconnecting, no installed authentication system handled: "
+ authRequireEvent.toString());
return; return;
} }
if (resp == AuthResponse.DENY) { if (resp == AuthResponse.DENY) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, authRequireEvent.getKickMessage()) sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
authRequireEvent.getKickMessage())
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
return; return;
} }
AuthMethod type = authRequireEvent.getUseAuthType(); AuthMethod type = authRequireEvent.getUseAuthType();
if (type == null) { if (type == null) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, "IsAuthRequiredEvent was not fully handled") sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
"IsAuthRequiredEvent was not fully handled")
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
EaglerXBungee.logger().severe("[" + localAddrString + "]: Disconnecting, no authentication method provided by handler"); EaglerXBungee.logger().severe("[" + localAddrString
+ "]: Disconnecting, no authentication method provided by handler");
return; return;
} }
int typeId = getAuthMethodId(type); int typeId = getAuthMethodId(type);
if (typeId == -1) { if (typeId == -1) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, "Unsupported authentication method resolved") sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
"Unsupported authentication method resolved")
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
EaglerXBungee.logger().severe("[" + localAddrString + "]: Disconnecting, unsupported AuthMethod: " + type); EaglerXBungee.logger().severe("[" + localAddrString
+ "]: Disconnecting, unsupported AuthMethod: " + type);
return; return;
} }
if (!clientAuth && resp == AuthResponse.REQUIRE) { if (!clientAuth && resp == AuthResponse.REQUIRE) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_AUTHENTICATION_REQUIRED, sendErrorCode(ctx,
HandshakePacketTypes.AUTHENTICATION_REQUIRED + " [" + typeId + "] " + authRequireEvent.getAuthMessage()) HandshakePacketTypes.SERVER_ERROR_AUTHENTICATION_REQUIRED,
HandshakePacketTypes.AUTHENTICATION_REQUIRED + " [" + typeId
+ "] " + authRequireEvent.getAuthMessage())
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
EaglerXBungee.logger().info("[" + localAddrString + "]: Displaying authentication screen"); EaglerXBungee.logger().info(
"[" + localAddrString + "]: Displaying authentication screen");
return; return;
} else { } else {
if (authRequireEvent.getUseAuthType() == null) { if (authRequireEvent.getUseAuthType() == null) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, "IsAuthRequiredEvent was not fully handled") sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
"IsAuthRequiredEvent was not fully handled")
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
EaglerXBungee.logger().severe("[" + localAddrString + "]: Disconnecting, no authentication method provided by handler"); EaglerXBungee.logger().severe("[" + localAddrString
+ "]: Disconnecting, no authentication method provided by handler");
return; return;
} }
} }
@ -558,8 +594,10 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
String offlinePlayerStr = "OfflinePlayer:"; String offlinePlayerStr = "OfflinePlayer:";
byte[] uuidHashGenerator = new byte[offlinePlayerStr.length() + clientAuthUsername.length]; byte[] uuidHashGenerator = new byte[offlinePlayerStr.length() + clientAuthUsername.length];
System.arraycopy(offlinePlayerStr.getBytes(StandardCharsets.US_ASCII), 0, uuidHashGenerator, 0, offlinePlayerStr.length()); System.arraycopy(offlinePlayerStr.getBytes(StandardCharsets.US_ASCII), 0, uuidHashGenerator, 0,
System.arraycopy(clientAuthUsername, 0, uuidHashGenerator, offlinePlayerStr.length(), clientAuthUsername.length); offlinePlayerStr.length());
System.arraycopy(clientAuthUsername, 0, uuidHashGenerator, offlinePlayerStr.length(),
clientAuthUsername.length);
clientUUID = UUID.nameUUIDFromBytes(uuidHashGenerator); clientUUID = UUID.nameUUIDFromBytes(uuidHashGenerator);
strlen = buffer.readUnsignedByte(); strlen = buffer.readUnsignedByte();
@ -605,26 +643,34 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
try { try {
EaglercraftHandleAuthPasswordEvent handleEvent = new EaglercraftHandleAuthPasswordEvent( EaglercraftHandleAuthPasswordEvent handleEvent = new EaglercraftHandleAuthPasswordEvent(
conf, remoteAddress, authRequireEvent.getOriginHeader(), clientAuthUsername, conf, remoteAddress, authRequireEvent.getOriginHeader(), clientAuthUsername,
authRequireEvent.getSaltingData(), clientUsername, clientUUID, clientAuthPassword, authRequireEvent.getSaltingData(), clientUsername, clientUUID,
clientAuthPassword,
authRequireEvent.getUseAuthType(), authRequireEvent.getAuthMessage(), authRequireEvent.getUseAuthType(), authRequireEvent.getAuthMessage(),
(Object) authRequireEvent.getAuthAttachment(), clientRequestedServer.toString(), (Object) authRequireEvent.getAuthAttachment(),
clientRequestedServer.toString(),
(handleAuthEvent) -> { (handleAuthEvent) -> {
if(handleAuthEvent.getLoginAllowed() != EaglercraftHandleAuthPasswordEvent.AuthResponse.ALLOW) { if (handleAuthEvent
sendLoginDenied(ctx, handleAuthEvent.getLoginDeniedMessage()).addListener(ChannelFutureListener.CLOSE); .getLoginAllowed() != EaglercraftHandleAuthPasswordEvent.AuthResponse.ALLOW) {
sendLoginDenied(ctx, handleAuthEvent.getLoginDeniedMessage())
.addListener(ChannelFutureListener.CLOSE);
return; return;
} }
clientUsername = handleAuthEvent.getProfileUsername(); clientUsername = handleAuthEvent.getProfileUsername();
clientUUID = handleAuthEvent.getProfileUUID(); clientUUID = handleAuthEvent.getProfileUUID();
String texPropOverrideValue = handleAuthEvent.getApplyTexturesPropertyValue(); String texPropOverrideValue = handleAuthEvent
.getApplyTexturesPropertyValue();
if (texPropOverrideValue != null) { if (texPropOverrideValue != null) {
String texPropOverrideSig = handleAuthEvent.getApplyTexturesPropertySignature(); String texPropOverrideSig = handleAuthEvent
texturesOverrideProperty = new Property("textures", texPropOverrideValue, texPropOverrideSig); .getApplyTexturesPropertySignature();
texturesOverrideProperty = new Property("textures",
texPropOverrideValue, texPropOverrideSig);
} }
overrideEaglerToVanillaSkins = handleAuthEvent.isOverrideEaglerToVanillaSkins(); overrideEaglerToVanillaSkins = handleAuthEvent
.isOverrideEaglerToVanillaSkins();
continueThread.run(); continueThread.run();
}); });
@ -660,7 +706,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
if (clientLoginState == HandshakePacketTypes.STATE_CLIENT_LOGIN) { if (clientLoginState == HandshakePacketTypes.STATE_CLIENT_LOGIN) {
if (profileData.size() > 12) { if (profileData.size() > 12) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_EXCESSIVE_PROFILE_DATA, "Too many profile data packets recieved") sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_EXCESSIVE_PROFILE_DATA,
"Too many profile data packets recieved")
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
return; return;
} }
@ -678,7 +725,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
if (!profileData.containsKey(dataType)) { if (!profileData.containsKey(dataType)) {
profileData.put(dataType, readData); profileData.put(dataType, readData);
} else { } else {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_DUPLICATE_PROFILE_DATA, "Multiple profile data packets of the same type recieved") sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_DUPLICATE_PROFILE_DATA,
"Multiple profile data packets of the same type recieved")
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
return; return;
} }
@ -712,11 +760,12 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
} }
} catch (Throwable ex) { } catch (Throwable ex) {
if (ex instanceof EventException) { if (ex instanceof EventException) {
EaglerXBungee.logger().log(Level.SEVERE, "[" + localAddrString + "]: Hanshake packet " + op + " caught an exception", ex.getCause()); EaglerXBungee.logger().log(Level.SEVERE,
"[" + localAddrString + "]: Hanshake packet " + op + " caught an exception", ex.getCause());
} }
clientLoginState = HandshakePacketTypes.STATE_CLIENT_COMPLETE; clientLoginState = HandshakePacketTypes.STATE_CLIENT_COMPLETE;
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_INVALID_PACKET, op == -1 ? sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_INVALID_PACKET,
"Invalid Packet" : "Invalid Packet #" + op) op == -1 ? "Invalid Packet" : "Invalid Packet #" + op)
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
} }
} }
@ -742,7 +791,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
} }
if (i >= conf.getMaxPlayer()) { if (i >= conf.getMaxPlayer()) {
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, bungee.getTranslation("proxy_full")) sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
bungee.getTranslation("proxy_full"))
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
connectionClosed = true; connectionClosed = true;
return; return;
@ -796,7 +846,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
final BaseComponent[] reason = result.getCancelReasonComponents(); final BaseComponent[] reason = result.getCancelReasonComponents();
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
ComponentSerializer.toString(reason != null ? reason ComponentSerializer.toString(reason != null ? reason
: TextComponent.fromLegacyText(bungee.getTranslation("kick_message", new Object[0])))) : TextComponent
.fromLegacyText(bungee.getTranslation("kick_message", new Object[0]))))
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
return; return;
} }
@ -810,11 +861,14 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
@Override @Override
public void operationComplete(Future<Void> var1) throws Exception { public void operationComplete(Future<Void> var1) throws Exception {
EaglerConnectionInstance eaglerCon = ctx.channel().attr(EaglerPipeline.CONNECTION_INSTANCE).get(); EaglerConnectionInstance eaglerCon = ctx.channel().attr(EaglerPipeline.CONNECTION_INSTANCE)
.get();
EaglerXBungee.logger().info("[" + ctx.channel().remoteAddress() + "]: Logged in as '" + usernameStr + "'"); EaglerXBungee.logger()
.info("[" + ctx.channel().remoteAddress() + "]: Logged in as '" + usernameStr + "'");
final UserConnection userCon = eaglerCon.userConnection = new UserConnection(bungee, ch, usernameStr, initialHandler); final UserConnection userCon = eaglerCon.userConnection = new UserConnection(bungee, ch,
usernameStr, initialHandler);
userCon.setCompressionThreshold(-1); userCon.setCompressionThreshold(-1);
try { try {
if (!userCon.init()) { if (!userCon.init()) {
@ -842,21 +896,25 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
pp.replace(HttpWebSocketHandler.this, "HandlerBoss", handler); pp.replace(HttpWebSocketHandler.this, "HandlerBoss", handler);
pp.addBefore("HandlerBoss", "ReadTimeoutHandler", new ReadTimeoutHandler((BungeeCord.getInstance()).config.getTimeout(), TimeUnit.MILLISECONDS)); pp.addBefore("HandlerBoss", "ReadTimeoutHandler", new ReadTimeoutHandler(
(BungeeCord.getInstance()).config.getTimeout(), TimeUnit.MILLISECONDS));
pp.addBefore("HandlerBoss", "EaglerMinecraftDecoder", new EaglerMinecraftDecoder( pp.addBefore("HandlerBoss", "EaglerMinecraftDecoder", new EaglerMinecraftDecoder(
EaglerBungeeProtocol.GAME, false, gameProtocolVersion)); EaglerBungeeProtocol.GAME, false, gameProtocolVersion));
pp.addBefore("HandlerBoss", "EaglerMinecraftByteBufEncoder", new EaglerMinecraftByteBufEncoder()); pp.addBefore("HandlerBoss", "EaglerMinecraftByteBufEncoder",
new EaglerMinecraftByteBufEncoder());
pp.addBefore("HandlerBoss", "EaglerMinecraftWrappedEncoder", new EaglerMinecraftWrappedEncoder()); pp.addBefore("HandlerBoss", "EaglerMinecraftWrappedEncoder",
new EaglerMinecraftWrappedEncoder());
pp.addBefore("HandlerBoss", "EaglerMinecraftEncoder", new EaglerMinecraftEncoder( pp.addBefore("HandlerBoss", "EaglerMinecraftEncoder", new EaglerMinecraftEncoder(
EaglerBungeeProtocol.GAME, true, gameProtocolVersion)); EaglerBungeeProtocol.GAME, true, gameProtocolVersion));
boolean doRegisterSkins = true; boolean doRegisterSkins = true;
EaglercraftRegisterSkinEvent registerSkinEvent = new EaglercraftRegisterSkinEvent(usernameStr, clientUUID); EaglercraftRegisterSkinEvent registerSkinEvent = new EaglercraftRegisterSkinEvent(usernameStr,
clientUUID);
bungee.getPluginManager().callEvent(registerSkinEvent); bungee.getPluginManager().callEvent(registerSkinEvent);
@ -876,7 +934,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
} else { } else {
String customUrl = registerSkinEvent.getForceSetUseURL(); String customUrl = registerSkinEvent.getForceSetUseURL();
if (customUrl != null) { if (customUrl != null) {
EaglerXBungee.getEagler().getSkinService().registerTextureToPlayerAssociation(customUrl, initialHandler.getUniqueId()); EaglerXBungee.getEagler().getSkinService().registerTextureToPlayerAssociation(
customUrl, initialHandler.getUniqueId());
doRegisterSkins = false; doRegisterSkins = false;
overrideEaglerToVanillaSkins = false; overrideEaglerToVanillaSkins = false;
} }
@ -886,21 +945,23 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
EaglerBungeeConfig eaglerConf = EaglerXBungee.getEagler().getConfig(); EaglerBungeeConfig eaglerConf = EaglerXBungee.getEagler().getConfig();
if (texturesOverrideProperty != null) { if (texturesOverrideProperty != null) {
LoginResult oldProfile = initialHandler.getLoginProfile(); LoginResult oldProfile = initialHandler.getLoginProfile();
if (oldProfile == null) { if (oldProfile == null) {
oldProfile = new LoginResult(initialHandler.getUniqueId().toString(), initialHandler.getName(), null); oldProfile = new LoginResult(initialHandler.getUniqueId().toString(),
initialHandler.getName(), null);
initialHandler.setLoginProfile(oldProfile); initialHandler.setLoginProfile(oldProfile);
} }
oldProfile.setProperties(new Property[] { texturesOverrideProperty, EaglerBungeeConfig.isEaglerProperty }); oldProfile.setProperties(
new Property[] { texturesOverrideProperty, EaglerBungeeConfig.isEaglerProperty });
} else { } else {
if (!useExistingProp) { if (!useExistingProp) {
String vanillaSkin = eaglerConf.getEaglerPlayersVanillaSkin(); String vanillaSkin = eaglerConf.getEaglerPlayersVanillaSkin();
if (vanillaSkin != null) { if (vanillaSkin != null) {
LoginResult oldProfile = initialHandler.getLoginProfile(); LoginResult oldProfile = initialHandler.getLoginProfile();
if (oldProfile == null) { if (oldProfile == null) {
oldProfile = new LoginResult(initialHandler.getUniqueId().toString(), initialHandler.getName(), null); oldProfile = new LoginResult(initialHandler.getUniqueId().toString(),
initialHandler.getName(), null);
initialHandler.setLoginProfile(oldProfile); initialHandler.setLoginProfile(oldProfile);
} }
oldProfile.setProperties(eaglerConf.getEaglerPlayersVanillaSkinProperties()); oldProfile.setProperties(eaglerConf.getEaglerPlayersVanillaSkinProperties());
@ -916,14 +977,18 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
for (int i = 0; i < props.length; ++i) { for (int i = 0; i < props.length; ++i) {
if ("textures".equals(props[i].getName())) { if ("textures".equals(props[i].getName())) {
try { try {
String jsonStr = SkinPackets.bytesToAscii(Base64.decodeBase64(props[i].getValue())); String jsonStr = SkinPackets
.bytesToAscii(Base64.decodeBase64(props[i].getValue()));
JsonObject json = (new JsonParser()).parse(jsonStr).getAsJsonObject(); JsonObject json = (new JsonParser()).parse(jsonStr).getAsJsonObject();
JsonObject skinObj = json.getAsJsonObject("SKIN"); JsonObject skinObj = json.getAsJsonObject("SKIN");
if (skinObj != null) { if (skinObj != null) {
JsonElement url = json.get("url"); JsonElement url = json.get("url");
if (url != null) { if (url != null) {
String urlStr = SkinService.sanitizeTextureURL(url.getAsString()); String urlStr = SkinService
EaglerXBungee.getEagler().getSkinService().registerTextureToPlayerAssociation(urlStr, initialHandler.getUniqueId()); .sanitizeTextureURL(url.getAsString());
EaglerXBungee.getEagler().getSkinService()
.registerTextureToPlayerAssociation(urlStr,
initialHandler.getUniqueId());
} }
} }
doRegisterSkins = false; doRegisterSkins = false;
@ -942,11 +1007,14 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
SkinPackets.registerEaglerPlayer(clientUUID, profileData.get("skin_v1"), SkinPackets.registerEaglerPlayer(clientUUID, profileData.get("skin_v1"),
EaglerXBungee.getEagler().getSkinService()); EaglerXBungee.getEagler().getSkinService());
} catch (Throwable ex) { } catch (Throwable ex) {
SkinPackets.registerEaglerPlayerFallback(clientUUID, EaglerXBungee.getEagler().getSkinService()); SkinPackets.registerEaglerPlayerFallback(clientUUID,
EaglerXBungee.logger().info("[" + ctx.channel().remoteAddress() + "]: Invalid skin packet: " + ex.toString()); EaglerXBungee.getEagler().getSkinService());
EaglerXBungee.logger().info("[" + ctx.channel().remoteAddress()
+ "]: Invalid skin packet: " + ex.toString());
} }
} else { } else {
SkinPackets.registerEaglerPlayerFallback(clientUUID, EaglerXBungee.getEagler().getSkinService()); SkinPackets.registerEaglerPlayerFallback(clientUUID,
EaglerXBungee.getEagler().getSkinService());
} }
} }
@ -955,11 +1023,14 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
CapePackets.registerEaglerPlayer(clientUUID, profileData.get("cape_v1"), CapePackets.registerEaglerPlayer(clientUUID, profileData.get("cape_v1"),
EaglerXBungee.getEagler().getCapeService()); EaglerXBungee.getEagler().getCapeService());
} catch (Throwable ex) { } catch (Throwable ex) {
CapePackets.registerEaglerPlayerFallback(clientUUID, EaglerXBungee.getEagler().getCapeService()); CapePackets.registerEaglerPlayerFallback(clientUUID,
EaglerXBungee.logger().info("[" + ctx.channel().remoteAddress() + "]: Invalid cape packet: " + ex.toString()); EaglerXBungee.getEagler().getCapeService());
EaglerXBungee.logger().info("[" + ctx.channel().remoteAddress()
+ "]: Invalid cape packet: " + ex.toString());
} }
} else { } else {
CapePackets.registerEaglerPlayerFallback(clientUUID, EaglerXBungee.getEagler().getCapeService()); CapePackets.registerEaglerPlayerFallback(clientUUID,
EaglerXBungee.getEagler().getCapeService());
} }
if (conf.getEnableVoiceChat()) { if (conf.getEnableVoiceChat()) {
@ -994,7 +1065,9 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
bungee.getPluginManager().callEvent(login); bungee.getPluginManager().callEvent(login);
complete.done(login, null); complete.done(login, null);
} catch (NoSuchMethodError err) { } catch (NoSuchMethodError err) {
bungee.getPluginManager().callEvent(PostLoginEvent.class.getDeclaredConstructor(ProxiedPlayer.class, ServerInfo.class, Callback.class).newInstance(userCon, server, complete)); bungee.getPluginManager().callEvent(PostLoginEvent.class
.getDeclaredConstructor(ProxiedPlayer.class, ServerInfo.class, Callback.class)
.newInstance(userCon, server, complete));
} }
} }
@ -1007,7 +1080,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
final BaseComponent[] reason = var1.getCancelReasonComponents(); final BaseComponent[] reason = var1.getCancelReasonComponents();
sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE, sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE,
ComponentSerializer.toString(reason != null ? reason ComponentSerializer.toString(reason != null ? reason
: TextComponent.fromLegacyText(bungee.getTranslation("kick_message", new Object[0])))) : TextComponent
.fromLegacyText(bungee.getTranslation("kick_message", new Object[0]))))
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
} else { } else {
bungee.getPluginManager().callEvent(new LoginEvent(initialHandler, complete)); bungee.getPluginManager().callEvent(new LoginEvent(initialHandler, complete));
@ -1027,7 +1101,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
if (connectionClosed) { if (connectionClosed) {
return; return;
} }
if(!hasFirstPacket && (conf.isAllowMOTD() || conf.isAllowQuery()) && (str = str.toLowerCase()).startsWith("accept:")) { if (!hasFirstPacket && (conf.isAllowMOTD() || conf.isAllowQuery())
&& (str = str.toLowerCase()).startsWith("accept:")) {
str = str.substring(7).trim(); str = str.substring(7).trim();
hasFirstPacket = true; hasFirstPacket = true;
hasBinaryConnection = false; hasBinaryConnection = false;
@ -1068,7 +1143,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
if (queryRateLimit != RateLimitStatus.OK) { if (queryRateLimit != RateLimitStatus.OK) {
final RateLimitStatus rateLimitTypeFinal = queryRateLimit; final RateLimitStatus rateLimitTypeFinal = queryRateLimit;
ctx.writeAndFlush(new TextWebSocketFrame( ctx.writeAndFlush(new TextWebSocketFrame(
rateLimitTypeFinal == RateLimitStatus.LIMITED_NOW_LOCKED_OUT ? "{\"type\":\"locked\"}" : "{\"type\":\"blocked\"}")) rateLimitTypeFinal == RateLimitStatus.LIMITED_NOW_LOCKED_OUT ? "{\"type\":\"locked\"}"
: "{\"type\":\"blocked\"}"))
.addListener(ChannelFutureListener.CLOSE); .addListener(ChannelFutureListener.CLOSE);
connectionClosed = true; connectionClosed = true;
return; return;
@ -1084,7 +1160,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
} }
if (handler != null) { if (handler != null) {
ctx.pipeline().replace(HttpWebSocketHandler.this, "HttpServerQueryHandler", handler); ctx.pipeline().replace(HttpWebSocketHandler.this, "HttpServerQueryHandler", handler);
ctx.pipeline().addBefore("HttpServerQueryHandler", "WriteTimeoutHandler", new WriteTimeoutHandler(5l, TimeUnit.SECONDS)); ctx.pipeline().addBefore("HttpServerQueryHandler", "WriteTimeoutHandler",
new WriteTimeoutHandler(5l, TimeUnit.SECONDS));
handler.beginHandleQuery(conf, ctx, str); handler.beginHandleQuery(conf, ctx, str);
if (handler instanceof MOTDQueryHandler) { if (handler instanceof MOTDQueryHandler) {
EaglercraftMOTDEvent evt = new EaglercraftMOTDEvent((MOTDQueryHandler) handler); EaglercraftMOTDEvent evt = new EaglercraftMOTDEvent((MOTDQueryHandler) handler);
@ -1142,7 +1219,8 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
} }
private ChannelFuture sendErrorWrong(ChannelHandlerContext ctx, int op, String state) { private ChannelFuture sendErrorWrong(ChannelHandlerContext ctx, int op, String state) {
return sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_WRONG_PACKET, "Wrong Packet #" + op + " in state '" + state + "'"); return sendErrorCode(ctx, HandshakePacketTypes.SERVER_ERROR_WRONG_PACKET,
"Wrong Packet #" + op + " in state '" + state + "'");
} }
private ChannelFuture sendErrorCode(ChannelHandlerContext ctx, int code, String str) { private ChannelFuture sendErrorCode(ChannelHandlerContext ctx, int code, String str) {

View File

@ -24,44 +24,45 @@ public enum EaglerBungeeProtocol {
HANDSHAKE { HANDSHAKE {
{ {
TO_SERVER.registerPacket(Handshake.class, Handshake::new, map(ProtocolConstants.MINECRAFT_1_8, 0x00)); TO_SERVER.registerPacket(Handshake.class, Handshake::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x00));
} }
}, },
// 0 // 0
GAME { GAME {
{ {
TO_CLIENT.registerPacket(KeepAlive.class, KeepAlive::new, map(ProtocolConstants.MINECRAFT_1_8, 0x00)); TO_CLIENT.registerPacket(KeepAlive.class, KeepAlive::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x1F));
TO_CLIENT.registerPacket(Login.class, Login::new, map(ProtocolConstants.MINECRAFT_1_8, 0x01)); TO_CLIENT.registerPacket(Login.class, Login::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x23));
TO_CLIENT.registerPacket(Chat.class, Chat::new, map(ProtocolConstants.MINECRAFT_1_8, 0x02)); TO_CLIENT.registerPacket(Chat.class, Chat::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x0F));
TO_CLIENT.registerPacket(Respawn.class, Respawn::new, map(ProtocolConstants.MINECRAFT_1_8, 0x07)); TO_CLIENT.registerPacket(Respawn.class, Respawn::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x33));
TO_CLIENT.registerPacket(PlayerListItem.class, // PlayerInfo TO_CLIENT.registerPacket(PlayerListItem.class, // PlayerInfo
PlayerListItem::new, map(ProtocolConstants.MINECRAFT_1_8, 0x38)); PlayerListItem::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x2D));
TO_CLIENT.registerPacket(TabCompleteResponse.class, TabCompleteResponse::new, TO_CLIENT.registerPacket(TabCompleteResponse.class, TabCompleteResponse::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x3A)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x0E));
TO_CLIENT.registerPacket(ScoreboardObjective.class, ScoreboardObjective::new, TO_CLIENT.registerPacket(ScoreboardObjective.class, ScoreboardObjective::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x3B)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x3F));
TO_CLIENT.registerPacket(ScoreboardScore.class, ScoreboardScore::new, TO_CLIENT.registerPacket(ScoreboardScore.class, ScoreboardScore::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x3C)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x42));
TO_CLIENT.registerPacket(ScoreboardDisplay.class, ScoreboardDisplay::new, TO_CLIENT.registerPacket(ScoreboardDisplay.class, ScoreboardDisplay::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x3D)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x38));
TO_CLIENT.registerPacket(Team.class, Team::new, map(ProtocolConstants.MINECRAFT_1_8, 0x3E)); TO_CLIENT.registerPacket(Team.class, Team::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x41));
TO_CLIENT.registerPacket(PluginMessage.class, PluginMessage::new, TO_CLIENT.registerPacket(PluginMessage.class, PluginMessage::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x3F)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x18));
TO_CLIENT.registerPacket(Kick.class, Kick::new, map(ProtocolConstants.MINECRAFT_1_8, 0x40)); TO_CLIENT.registerPacket(Kick.class, Kick::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x1A));
TO_CLIENT.registerPacket(Title.class, Title::new, map(ProtocolConstants.MINECRAFT_1_8, 0x45)); TO_CLIENT.registerPacket(Title.class, Title::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x45));
TO_CLIENT.registerPacket(PlayerListHeaderFooter.class, PlayerListHeaderFooter::new, TO_CLIENT.registerPacket(PlayerListHeaderFooter.class, PlayerListHeaderFooter::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x47)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x47));
TO_CLIENT.registerPacket(EntityStatus.class, EntityStatus::new, map(ProtocolConstants.MINECRAFT_1_8, 0x1A)); TO_CLIENT.registerPacket(EntityStatus.class, EntityStatus::new,
map(ProtocolConstants.MINECRAFT_1_9_4, 0x1B));
TO_SERVER.registerPacket(KeepAlive.class, KeepAlive::new, map(ProtocolConstants.MINECRAFT_1_8, 0x00)); TO_SERVER.registerPacket(KeepAlive.class, KeepAlive::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x0B));
TO_SERVER.registerPacket(Chat.class, Chat::new, map(ProtocolConstants.MINECRAFT_1_8, 0x01)); TO_SERVER.registerPacket(Chat.class, Chat::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x02));
TO_SERVER.registerPacket(TabCompleteRequest.class, TabCompleteRequest::new, TO_SERVER.registerPacket(TabCompleteRequest.class, TabCompleteRequest::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x14)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x01));
TO_SERVER.registerPacket(ClientSettings.class, ClientSettings::new, TO_SERVER.registerPacket(ClientSettings.class, ClientSettings::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x15)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x04));
TO_SERVER.registerPacket(PluginMessage.class, PluginMessage::new, TO_SERVER.registerPacket(PluginMessage.class, PluginMessage::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x17)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x09));
} }
}, },
// 1 // 1
@ -69,28 +70,30 @@ public enum EaglerBungeeProtocol {
{ {
TO_CLIENT.registerPacket(StatusResponse.class, StatusResponse::new, TO_CLIENT.registerPacket(StatusResponse.class, StatusResponse::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x00)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x00));
TO_CLIENT.registerPacket(PingPacket.class, PingPacket::new, map(ProtocolConstants.MINECRAFT_1_8, 0x01)); TO_CLIENT.registerPacket(PingPacket.class, PingPacket::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x01));
TO_SERVER.registerPacket(StatusRequest.class, StatusRequest::new, TO_SERVER.registerPacket(StatusRequest.class, StatusRequest::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x00)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x00));
TO_SERVER.registerPacket(PingPacket.class, PingPacket::new, map(ProtocolConstants.MINECRAFT_1_8, 0x01)); TO_SERVER.registerPacket(PingPacket.class, PingPacket::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x01));
} }
}, },
// 2 // 2
LOGIN { LOGIN {
{ {
TO_CLIENT.registerPacket(Kick.class, Kick::new, map(ProtocolConstants.MINECRAFT_1_8, 0x00)); TO_CLIENT.registerPacket(Kick.class, Kick::new, map(ProtocolConstants.MINECRAFT_1_9_4, 0x00));
TO_CLIENT.registerPacket(EncryptionRequest.class, EncryptionRequest::new, TO_CLIENT.registerPacket(EncryptionRequest.class, EncryptionRequest::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x01)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x01));
TO_CLIENT.registerPacket(LoginSuccess.class, LoginSuccess::new, map(ProtocolConstants.MINECRAFT_1_8, 0x02)); TO_CLIENT.registerPacket(LoginSuccess.class, LoginSuccess::new,
map(ProtocolConstants.MINECRAFT_1_9_4, 0x02));
TO_CLIENT.registerPacket(SetCompression.class, SetCompression::new, TO_CLIENT.registerPacket(SetCompression.class, SetCompression::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x03)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x03));
TO_SERVER.registerPacket(LoginRequest.class, LoginRequest::new, map(ProtocolConstants.MINECRAFT_1_8, 0x00)); TO_SERVER.registerPacket(LoginRequest.class, LoginRequest::new,
map(ProtocolConstants.MINECRAFT_1_9_4, 0x00));
TO_SERVER.registerPacket(EncryptionResponse.class, EncryptionResponse::new, TO_SERVER.registerPacket(EncryptionResponse.class, EncryptionResponse::new,
map(ProtocolConstants.MINECRAFT_1_8, 0x01)); map(ProtocolConstants.MINECRAFT_1_9_4, 0x01));
} }
}, },
// 3 // 3

View File

@ -38,10 +38,10 @@ public class VersionQueryHandler extends EaglerQuerySimpleHandler {
handshakeVersions.add(3); handshakeVersions.add(3);
responseObj.add("handshakeVersions", handshakeVersions); responseObj.add("handshakeVersions", handshakeVersions);
JsonArray protocolVersions = new JsonArray(); JsonArray protocolVersions = new JsonArray();
protocolVersions.add(47); protocolVersions.add(110);
responseObj.add("protocolVersions", protocolVersions); responseObj.add("protocolVersions", protocolVersions);
JsonArray gameVersions = new JsonArray(); JsonArray gameVersions = new JsonArray();
gameVersions.add("1.8"); gameVersions.add("1.9.4");
responseObj.add("gameVersions", gameVersions); responseObj.add("gameVersions", gameVersions);
JsonObject proxyInfo = new JsonObject(); JsonObject proxyInfo = new JsonObject();
proxyInfo.addProperty("brand", ProxyServer.getInstance().getName()); proxyInfo.addProperty("brand", ProxyServer.getInstance().getName());