From c21abb5dfded37a0a3ac45537846cfdeda044363 Mon Sep 17 00:00:00 2001 From: ayunami2000 Date: Sat, 23 Jul 2022 16:43:07 -0400 Subject: [PATCH] Add newer protocolsupport support & change domain --- .../java/net/md_5/bungee/ServerConnector.java | 27 ++++++++++++++----- .../net/md_5/bungee/config/Configuration.java | 6 +++++ .../net/md_5/bungee/config/YamlConfig.java | 4 +-- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/ServerConnector.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/ServerConnector.java index a24a805..94c8116 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/ServerConnector.java @@ -57,6 +57,7 @@ public class ServerConnector extends PacketHandler private State thisState; private SecretKey secretkey; private boolean sentMessages; + private boolean protocolSupport = BungeeCord.getInstance().config.getProtocolSupport(); @Override public void exception(final Throwable t) throws Exception { @@ -73,13 +74,15 @@ public class ServerConnector extends PacketHandler public void connected(final ChannelWrapper channel) throws Exception { this.ch = channel; channel.write(this.user.getPendingConnection().getHandshake()); - final ByteArrayDataOutput out = ByteStreams.newDataOutput(); - out.writeUTF("Login"); - out.writeUTF(this.user.getAddress().getHostString()); - out.writeInt(this.user.getAddress().getPort()); - channel.write(new PacketFAPluginMessage("BungeeCord", out.toByteArray())); - if (this.user.getPendingConnection().getForgeLogin() == null) { - channel.write(PacketConstants.CLIENT_LOGIN); + if (!protocolSupport) { + final ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("Login"); + out.writeUTF(this.user.getAddress().getHostString()); + out.writeInt(this.user.getAddress().getPort()); + channel.write(new PacketFAPluginMessage("BungeeCord", out.toByteArray())); + if (this.user.getPendingConnection().getForgeLogin() == null) { + channel.write(PacketConstants.CLIENT_LOGIN); + } } } @@ -160,6 +163,16 @@ public class ServerConnector extends PacketHandler @Override public void handle(final PacketFDEncryptionRequest encryptRequest) throws Exception { Preconditions.checkState(this.thisState == State.ENCRYPT_REQUEST, (Object)"Not expecting ENCRYPT_REQUEST"); + if (protocolSupport) { + final ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("Login"); + out.writeUTF(this.user.getAddress().getHostString()); + out.writeInt(this.user.getAddress().getPort()); + this.user.unsafe().sendPacket(new PacketFAPluginMessage("BungeeCord", out.toByteArray())); + if (this.user.getPendingConnection().getForgeLogin() == null) { + this.user.unsafe().sendPacket(PacketConstants.CLIENT_LOGIN); + } + } if (this.user.getPendingConnection().getForgeLogin() != null) { final PublicKey publickey = EncryptionUtil.getPubkey(encryptRequest); this.secretkey = EncryptionUtil.getSecret(); diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/config/Configuration.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/config/Configuration.java index 9b34563..a5b4962 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/config/Configuration.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/config/Configuration.java @@ -27,6 +27,7 @@ public class Configuration { private AuthServiceInfo authInfo; private boolean onlineMode; private boolean voiceEnabled; + private boolean protocolSupport; private int playerLimit; private String name; private boolean showBanType; @@ -61,6 +62,7 @@ public class Configuration { this.authInfo = adapter.getAuthSettings(); this.onlineMode = false; this.voiceEnabled = adapter.getBoolean("voice_enabled", true); + this.protocolSupport = adapter.getBoolean("protocol_support_fix", false); this.playerLimit = adapter.getInt("player_limit", this.playerLimit); this.name = adapter.getString("server_name", EaglercraftBungee.name + " Server"); this.showBanType = adapter.getBoolean("display_ban_type_on_kick", false); @@ -123,6 +125,10 @@ public class Configuration { return voiceEnabled; } + public boolean getProtocolSupport() { + return protocolSupport; + } + public String getServerName() { return name; } diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/config/YamlConfig.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/config/YamlConfig.java index 333c7fc..e48d582 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/config/YamlConfig.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/config/YamlConfig.java @@ -298,7 +298,7 @@ public class YamlConfig implements ConfigurationAdapter { Collection c = this.get("origin_blacklist_subscriptions", null); if(c == null) { c = new ArrayList(); - c.add("https://g.eags.us/eaglercraft/origin_blacklist.txt"); + c.add("https://g.lax1dude.net/eaglercraft/origin_blacklist.txt"); c.add("https://raw.githubusercontent.com/LAX1DUDE/eaglercraft/main/stable-download/origin_blacklist.txt"); c = this.get("origin_blacklist_subscriptions", c); } @@ -312,7 +312,7 @@ public class YamlConfig implements ConfigurationAdapter { c = new ArrayList(); c.add("type the name of your client's domain here"); c.add("(if 'origin_blacklist_use_simple_whitelist' is true)"); - c.add("g.eags.us"); + c.add("g.lax1dude.net"); c = this.get("origin_blacklist_simple_whitelist", c); } return c;