Port AutoGG

This commit is contained in:
ThisIsALegitUsername 2022-12-29 03:14:28 +00:00
parent 2c8fcf816e
commit 40d94bbdc5

View File

@ -10,6 +10,10 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import dev.resent.Resent;
import dev.resent.event.impl.ClientChatEvent;
import dev.resent.module.impl.misc.AutoGG;
import dev.resent.util.misc.W;
import net.lax1dude.eaglercraft.v1_8.netty.Unpooled; import net.lax1dude.eaglercraft.v1_8.netty.Unpooled;
import net.lax1dude.eaglercraft.v1_8.profile.ServerSkinCache; import net.lax1dude.eaglercraft.v1_8.profile.ServerSkinCache;
import net.lax1dude.eaglercraft.v1_8.profile.SkinPackets; import net.lax1dude.eaglercraft.v1_8.profile.SkinPackets;
@ -234,6 +238,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
private final Map<EaglercraftUUID, NetworkPlayerInfo> playerInfoMap = Maps.newHashMap(); private final Map<EaglercraftUUID, NetworkPlayerInfo> playerInfoMap = Maps.newHashMap();
public int currentServerMaxPlayers = 20; public int currentServerMaxPlayers = 20;
private boolean field_147308_k = false; private boolean field_147308_k = false;
public static String hasSaid = "hasSaid1";
/**+ /**+
* Just an ordinary random number generator, used to randomize * Just an ordinary random number generator, used to randomize
* audio pitch of item/orb pickup and randomize both * audio pitch of item/orb pickup and randomize both
@ -754,6 +759,34 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
if (packetIn.getType() == 2) { if (packetIn.getType() == 2) {
this.gameController.ingameGUI.setRecordPlaying(packetIn.getChatComponent(), false); this.gameController.ingameGUI.setRecordPlaying(packetIn.getChatComponent(), false);
} else { } else {
ClientChatEvent event = new ClientChatEvent(packetIn.getChatComponent().getUnformattedText());
Resent.INSTANCE.events().post(event);
if (event.message.toLowerCase().contains("you won the match") && AutoGG.onWin.getValue()
|| event.message.toLowerCase().contains("was killed by")
&& event.message.contains(Minecraft.getMinecraft().thePlayer.getName()) || event.message.toLowerCase().contains("you lost the") && AutoGG.onLose.getValue()) {
if (W.autoGG().isEnabled()) {
switch (hasSaid) {
case "hasSaid1":
Minecraft.getMinecraft().thePlayer.sendChatMessage("gg");
hasSaid = "hasSaid2";
break;
case "hasSaid2":
if(AutoGG.rep.getValue()){
Minecraft.getMinecraft().thePlayer.sendChatMessage("gf");
}else {
Minecraft.getMinecraft().thePlayer.sendChatMessage("gg");
}
hasSaid = "hasSaid1";
break;
}
}
}
this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.getChatComponent()); this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.getChatComponent());
} }