0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Add LastServerOtf

This commit is contained in:
Alexander01998 2020-02-12 22:04:14 +01:00
parent 03e0aacf96
commit 9337ecc685
3 changed files with 37 additions and 0 deletions

View File

@ -31,6 +31,8 @@ public class MultiplayerScreenMixin extends Screen implements IMultiplayerScreen
@Shadow
protected MultiplayerServerListWidget serverListWidget;
private ButtonWidget lastServerButton;
private MultiplayerScreenMixin(WurstClient wurst, Text text_1)
{
super(text_1);
@ -54,6 +56,10 @@ public class MultiplayerScreenMixin extends Screen implements IMultiplayerScreen
if(!WurstClient.INSTANCE.isEnabled())
return;
lastServerButton = addButton(new ButtonWidget(width / 2 - 154, 10, 100,
20, "Last Server", b -> LastServerRememberer
.joinLastServer((MultiplayerScreen)(Object)this)));
addButton(new ButtonWidget(width / 2 + 154 + 4, height - 52, 100, 20,
"Server Finder", b -> minecraft.openScreen(
new ServerFinderScreen((MultiplayerScreen)(Object)this))));
@ -63,6 +69,12 @@ public class MultiplayerScreenMixin extends Screen implements IMultiplayerScreen
new CleanUpScreen((MultiplayerScreen)(Object)this))));
}
@Inject(at = {@At("TAIL")}, method = {"tick()V"})
public void onTick(CallbackInfo ci)
{
lastServerButton.active = LastServerRememberer.getLastServer() != null;
}
@Inject(at = {@At("HEAD")},
method = {"connect(Lnet/minecraft/client/network/ServerInfo;)V"})
private void onConnect(ServerInfo entry, CallbackInfo ci)

View File

@ -21,6 +21,7 @@ public final class OtfList
public final CleanUpOtf cleanUpOtf = new CleanUpOtf();
public final DisableOtf disableOtf = new DisableOtf();
public final HackListOtf hackListOtf = new HackListOtf();
public final LastServerOtf lastServerOtf = new LastServerOtf();
public final ServerFinderOtf serverFinderOtf = new ServerFinderOtf();
public final TabGuiOtf tabGuiOtf = new TabGuiOtf();
public final WurstCapesOtf wurstCapesOtf = new WurstCapesOtf();

View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2014 - 2020 | Alexander01998 | All rights reserved.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.other_features;
import net.wurstclient.SearchTags;
import net.wurstclient.other_feature.OtherFeature;
@SearchTags({"last server"})
public final class LastServerOtf extends OtherFeature
{
public LastServerOtf()
{
super("LastServer",
"Wurst adds a \"Last Server\" button to the server selection\n"
+ "screen that automatically brings you back to the last\n"
+ "server you played on.\n\n"
+ "Useful when you get kicked and/or have a lot of servers.");
}
}