(1.0.9) Updated plugin to latest version

This commit is contained in:
lax1dude 2023-12-10 19:32:24 -08:00
parent ed95ff8bf7
commit 96d6485bb1
10 changed files with 211 additions and 8 deletions

View File

@ -28,10 +28,12 @@ import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.handlers.EaglerPa
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.handlers.EaglerPluginEventListener;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.EaglerPipeline;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.web.HttpWebServer;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.shit.CompatWarning;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.skins.BinaryHttpClient;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.skins.ISkinService;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.skins.SkinService;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.skins.SkinServiceOffline;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.plugin.PluginManager;
import net.md_5.bungee.netty.PipelineUtils;
@ -51,6 +53,14 @@ import net.md_5.bungee.BungeeCord;
*
*/
public class EaglerXBungee extends Plugin {
public static final String NATIVE_BUNGEECORD_BUILD = "1.20-R0.2-SNAPSHOT:231024b:1777";
public static final String NATIVE_WATERFALL_BUILD = "1.20-R0.2-SNAPSHOT:d85fe36:556";
public static final String NATIVE_FLAMECORD_BUILD = "1.1.1";
static {
CompatWarning.displayCompatWarning();
}
private static EaglerXBungee instance = null;
private EaglerBungeeConfig conf = null;

View File

@ -3,6 +3,7 @@ package net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server;
import io.netty.channel.ChannelHandlerContext;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.bungeeprotocol.EaglerBungeeProtocol;
import net.md_5.bungee.netty.ChannelWrapper;
import net.md_5.bungee.protocol.Protocol;
/**
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
@ -32,6 +33,22 @@ public class EaglerChannelWrapper extends ChannelWrapper {
getHandle().pipeline().get(EaglerMinecraftEncoder.class).setProtocolVersion(protocol);
getHandle().pipeline().get(EaglerMinecraftDecoder.class).setProtocolVersion(protocol);
}
public Protocol getEncodeProtocol() {
EaglerBungeeProtocol eaglerProtocol = this.getHandle().pipeline().get(EaglerMinecraftEncoder.class).getProtocol();
switch(eaglerProtocol) {
case GAME:
return Protocol.GAME;
case HANDSHAKE:
return Protocol.HANDSHAKE;
case LOGIN:
return Protocol.LOGIN;
case STATUS:
return Protocol.STATUS;
default:
return null;
}
}
public void close(Object o) {
super.close(o);

View File

@ -1,5 +1,7 @@
package net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import io.netty.buffer.ByteBuf;
@ -14,6 +16,7 @@ import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.bungeeprot
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.bungeeprotocol.EaglerProtocolAccessProxy;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.PacketWrapper;
import net.md_5.bungee.protocol.Protocol;
import net.md_5.bungee.protocol.ProtocolConstants.Direction;
/**
@ -33,6 +36,7 @@ public class EaglerMinecraftDecoder extends MessageToMessageDecoder<WebSocketFra
private EaglerBungeeProtocol protocol;
private final boolean server;
private int protocolVersion;
private static Constructor<PacketWrapper> packetWrapperConstructor = null;
@Override
protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, List<Object> out) throws Exception {
@ -46,16 +50,30 @@ public class EaglerMinecraftDecoder extends MessageToMessageDecoder<WebSocketFra
ByteBuf buf = in.content();
int pktId = DefinedPacket.readVarInt(buf);
DefinedPacket pkt = EaglerProtocolAccessProxy.createPacket(protocol, protocolVersion, pktId, server);
Protocol bungeeProtocol = null;
switch(this.protocol) {
case GAME:
bungeeProtocol = Protocol.GAME;
break;
case HANDSHAKE:
bungeeProtocol = Protocol.HANDSHAKE;
break;
case LOGIN:
bungeeProtocol = Protocol.LOGIN;
break;
case STATUS:
bungeeProtocol = Protocol.STATUS;
}
if(pkt != null) {
pkt.read(buf, server ? Direction.TO_CLIENT : Direction.TO_SERVER, protocolVersion);
if(buf.isReadable()) {
EaglerXBungee.logger().severe("[DECODER][" + ctx.channel().remoteAddress() + "] Packet " +
pkt.getClass().getSimpleName() + " had extra bytes! (" + buf.readableBytes() + ")");
}else {
out.add(new PacketWrapper(pkt, buf.copy(0, buf.writerIndex())));
out.add(this.wrapPacket(pkt, buf, bungeeProtocol));
}
}else {
out.add(new PacketWrapper(null, buf.copy(0, buf.writerIndex())));
out.add(this.wrapPacket(null, buf, bungeeProtocol));
}
}else if(frame instanceof PingWebSocketFrame) {
if(millis - con.lastClientPingPacket > 500l) {
@ -82,5 +100,47 @@ public class EaglerMinecraftDecoder extends MessageToMessageDecoder<WebSocketFra
public void setProtocolVersion(final int protocolVersion) {
this.protocolVersion = protocolVersion;
}
private PacketWrapper wrapPacket(DefinedPacket packet, ByteBuf buf, Protocol protocol) {
ByteBuf cbuf = null;
PacketWrapper var7;
try {
cbuf = buf.copy(0, buf.writerIndex());
PacketWrapper pkt;
if (packetWrapperConstructor != null) {
try {
pkt = packetWrapperConstructor.newInstance(packet, cbuf);
cbuf = null;
return pkt;
} catch (IllegalAccessException | InvocationTargetException | InstantiationException var14) {
throw new RuntimeException(var14);
}
}
try {
pkt = new PacketWrapper(packet, cbuf, protocol);
cbuf = null;
return pkt;
} catch (NoSuchMethodError var15) {
try {
packetWrapperConstructor = PacketWrapper.class.getDeclaredConstructor(DefinedPacket.class, ByteBuf.class);
pkt = packetWrapperConstructor.newInstance(packet, cbuf);
cbuf = null;
var7 = pkt;
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | InstantiationException var13) {
throw new RuntimeException(var13);
}
}
} finally {
if (cbuf != null) {
cbuf.release();
}
}
return var7;
}
}

View File

@ -36,7 +36,12 @@ public class EaglerMinecraftEncoder extends MessageToMessageEncoder<DefinedPacke
ByteBuf buf = Unpooled.buffer();
int pk = EaglerProtocolAccessProxy.getPacketId(protocol, protocolVersion, msg, server);
DefinedPacket.writeVarInt(pk, buf);
msg.write(buf, server ? Direction.TO_CLIENT : Direction.TO_SERVER, protocolVersion);
try {
msg.write(buf, server ? Direction.TO_CLIENT : Direction.TO_SERVER, protocolVersion);
} catch (Exception e) {
buf.release();
buf = Unpooled.EMPTY_BUFFER;
}
out.add(new BinaryWebSocketFrame(buf));
}
@ -53,5 +58,9 @@ public class EaglerMinecraftEncoder extends MessageToMessageEncoder<DefinedPacke
public void setProtocolVersion(final int protocolVersion) {
this.protocolVersion = protocolVersion;
}
public EaglerBungeeProtocol getProtocol() {
return this.protocol;
}
}

View File

@ -787,7 +787,15 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
final UserConnection userCon = eaglerCon.userConnection = new UserConnection(bungee, ch, usernameStr, initialHandler);
userCon.setCompressionThreshold(-1);
userCon.init();
try {
if (!userCon.init()) {
userCon.disconnect(bungee.getTranslation("already_connected_proxy"));
EaglerPipeline.closeChannel(ctx.channel());
return;
}
} catch (NoSuchMethodError e) {
UserConnection.class.getDeclaredMethod("init").invoke(userCon);
}
ChannelPipeline pp = ctx.channel().pipeline();

View File

@ -0,0 +1,60 @@
package net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.shit;
import java.util.logging.Logger;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee;
import net.md_5.bungee.api.ProxyServer;
/**
* Copyright (c) 2023 LAX1DUDE. All Rights Reserved.
*
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
*
* NOT FOR COMMERCIAL OR MALICIOUS USE
*
* (please read the 'LICENSE' file this repo's root directory for more info)
*
*/
public class CompatWarning {
public static void displayCompatWarning() {
String stfu = System.getProperty("eaglerxbungee.stfu");
if("true".equalsIgnoreCase(stfu)) {
return;
}
String[] compatWarnings = new String[] {
":>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>",
":> ",
":> EAGLERCRAFTXBUNGEE WARNING:",
":> ",
":> This plugin wasn\'t tested to be \'working\'",
":> with ANY version of BungeeCord (and forks)",
":> apart from the versions listed below:",
":> ",
":> - BungeeCord: " + EaglerXBungee.NATIVE_BUNGEECORD_BUILD,
":> - Waterfall: " + EaglerXBungee.NATIVE_WATERFALL_BUILD,
":> - FlameCord: " + EaglerXBungee.NATIVE_FLAMECORD_BUILD,
":> ",
":> This is not a Bukkit/Spigot plugin!",
":> ",
":> Use \"-Deaglerxbungee.stfu=true\" to hide",
":> ",
":>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>:>"
};
try {
Logger fuck = ProxyServer.getInstance().getLogger();
for(int i = 0; i < compatWarnings.length; ++i) {
fuck.warning(compatWarnings[i]);
}
}catch(Throwable t) {
for(int i = 0; i < compatWarnings.length; ++i) {
System.err.println(compatWarnings[i]);
}
}
}
}

View File

@ -0,0 +1,39 @@
package net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.shit;
import java.awt.GraphicsEnvironment;
import javax.swing.JOptionPane;
/**
* Copyright (c) 2023 LAX1DUDE. All Rights Reserved.
*
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
*
* NOT FOR COMMERCIAL OR MALICIOUS USE
*
* (please read the 'LICENSE' file this repo's root directory for more info)
*
*/
public class MainClass {
public static void main(String[] args) {
System.err.println();
System.err.println("ERROR: The EaglerXBungee 1.8 jar file is a PLUGIN intended to be used with BungeeCord!");
System.err.println("Place this file in the \"plugins\" directory of your BungeeCord installation");
System.err.println();
try {
tryShowPopup();
}catch(Throwable t) {
}
System.exit(0);
}
private static void tryShowPopup() throws Throwable {
if(!GraphicsEnvironment.isHeadless()) {
JOptionPane.showMessageDialog(null, "ERROR: The EaglerXBungee 1.8 jar file is a PLUGIN intended to be used with BungeeCord!\nPlace this file in the \"plugins\" directory of your BungeeCord installation", "EaglerXBungee", JOptionPane.ERROR_MESSAGE);
}
}
}

View File

@ -1,5 +1,5 @@
name: EaglercraftXBungee
main: net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee
version: 1.0.6
version: 1.0.9
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

View File

@ -1 +1 @@
1.0.6
1.0.9