(1.2.3) Fixed various handshake issues with EaglerXBungee

This commit is contained in:
lax1dude 2024-05-29 23:47:37 -07:00
parent 322e653ca9
commit b5fd4cc2aa
4 changed files with 9 additions and 11 deletions

View File

@ -136,6 +136,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
}else if(msg instanceof PingWebSocketFrame) { }else if(msg instanceof PingWebSocketFrame) {
ctx.writeAndFlush(new PongWebSocketFrame()); ctx.writeAndFlush(new PongWebSocketFrame());
}else if(msg instanceof CloseWebSocketFrame) { }else if(msg instanceof CloseWebSocketFrame) {
connectionClosed = true;
ctx.close(); ctx.close();
} }
}else { }else {
@ -171,7 +172,6 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
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;
return; return;
} }
@ -186,7 +186,6 @@ 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;
return; return;
} }
} }
@ -225,7 +224,6 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
? HandshakePacketTypes.SERVER_ERROR_RATELIMIT_LOCKED ? HandshakePacketTypes.SERVER_ERROR_RATELIMIT_LOCKED
: HandshakePacketTypes.SERVER_ERROR_RATELIMIT_BLOCKED, : HandshakePacketTypes.SERVER_ERROR_RATELIMIT_BLOCKED,
"Too many logins!").addListener(ChannelFutureListener.CLOSE); "Too many logins!").addListener(ChannelFutureListener.CLOSE);
connectionClosed = true;
return; return;
} }
@ -266,6 +264,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
return; return;
}else if(buffer.readUnsignedByte() != minecraftProtocolVersion) { }else if(buffer.readUnsignedByte() != minecraftProtocolVersion) {
clientLoginState = HandshakePacketTypes.STATE_CLIENT_COMPLETE; clientLoginState = HandshakePacketTypes.STATE_CLIENT_COMPLETE;
connectionClosed = true;
ByteBuf buf = Unpooled.buffer(); ByteBuf buf = Unpooled.buffer();
buf.writeByte(HandshakePacketTypes.PROTOCOL_VERSION_MISMATCH); buf.writeByte(HandshakePacketTypes.PROTOCOL_VERSION_MISMATCH);
buf.writeByte(1); buf.writeByte(1);
@ -339,6 +338,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
if(versMisMatch) { if(versMisMatch) {
clientLoginState = HandshakePacketTypes.STATE_CLIENT_COMPLETE; clientLoginState = HandshakePacketTypes.STATE_CLIENT_COMPLETE;
connectionClosed = true;
ByteBuf buf = Unpooled.buffer(); ByteBuf buf = Unpooled.buffer();
buf.writeByte(HandshakePacketTypes.PROTOCOL_VERSION_MISMATCH); buf.writeByte(HandshakePacketTypes.PROTOCOL_VERSION_MISMATCH);
@ -732,7 +732,6 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
if (limit > 0 && bungee.getOnlineCount() >= limit) { if (limit > 0 && bungee.getOnlineCount() >= limit) {
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;
return; return;
} }
@ -747,7 +746,6 @@ 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;
return; return;
} }
} }
@ -773,7 +771,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
if(!blockUpdate && !updateconf.isDiscardLoginPacketCerts()) { if(!blockUpdate && !updateconf.isDiscardLoginPacketCerts()) {
byte[] b = profileData.get("update_cert_v1"); byte[] b = profileData.get("update_cert_v1");
if(b != null && b.length < 32759) { if(b != null && b.length < 32759) {
EaglerUpdateSvc.sendCertificateToPlayers(EaglerUpdateSvc.tryMakeHolder(b)); EaglerUpdateSvc.sendCertificateToPlayers(cert = EaglerUpdateSvc.tryMakeHolder(b));
} }
} }
final EaglerInitialHandler initialHandler = new EaglerInitialHandler(bungee, conf, ch, gameProtocolVersion, final EaglerInitialHandler initialHandler = new EaglerInitialHandler(bungee, conf, ch, gameProtocolVersion,
@ -1045,9 +1043,9 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
hasBinaryConnection = false; hasBinaryConnection = false;
if(CommandConfirmCode.confirmHash != null && str.equalsIgnoreCase(CommandConfirmCode.confirmHash)) { if(CommandConfirmCode.confirmHash != null && str.equalsIgnoreCase(CommandConfirmCode.confirmHash)) {
connectionClosed = true;
ctx.writeAndFlush(new TextWebSocketFrame("OK")).addListener(ChannelFutureListener.CLOSE); ctx.writeAndFlush(new TextWebSocketFrame("OK")).addListener(ChannelFutureListener.CLOSE);
CommandConfirmCode.confirmHash = null; CommandConfirmCode.confirmHash = null;
connectionClosed = true;
return; return;
} }
@ -1072,17 +1070,17 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
} }
if(queryRateLimit == RateLimitStatus.LOCKED_OUT) { if(queryRateLimit == RateLimitStatus.LOCKED_OUT) {
ctx.close();
connectionClosed = true; connectionClosed = true;
ctx.close();
return; return;
} }
if(queryRateLimit != RateLimitStatus.OK) { if(queryRateLimit != RateLimitStatus.OK) {
connectionClosed = true;
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;
return; return;
} }

View File

@ -1,5 +1,5 @@
name: EaglercraftXBungee name: EaglercraftXBungee
main: net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee main: net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee
version: 1.2.2 version: 1.2.3
description: Plugin to allow EaglercraftX 1.8 players to join your network, or allow EaglercraftX 1.8 players to use your network as a proxy to join other networks description: Plugin to allow EaglercraftX 1.8 players to join your network, or allow EaglercraftX 1.8 players to use your network as a proxy to join other networks
author: lax1dude author: lax1dude

View File

@ -1 +1 @@
1.2.2 1.2.3