mirror of
http://git.eaglercraft.rip/eaglercraft/eaglercraft-1.8.git
synced 2025-04-29 01:51:58 -05:00
(1.0.9) Updated plugin to latest version
This commit is contained in:
parent
ed95ff8bf7
commit
96d6485bb1
Binary file not shown.
@ -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.handlers.EaglerPluginEventListener;
|
||||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.EaglerPipeline;
|
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.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.BinaryHttpClient;
|
||||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.skins.ISkinService;
|
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.SkinService;
|
||||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.skins.SkinServiceOffline;
|
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.Plugin;
|
||||||
import net.md_5.bungee.api.plugin.PluginManager;
|
import net.md_5.bungee.api.plugin.PluginManager;
|
||||||
import net.md_5.bungee.netty.PipelineUtils;
|
import net.md_5.bungee.netty.PipelineUtils;
|
||||||
@ -52,6 +54,14 @@ import net.md_5.bungee.BungeeCord;
|
|||||||
*/
|
*/
|
||||||
public class EaglerXBungee extends Plugin {
|
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 static EaglerXBungee instance = null;
|
||||||
private EaglerBungeeConfig conf = null;
|
private EaglerBungeeConfig conf = null;
|
||||||
private EventLoopGroup eventLoopGroup;
|
private EventLoopGroup eventLoopGroup;
|
||||||
|
@ -3,6 +3,7 @@ package net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server;
|
|||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.bungeeprotocol.EaglerBungeeProtocol;
|
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.bungeeprotocol.EaglerBungeeProtocol;
|
||||||
import net.md_5.bungee.netty.ChannelWrapper;
|
import net.md_5.bungee.netty.ChannelWrapper;
|
||||||
|
import net.md_5.bungee.protocol.Protocol;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||||
@ -33,6 +34,22 @@ public class EaglerChannelWrapper extends ChannelWrapper {
|
|||||||
getHandle().pipeline().get(EaglerMinecraftDecoder.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) {
|
public void close(Object o) {
|
||||||
super.close(o);
|
super.close(o);
|
||||||
EaglerPipeline.closeChannel(getHandle());
|
EaglerPipeline.closeChannel(getHandle());
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server;
|
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 java.util.List;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
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.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.bungeeprotocol.EaglerProtocolAccessProxy;
|
||||||
import net.md_5.bungee.protocol.DefinedPacket;
|
import net.md_5.bungee.protocol.DefinedPacket;
|
||||||
import net.md_5.bungee.protocol.PacketWrapper;
|
import net.md_5.bungee.protocol.PacketWrapper;
|
||||||
|
import net.md_5.bungee.protocol.Protocol;
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants.Direction;
|
import net.md_5.bungee.protocol.ProtocolConstants.Direction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,6 +36,7 @@ public class EaglerMinecraftDecoder extends MessageToMessageDecoder<WebSocketFra
|
|||||||
private EaglerBungeeProtocol protocol;
|
private EaglerBungeeProtocol protocol;
|
||||||
private final boolean server;
|
private final boolean server;
|
||||||
private int protocolVersion;
|
private int protocolVersion;
|
||||||
|
private static Constructor<PacketWrapper> packetWrapperConstructor = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, List<Object> out) throws Exception {
|
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();
|
ByteBuf buf = in.content();
|
||||||
int pktId = DefinedPacket.readVarInt(buf);
|
int pktId = DefinedPacket.readVarInt(buf);
|
||||||
DefinedPacket pkt = EaglerProtocolAccessProxy.createPacket(protocol, protocolVersion, pktId, server);
|
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) {
|
if(pkt != null) {
|
||||||
pkt.read(buf, server ? Direction.TO_CLIENT : Direction.TO_SERVER, protocolVersion);
|
pkt.read(buf, server ? Direction.TO_CLIENT : Direction.TO_SERVER, protocolVersion);
|
||||||
if(buf.isReadable()) {
|
if(buf.isReadable()) {
|
||||||
EaglerXBungee.logger().severe("[DECODER][" + ctx.channel().remoteAddress() + "] Packet " +
|
EaglerXBungee.logger().severe("[DECODER][" + ctx.channel().remoteAddress() + "] Packet " +
|
||||||
pkt.getClass().getSimpleName() + " had extra bytes! (" + buf.readableBytes() + ")");
|
pkt.getClass().getSimpleName() + " had extra bytes! (" + buf.readableBytes() + ")");
|
||||||
}else {
|
}else {
|
||||||
out.add(new PacketWrapper(pkt, buf.copy(0, buf.writerIndex())));
|
out.add(this.wrapPacket(pkt, buf, bungeeProtocol));
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
out.add(new PacketWrapper(null, buf.copy(0, buf.writerIndex())));
|
out.add(this.wrapPacket(null, buf, bungeeProtocol));
|
||||||
}
|
}
|
||||||
}else if(frame instanceof PingWebSocketFrame) {
|
}else if(frame instanceof PingWebSocketFrame) {
|
||||||
if(millis - con.lastClientPingPacket > 500l) {
|
if(millis - con.lastClientPingPacket > 500l) {
|
||||||
@ -83,4 +101,46 @@ public class EaglerMinecraftDecoder extends MessageToMessageDecoder<WebSocketFra
|
|||||||
this.protocolVersion = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,12 @@ public class EaglerMinecraftEncoder extends MessageToMessageEncoder<DefinedPacke
|
|||||||
ByteBuf buf = Unpooled.buffer();
|
ByteBuf buf = Unpooled.buffer();
|
||||||
int pk = EaglerProtocolAccessProxy.getPacketId(protocol, protocolVersion, msg, server);
|
int pk = EaglerProtocolAccessProxy.getPacketId(protocol, protocolVersion, msg, server);
|
||||||
DefinedPacket.writeVarInt(pk, buf);
|
DefinedPacket.writeVarInt(pk, buf);
|
||||||
|
try {
|
||||||
msg.write(buf, server ? Direction.TO_CLIENT : Direction.TO_SERVER, protocolVersion);
|
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));
|
out.add(new BinaryWebSocketFrame(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,4 +59,8 @@ public class EaglerMinecraftEncoder extends MessageToMessageEncoder<DefinedPacke
|
|||||||
this.protocolVersion = protocolVersion;
|
this.protocolVersion = protocolVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EaglerBungeeProtocol getProtocol() {
|
||||||
|
return this.protocol;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,15 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
|
|||||||
|
|
||||||
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);
|
||||||
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();
|
ChannelPipeline pp = ctx.channel().pipeline();
|
||||||
|
|
||||||
|
@ -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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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.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
|
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
|
@ -1 +1 @@
|
|||||||
1.0.6
|
1.0.9
|
Loading…
x
Reference in New Issue
Block a user