(1.2.4) Fixed UnsupportedOperationException in EaglerXBungee
This commit is contained in:
parent
e58e9bcb5d
commit
8ffd102664
Binary file not shown.
|
@ -108,29 +108,42 @@ public class EaglerMinecraftDecoder extends MessageToMessageDecoder<WebSocketFra
|
|||
}
|
||||
|
||||
private PacketWrapper wrapPacket(DefinedPacket packet, ByteBuf buf, Protocol protocol) {
|
||||
PacketWrapper pkt;
|
||||
if (packetWrapperConstructor != null) {
|
||||
try {
|
||||
pkt = packetWrapperConstructor.newInstance(packet, buf);
|
||||
buf.retain();
|
||||
return pkt;
|
||||
} catch (IllegalAccessException | InvocationTargetException | InstantiationException var14) {
|
||||
throw new RuntimeException(var14);
|
||||
}
|
||||
boolean isInputDirect = buf.isDirect();
|
||||
if(!isInputDirect) {
|
||||
int len = buf.readableBytes();
|
||||
ByteBuf newBuf = buf.alloc().directBuffer(len, len);
|
||||
buf.readBytes(newBuf, len);
|
||||
buf = newBuf;
|
||||
}
|
||||
|
||||
try {
|
||||
pkt = new PacketWrapper(packet, buf, protocol);
|
||||
buf.retain();
|
||||
return pkt;
|
||||
} catch (NoSuchMethodError var15) {
|
||||
PacketWrapper pkt;
|
||||
if (packetWrapperConstructor != null) {
|
||||
try {
|
||||
pkt = packetWrapperConstructor.newInstance(packet, buf);
|
||||
buf.retain();
|
||||
return pkt;
|
||||
} catch (IllegalAccessException | InvocationTargetException | InstantiationException var14) {
|
||||
throw new RuntimeException(var14);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
packetWrapperConstructor = PacketWrapper.class.getDeclaredConstructor(DefinedPacket.class, ByteBuf.class);
|
||||
pkt = packetWrapperConstructor.newInstance(packet, buf);
|
||||
pkt = new PacketWrapper(packet, buf, protocol);
|
||||
buf.retain();
|
||||
return pkt;
|
||||
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | InstantiationException var13) {
|
||||
throw new RuntimeException(var13);
|
||||
} catch (NoSuchMethodError var15) {
|
||||
try {
|
||||
packetWrapperConstructor = PacketWrapper.class.getDeclaredConstructor(DefinedPacket.class, ByteBuf.class);
|
||||
pkt = packetWrapperConstructor.newInstance(packet, buf);
|
||||
buf.retain();
|
||||
return pkt;
|
||||
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | InstantiationException var13) {
|
||||
throw new RuntimeException(var13);
|
||||
}
|
||||
}
|
||||
}finally {
|
||||
if(!isInputDirect) {
|
||||
buf.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class EaglerUpdateSvc {
|
|||
|
||||
private static final List<ClientCertificateHolder> certs = new ArrayList();
|
||||
private static final Map<String,CachedClientCertificate> certsCache = new HashMap();
|
||||
private static final Set<String> deadURLS = new HashSet();
|
||||
|
||||
private static class CachedClientCertificate {
|
||||
private final ClientCertificateHolder cert;
|
||||
|
@ -110,6 +111,8 @@ public class EaglerUpdateSvc {
|
|||
if(code / 100 != 2) {
|
||||
con.disconnect();
|
||||
throw new IOException("Response code was " + code);
|
||||
}else {
|
||||
deadURLS.remove(str);
|
||||
}
|
||||
ByteArrayOutputStream bao = new ByteArrayOutputStream(32767);
|
||||
try(InputStream is = con.getInputStream()) {
|
||||
|
@ -140,8 +143,10 @@ public class EaglerUpdateSvc {
|
|||
}
|
||||
log.info("Downloading new certificate: " + str);
|
||||
}catch(Throwable t) {
|
||||
log.severe("Failed to download certificate: " + str);
|
||||
log.severe("Reason: " + t.toString());
|
||||
if(deadURLS.add(str)) {
|
||||
log.severe("Failed to download certificate: " + str);
|
||||
log.severe("Reason: " + t.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
long millis = System.currentTimeMillis();
|
||||
|
|
|
@ -815,7 +815,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
|
|||
|
||||
EaglerXBungee.logger().info("[" + ctx.channel().remoteAddress() + "]: Logged in as '" + usernameStr + "'");
|
||||
|
||||
final UserConnection userCon = eaglerCon.userConnection = new UserConnection(bungee, ch, usernameStr, initialHandler);
|
||||
final UserConnection userCon = new UserConnection(bungee, ch, usernameStr, initialHandler);
|
||||
userCon.setCompressionThreshold(-1);
|
||||
try {
|
||||
if (!userCon.init()) {
|
||||
|
@ -991,6 +991,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
|
|||
Callback<PostLoginEvent> complete = new Callback<PostLoginEvent>() {
|
||||
@Override
|
||||
public void done(PostLoginEvent result, Throwable error) {
|
||||
eaglerCon.userConnection = userCon;
|
||||
eaglerCon.hasBeenForwarded = true;
|
||||
if (ch.isClosed()) {
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: EaglercraftXBungee
|
||||
main: net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee
|
||||
version: 1.2.3
|
||||
version: 1.2.4
|
||||
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
|
|
@ -1 +1 @@
|
|||
1.2.3
|
||||
1.2.4
|
Loading…
Reference in New Issue
Block a user