Fix shit (kinda)

This commit is contained in:
catfoolyou 2025-02-24 14:43:59 -05:00
parent 77b143500a
commit c40c57299f
9 changed files with 145 additions and 125 deletions

View File

@ -313,7 +313,7 @@ public class YamlConfig implements ConfigurationAdapter {
if(c == null) {
c = new ArrayList();
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);
}else {
if(c.remove("https://g.eags.us/eaglercraft/origin_blacklist.txt")) {

View File

@ -101,18 +101,19 @@ public class InitialHandler extends PacketHandler implements PendingConnection {
@Override
public void handle(final Packet2Handshake handshake) throws Exception {
System.out.println("Handshake");
Preconditions.checkState(this.thisState == State.HANDSHAKE, (Object) "Not expecting HANDSHAKE");
this.handshake = handshake;
this.bungee.getLogger().log(Level.INFO, "{0} has connected", this);
boolean skipEncryption = false;
if (handshake.getProcolVersion() == 69) {
if (handshake.getProcolVersion() == 78) {
skipEncryption = true;
this.handshake.swapProtocol((byte) 78);
}else if(handshake.getProcolVersion() > 78) {
this.disconnect("this server does not support microsoft accounts");
return;
}else if(handshake.getProcolVersion() != 78) {
this.disconnect("minecraft 1.5.2 required for eaglercraft backdoor access");
this.disconnect("minecraft 1.6.4 required for eaglercraft backdoor access");
return;
}
String un = handshake.getUsername();

Binary file not shown.

Binary file not shown.

View File

@ -1025,10 +1025,10 @@ public class EaglerAdapterImpl2 {
public EaglerSocketClient(URI serverUri, String str) throws IOException, InterruptedException {
super(serverUri);
this.setTcpNoDelay(true);
this.setConnectionLostTimeout(5);
this.setConnectionLostTimeout(15);
System.out.println("[ws] connecting to "+serverUri.toString());
rateLimitStatus = null;
if(!this.connectBlocking(5, TimeUnit.SECONDS)) {
if(!this.connectBlocking(15, TimeUnit.SECONDS)) {
synchronized(socketSync) {
if(rateLimitStatus == null) {
if(blockedAddresses.contains(str)) {
@ -1138,6 +1138,7 @@ public class EaglerAdapterImpl2 {
}
public static final void writePacket(byte[] packet) {
if(clientSocket != null && clientSocket.isOpen()) {
System.out.println("[EaglerAdapterImpl2] - Writing packet");
clientSocket.send(ByteBuffer.wrap(packet));
}
}

View File

@ -68,6 +68,7 @@ public class WebsocketNetworkManager implements INetworkManager {
private LinkedList<ByteBuffer> readChunks = new LinkedList<>();
public void processReadPackets() {
System.out.println("[WebsocketNetworkManager] - processReadPackets called");
readChunks.clear();
if(oldChunkBuffer != null) {
@ -78,6 +79,7 @@ public class WebsocketNetworkManager implements INetworkManager {
while((packet = EaglerAdapter.readPacket()) != null) {
readChunks.add(ByteBuffer.wrap(packet));
}
if(!readChunks.isEmpty()) {
int cap = 0;
for(ByteBuffer b : readChunks) {
@ -113,6 +115,9 @@ public class WebsocketNetworkManager implements INetworkManager {
}
}
else{
System.err.println("[WebsocketNetworkManager] - readChunks is empty!");
}
}
public void serverShutdown() {

View File

@ -1,150 +1,216 @@
package net.minecraft.src;
public class GuiConnecting extends GuiScreen
{
import java.io.IOException;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerProfile;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
import net.minecraft.src.Minecraft;
public class GuiConnecting extends GuiScreen {
/** A reference to the NetClientHandler. */
private NetClientHandler clientHandler;
private INetworkManager networkConnection;
private String uri;
/** True if the connection attempt has been cancelled. */
private boolean cancelled;
private boolean cancelled = false;
private final GuiScreen field_98098_c;
public GuiConnecting(GuiScreen par1GuiScreen, Minecraft par2Minecraft, ServerData par3ServerData)
{
public GuiConnecting(GuiScreen par1GuiScreen, Minecraft par2Minecraft, ServerData par3ServerData) {
this.mc = par2Minecraft;
this.field_98098_c = par1GuiScreen;
ServerAddress var4 = ServerAddress.func_78860_a(par3ServerData.serverIP);
par2Minecraft.loadWorld((WorldClient)null);
this.clientHandler = null;
this.networkConnection = null;
this.uri = par3ServerData.serverIP;
//ServerAddress var4 = ServerAddress.func_78860_a(par3ServerData.serverIP);
par2Minecraft.loadWorld((WorldClient) null);
par2Minecraft.setServerData(par3ServerData);
this.spawnNewServerThread(var4.getIP(), var4.getPort());
//this.spawnNewServerThread(var4.getIP(), var4.getPort());
}
public GuiConnecting(GuiScreen par1GuiScreen, Minecraft par2Minecraft, String par3Str, int par4)
{
this.mc = par2Minecraft;
this.field_98098_c = par1GuiScreen;
par2Minecraft.loadWorld((WorldClient)null);
this.spawnNewServerThread(par3Str, par4);
}
//private void spawnNewServerThread(String par1Str, int par2) {
// System.out.println("Connecting to " + par1Str + ", " + par2);
// (new ThreadConnectToServer(this, par1Str, par2)).start();
//}
private void spawnNewServerThread(String par1Str, int par2)
{
System.out.println("Connecting to " + par1Str + ", " + par2);
(new ThreadConnectToServer(this, par1Str, par2)).start();
}
private int timer;
/**
* Called from the main game loop to update the screen.
*/
public void updateScreen()
{
if (this.clientHandler != null)
{
public void updateScreen() {
if (timer > 2 && this.clientHandler == null) {
try {
String uria = null;
if(uri.startsWith("ws://")) {
uria = uri.substring(5);
}else if(uri.startsWith("wss://")){
uria = uri.substring(6);
}else if(!uri.contains("://")){
uria = uri;
uri = ( EaglerAdapter.isSSLPage() ? "wss://" : "ws://") + uri;
}else {
this.mc.displayGuiScreen(new GuiDisconnected(this.field_98098_c, "connect.failed", "disconnect.genericReason", "invalid uri websocket protocol", ""));
return;
}
int i = uria.lastIndexOf(':');
int port = -1;
if(i > 0 && uria.startsWith("[") && uria.charAt(i - 1) != ']') {
i = -1;
}
if(i == -1) port = uri.startsWith("wss") ? 443 : 80;
if(uria.endsWith("/")) uria = uria.substring(0, uria.length() - 1);
if(port == -1) {
try {
int i2 = uria.indexOf('/');
port = Integer.parseInt(uria.substring(i + 1, i2 == -1 ? uria.length() : i2 - 1));
}catch(Throwable t) {
this.mc.displayGuiScreen(new GuiDisconnected(this.field_98098_c, "connect.failed", "disconnect.genericReason", "invalid port number", ""));
return;
}
}
this.clientHandler = new NetClientHandler(this.mc, uri, 0);
System.out.println("Sending packets");
this.clientHandler.addToSendQueue(new Packet2ClientProtocol(78, EaglerProfile.username, uria, port));
this.clientHandler.addToSendQueue(new Packet250CustomPayload("EAG|MySkin", EaglerProfile.getSkinPacket()));
this.clientHandler.addToSendQueue(new Packet250CustomPayload("EAG|MyCape", EaglerProfile.getCapePacket()));
} catch (IOException e) {
try {
this.clientHandler.disconnect();
}catch(Throwable t) {
}
e.printStackTrace();
showDisconnectScreen(e.toString());
}
}
if(this.clientHandler != null) {
System.out.println("[GuiConnecting] - Processing packets");
this.clientHandler.processReadPackets();
}
else {
System.err.println("[GuiConnecting] - Could not process packets!");
}
if(timer > 15) {
if(!EaglerAdapter.connectionOpen() && this.mc.currentScreen == this) {
showDisconnectScreen("");
}
}
++timer;
}
private void showDisconnectScreen(String e) {
RateLimit l = EaglerAdapter.getRateLimitStatus();
if(l == RateLimit.NOW_LOCKED) {
this.mc.displayGuiScreen(new GuiDisconnected(this.field_98098_c, "disconnect.ipNowLocked", "disconnect.endOfStream"));
}else if(l == RateLimit.LOCKED) {
this.mc.displayGuiScreen(new GuiDisconnected(this.field_98098_c, "disconnect.ipLocked", "disconnect.endOfStream"));
}else if(l == RateLimit.BLOCKED) {
this.mc.displayGuiScreen(new GuiDisconnected(this.field_98098_c, "disconnect.ipBlocked", "disconnect.endOfStream"));
}else if(l == RateLimit.FAILED_POSSIBLY_LOCKED) {
this.mc.displayGuiScreen(new GuiDisconnected(this.field_98098_c, "disconnect.ipFailedPossiblyLocked", "disconnect.endOfStream"));
}else {
this.mc.displayGuiScreen(new GuiDisconnected(this.field_98098_c, "connect.failed", "disconnect.genericReason", "could not connect to "+uri, e));
}
}
/**
* Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
* Fired when a key is typed. This is the equivalent of
* KeyListener.keyTyped(KeyEvent e).
*/
protected void keyTyped(char par1, int par2) {}
protected void keyTyped(char par1, int par2) {
}
/**
* Adds the buttons (and other controls) to the screen in question.
*/
public void initGui()
{
public void initGui() {
StringTranslate var1 = StringTranslate.getInstance();
this.buttonList.clear();
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, StatCollector.translateToLocal("gui.cancel")));
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.cancel")));
}
/**
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
* Fired when a control is clicked. This is the equivalent of
* ActionListener.actionPerformed(ActionEvent e).
*/
protected void actionPerformed(GuiButton par1GuiButton)
{
if (par1GuiButton.id == 0)
{
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton.id == 0) {
this.cancelled = true;
if (this.clientHandler != null)
{
if (this.clientHandler != null) {
this.clientHandler.disconnect();
}
this.mc.displayGuiScreen(this.field_98098_c);
this.mc.stopServerAndDisplayGuiScreen(this.field_98098_c);
}
}
/**
* Draws the screen and all the components in it.
*/
public void drawScreen(int par1, int par2, float par3)
{
public void drawScreen(int par1, int par2, float par3) {
this.drawDefaultBackground();
StringTranslate var4 = StringTranslate.getInstance();
if (this.clientHandler == null)
{
this.drawCenteredString(this.fontRenderer, StatCollector.translateToLocal("connect.connecting"), this.width / 2, this.height / 2 - 50, 16777215);
if (this.clientHandler == null) {
this.drawCenteredString(this.fontRenderer, var4.translateKey("connect.connecting"), this.width / 2, this.height / 2 - 50, 16777215);
this.drawCenteredString(this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215);
}
else
{
this.drawCenteredString(this.fontRenderer, StatCollector.translateToLocal("connect.authorizing"), this.width / 2, this.height / 2 - 50, 16777215);
} else {
this.drawCenteredString(this.fontRenderer, var4.translateKey("connect.authorizing"), this.width / 2, this.height / 2 - 50, 16777215);
this.drawCenteredString(this.fontRenderer, this.clientHandler.field_72560_a, this.width / 2, this.height / 2 - 10, 16777215);
}
super.drawScreen(par1, par2, par3);
}
public boolean doesGuiPauseGame() {
return false;
}
/**
* Sets the NetClientHandler.
*/
static NetClientHandler setNetClientHandler(GuiConnecting par0GuiConnecting, NetClientHandler par1NetClientHandler)
{
public static NetClientHandler setNetClientHandler(GuiConnecting par0GuiConnecting, NetClientHandler par1NetClientHandler) {
return par0GuiConnecting.clientHandler = par1NetClientHandler;
}
static Minecraft func_74256_a(GuiConnecting par0GuiConnecting)
{
public static Minecraft func_74256_a(GuiConnecting par0GuiConnecting) {
return par0GuiConnecting.mc;
}
static boolean isCancelled(GuiConnecting par0GuiConnecting)
{
public static boolean isCancelled(GuiConnecting par0GuiConnecting) {
return par0GuiConnecting.cancelled;
}
static Minecraft func_74254_c(GuiConnecting par0GuiConnecting)
{
public static Minecraft func_74254_c(GuiConnecting par0GuiConnecting) {
return par0GuiConnecting.mc;
}
/**
* Gets the NetClientHandler.
*/
static NetClientHandler getNetClientHandler(GuiConnecting par0GuiConnecting)
{
public static NetClientHandler getNetClientHandler(GuiConnecting par0GuiConnecting) {
return par0GuiConnecting.clientHandler;
}
static GuiScreen func_98097_e(GuiConnecting par0GuiConnecting)
{
public static GuiScreen func_98097_e(GuiConnecting par0GuiConnecting) {
return par0GuiConnecting.field_98098_c;
}
static Minecraft func_74250_f(GuiConnecting par0GuiConnecting)
{
public static Minecraft func_74250_f(GuiConnecting par0GuiConnecting) {
return par0GuiConnecting.mc;
}
static Minecraft func_74251_g(GuiConnecting par0GuiConnecting)
{
public static Minecraft func_74251_g(GuiConnecting par0GuiConnecting) {
return par0GuiConnecting.mc;
}
static Minecraft func_98096_h(GuiConnecting par0GuiConnecting)
{
public static Minecraft func_98096_h(GuiConnecting par0GuiConnecting) {
return par0GuiConnecting.mc;
}
}

View File

@ -93,6 +93,9 @@ public class NetClientHandler extends NetHandler {
if (this.netManager != null) {
this.netManager.processReadPackets();
}
else {
System.err.println("[NetClientHandler] - netManager is null!");
}
if(!EaglerAdapter.connectionOpen()) {
if(!this.disconnected) {

View File

@ -1,56 +0,0 @@
package net.minecraft.src;
import java.net.UnknownHostException;
class ThreadConnectToServer extends Thread
{
/** The IP address or domain used to connect. */
final String ip;
/** The port used to connect. */
final int port;
/** A reference to the GuiConnecting object. */
final GuiConnecting connectingGui;
ThreadConnectToServer(GuiConnecting par1GuiConnecting, String par2Str, int par3)
{
this.connectingGui = par1GuiConnecting;
this.ip = par2Str;
this.port = par3;
}
public void run()
{
try
{
GuiConnecting.setNetClientHandler(this.connectingGui, new NetClientHandler(GuiConnecting.func_74256_a(this.connectingGui), this.ip, this.port));
if (GuiConnecting.isCancelled(this.connectingGui))
{
return;
}
GuiConnecting.getNetClientHandler(this.connectingGui).addToSendQueue(new Packet2ClientProtocol(78, GuiConnecting.func_74254_c(this.connectingGui).getSession().getUsername(), this.ip, this.port));
}
catch (UnknownHostException var2)
{
if (GuiConnecting.isCancelled(this.connectingGui))
{
return;
}
GuiConnecting.func_74250_f(this.connectingGui).displayGuiScreen(new GuiDisconnected(GuiConnecting.func_98097_e(this.connectingGui), "connect.failed", "disconnect.genericReason", new Object[] {"Unknown host \'" + this.ip + "\'"}));
}
catch (Exception var4)
{
if (GuiConnecting.isCancelled(this.connectingGui))
{
return;
}
var4.printStackTrace();
GuiConnecting.func_98096_h(this.connectingGui).displayGuiScreen(new GuiDisconnected(GuiConnecting.func_98097_e(this.connectingGui), "connect.failed", "disconnect.genericReason", new Object[] {var4.toString()}));
}
}
}