add toggle proxy button

This commit is contained in:
ayunami2000 2022-04-09 13:55:27 -04:00
parent 67eb726630
commit ff32a46310
6 changed files with 26530 additions and 31170 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -15,7 +15,7 @@
<script type="text/javascript" src="music.js"></script> <script type="text/javascript" src="music.js"></script>
<script type="text/javascript" src="classes.js?t=updateme9"></script> <script type="text/javascript" src="classes.js?t=updateme10"></script>
<script type="text/javascript"> <script type="text/javascript">
//window.eag_self_proxy=true;//set to true to set the default proxy to the current url //window.eag_self_proxy=true;//set to true to set the default proxy to the current url
//window.eag_proxy_list="";//set to a string of comma-separated proxy ip:port combinations for a custom proxy list //window.eag_proxy_list="";//set to a string of comma-separated proxy ip:port combinations for a custom proxy list

View File

@ -86,7 +86,7 @@ public class GuiScreenEditProfile extends GuiScreen {
this.dropDownOptions = EaglerProfile.concatArrays(n, defaultOptions); this.dropDownOptions = EaglerProfile.concatArrays(n, defaultOptions);
} }
private GuiButton button0, button1, button2, button3; private GuiButton button0, button1, button2, button3, button4;
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
@ -105,6 +105,7 @@ public class GuiScreenEditProfile extends GuiScreen {
this.buttonList.add(button2 = new GuiButton(3, this.width / 2 - 21 + 71, this.height / 6 + 110, 72, 20, var1.translateKey("profile.clearSkin"))); this.buttonList.add(button2 = new GuiButton(3, this.width / 2 - 21 + 71, this.height / 6 + 110, 72, 20, var1.translateKey("profile.clearSkin")));
this.buttonList.add(button3 = new GuiButton(4, this.width / 2 - 21 + 71, this.height / 6 + 134, 72, 20, this.mc.gameSettings.useDefaultProtocol?"Switch to Eaglercraft":"Switch to Vanilla")); this.buttonList.add(button3 = new GuiButton(4, this.width / 2 - 21 + 71, this.height / 6 + 134, 72, 20, this.mc.gameSettings.useDefaultProtocol?"Switch to Eaglercraft":"Switch to Vanilla"));
this.buttonList.add(button4 = new GuiButton(5, this.width / 2 - 21, this.height / 6 + 134, 72, 20, (this.mc.gameSettings.useProxy?"Dis":"En")+"able Proxy Mode"));
//this.buttonList.add(new GuiButton(200, this.width / 2, this.height / 6 + 72, 150, 20, var1.translateKey("gui.done"))); //this.buttonList.add(new GuiButton(200, this.width / 2, this.height / 6 + 72, 150, 20, var1.translateKey("gui.done")));
} }
@ -351,6 +352,10 @@ public class GuiScreenEditProfile extends GuiScreen {
//toggle version mode //toggle version mode
this.mc.gameSettings.useDefaultProtocol=!this.mc.gameSettings.useDefaultProtocol; this.mc.gameSettings.useDefaultProtocol=!this.mc.gameSettings.useDefaultProtocol;
button3.displayString=this.mc.gameSettings.useDefaultProtocol?"Switch to Eaglercraft":"Switch to Vanilla"; button3.displayString=this.mc.gameSettings.useDefaultProtocol?"Switch to Eaglercraft":"Switch to Vanilla";
}else if (par1GuiButton.id == 5) {
//toggle using proxy
this.mc.gameSettings.useProxy=!this.mc.gameSettings.useProxy;
button4.displayString=(this.mc.gameSettings.useProxy?"Dis":"En")+"able Proxy Mode";
} }
} }
} }

View File

@ -9,6 +9,7 @@ import java.util.Arrays;
public class GameSettings { public class GameSettings {
public static boolean useDefaultProtocol = true; public static boolean useDefaultProtocol = true;
public static boolean useProxy = true;
public static String proxy = ""; public static String proxy = "";
public static String getNewProxy(){ public static String getNewProxy(){
if(ConfigConstants.proxies.length==1)return ConfigConstants.proxies[0]; if(ConfigConstants.proxies.length==1)return ConfigConstants.proxies[0];

View File

@ -74,7 +74,7 @@ public class GuiConnecting extends GuiScreen {
} }
} }
this.clientHandler = new NetClientHandler(this.mc, this.mc.gameSettings.proxy.equals("")?uri:uria, 0); this.clientHandler = new NetClientHandler(this.mc, (this.mc.gameSettings.proxy.equals("")||!this.mc.gameSettings.useProxy)?uri:uria, 0);
if(this.mc.gameSettings.useDefaultProtocol) { if(this.mc.gameSettings.useDefaultProtocol) {
this.clientHandler.addToSendQueue(new Packet2ClientProtocol(61, EaglerProfile.username, uria, port)); this.clientHandler.addToSendQueue(new Packet2ClientProtocol(61, EaglerProfile.username, uria, port));
}else{ }else{