Add newer protocolsupport support & change domain

This commit is contained in:
ayunami2000 2022-07-23 16:43:07 -04:00
parent eddde27c20
commit c21abb5dfd
3 changed files with 28 additions and 9 deletions

View file

@ -57,6 +57,7 @@ public class ServerConnector extends PacketHandler
private State thisState; private State thisState;
private SecretKey secretkey; private SecretKey secretkey;
private boolean sentMessages; private boolean sentMessages;
private boolean protocolSupport = BungeeCord.getInstance().config.getProtocolSupport();
@Override @Override
public void exception(final Throwable t) throws Exception { 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 { public void connected(final ChannelWrapper channel) throws Exception {
this.ch = channel; this.ch = channel;
channel.write(this.user.getPendingConnection().getHandshake()); channel.write(this.user.getPendingConnection().getHandshake());
final ByteArrayDataOutput out = ByteStreams.newDataOutput(); if (!protocolSupport) {
out.writeUTF("Login"); final ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF(this.user.getAddress().getHostString()); out.writeUTF("Login");
out.writeInt(this.user.getAddress().getPort()); out.writeUTF(this.user.getAddress().getHostString());
channel.write(new PacketFAPluginMessage("BungeeCord", out.toByteArray())); out.writeInt(this.user.getAddress().getPort());
if (this.user.getPendingConnection().getForgeLogin() == null) { channel.write(new PacketFAPluginMessage("BungeeCord", out.toByteArray()));
channel.write(PacketConstants.CLIENT_LOGIN); if (this.user.getPendingConnection().getForgeLogin() == null) {
channel.write(PacketConstants.CLIENT_LOGIN);
}
} }
} }
@ -160,6 +163,16 @@ public class ServerConnector extends PacketHandler
@Override @Override
public void handle(final PacketFDEncryptionRequest encryptRequest) throws Exception { public void handle(final PacketFDEncryptionRequest encryptRequest) throws Exception {
Preconditions.checkState(this.thisState == State.ENCRYPT_REQUEST, (Object)"Not expecting ENCRYPT_REQUEST"); 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) { if (this.user.getPendingConnection().getForgeLogin() != null) {
final PublicKey publickey = EncryptionUtil.getPubkey(encryptRequest); final PublicKey publickey = EncryptionUtil.getPubkey(encryptRequest);
this.secretkey = EncryptionUtil.getSecret(); this.secretkey = EncryptionUtil.getSecret();

View file

@ -27,6 +27,7 @@ public class Configuration {
private AuthServiceInfo authInfo; private AuthServiceInfo authInfo;
private boolean onlineMode; private boolean onlineMode;
private boolean voiceEnabled; private boolean voiceEnabled;
private boolean protocolSupport;
private int playerLimit; private int playerLimit;
private String name; private String name;
private boolean showBanType; private boolean showBanType;
@ -61,6 +62,7 @@ public class Configuration {
this.authInfo = adapter.getAuthSettings(); this.authInfo = adapter.getAuthSettings();
this.onlineMode = false; this.onlineMode = false;
this.voiceEnabled = adapter.getBoolean("voice_enabled", true); this.voiceEnabled = adapter.getBoolean("voice_enabled", true);
this.protocolSupport = adapter.getBoolean("protocol_support_fix", false);
this.playerLimit = adapter.getInt("player_limit", this.playerLimit); this.playerLimit = adapter.getInt("player_limit", this.playerLimit);
this.name = adapter.getString("server_name", EaglercraftBungee.name + " Server"); this.name = adapter.getString("server_name", EaglercraftBungee.name + " Server");
this.showBanType = adapter.getBoolean("display_ban_type_on_kick", false); this.showBanType = adapter.getBoolean("display_ban_type_on_kick", false);
@ -123,6 +125,10 @@ public class Configuration {
return voiceEnabled; return voiceEnabled;
} }
public boolean getProtocolSupport() {
return protocolSupport;
}
public String getServerName() { public String getServerName() {
return name; return name;
} }

View file

@ -298,7 +298,7 @@ public class YamlConfig implements ConfigurationAdapter {
Collection<String> c = this.get("origin_blacklist_subscriptions", null); Collection<String> c = this.get("origin_blacklist_subscriptions", null);
if(c == null) { if(c == null) {
c = new ArrayList(); 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.add("https://raw.githubusercontent.com/LAX1DUDE/eaglercraft/main/stable-download/origin_blacklist.txt");
c = this.get("origin_blacklist_subscriptions", c); c = this.get("origin_blacklist_subscriptions", c);
} }
@ -312,7 +312,7 @@ public class YamlConfig implements ConfigurationAdapter {
c = new ArrayList(); c = new ArrayList();
c.add("type the name of your client's domain here"); c.add("type the name of your client's domain here");
c.add("(if 'origin_blacklist_use_simple_whitelist' is true)"); 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); c = this.get("origin_blacklist_simple_whitelist", c);
} }
return c; return c;