From 08188bf9e5da4915e80835cc5e504f0831a55961 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Tue, 4 Jun 2024 13:42:43 +0600 Subject: [PATCH] (fix) quickplay bug --- .../client/mods/hypixel/QuickPlayMod.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/silentclient/client/mods/hypixel/QuickPlayMod.java b/src/main/java/net/silentclient/client/mods/hypixel/QuickPlayMod.java index fe62f56..83d1adf 100644 --- a/src/main/java/net/silentclient/client/mods/hypixel/QuickPlayMod.java +++ b/src/main/java/net/silentclient/client/mods/hypixel/QuickPlayMod.java @@ -4,6 +4,7 @@ import com.google.common.reflect.TypeToken; import net.minecraft.client.Minecraft; import net.silentclient.client.Client; import net.silentclient.client.event.EventTarget; +import net.silentclient.client.event.impl.ConnectToServerEvent; import net.silentclient.client.event.impl.KeyEvent; import net.silentclient.client.gui.quickplay.QuickplayGui; import net.silentclient.client.mods.Mod; @@ -68,7 +69,8 @@ public class QuickPlayMod extends Mod { public void updateHashMap() { HashMap map = new HashMap<>(); for(Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(this)) { - if (setting.isKeybind()) { + String[] args = setting.getName().split("&"); + if (((args[1].equals("Hypixel") && Server.isHypixel()) || (args[1].equals("RuHypixel") && Server.isRuHypixel())) && setting.isKeybind()) { map.put(setting.getKeybind(), setting); } } @@ -76,6 +78,11 @@ public class QuickPlayMod extends Mod { hashMap = map; } + @EventTarget + public void onServerJoin(ConnectToServerEvent event) { + updateHashMap(); + } + @Override public void onChangeSettingValue(Setting setting) { super.onChangeSettingValue(setting); @@ -133,7 +140,7 @@ public class QuickPlayMod extends Mod { if(setting != null) { if(setting.getName().equals("Open Menu")) { // Open Menu - if(setting.isKeyDown() && (Server.isHypixel() || Server.isRuHypixel())) { + if(Server.isHypixel() || Server.isRuHypixel()) { mc.displayGuiScreen(new QuickplayGui()); } } else { @@ -141,9 +148,7 @@ public class QuickPlayMod extends Mod { return; } String[] args = setting.getName().split("&"); - if(((args[1].equals("Hypixel") && Server.isHypixel()) || (args[1].equals("RuHypixel") && Server.isRuHypixel())) && setting.isKeyDown()) { - runCommand(args[2]); - } + runCommand(args[2]); } } }