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]); } } }