(fix) quickplay bug

This commit is contained in:
kirillsaint 2024-06-04 13:42:43 +06:00
parent 7169eaf437
commit 08188bf9e5

View File

@ -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<Integer, Setting> 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]);
}
}
}