Merge pull request #55 from TheBritishMidget/master

Setting to make F3 + Key not toggle modules
This commit is contained in:
noil 2021-02-10 10:38:28 -05:00 committed by GitHub
commit c72a0b34de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package me.rigamortis.seppuku.impl.module.hidden;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.minecraft.EventKeyPress;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.value.Value;
import org.lwjgl.input.Keyboard;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
@ -12,6 +13,8 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
*/
public final class KeybindsModule extends Module {
public final Value<Boolean> f3Toggle = new Value<Boolean>("F3Toggle", new String[]{"f3"}, "If enabled you will not toggle modules if you also press f3.", true);
public KeybindsModule() {
super("Keybinds", new String[]{"Binds"}, "Allows you to bind modules to keys", "NONE", -1, ModuleType.HIDDEN);
this.setHidden(true);
@ -20,6 +23,7 @@ public final class KeybindsModule extends Module {
@Listener
public void keyPress(EventKeyPress event) {
if (f3Toggle.getValue() && Keyboard.isKeyDown(Keyboard.KEY_F3)) return;
for (Module mod : Seppuku.INSTANCE.getModuleManager().getModuleList()) {
if (mod != null) {
if (mod.getType() != ModuleType.HIDDEN && event.getKey() == Keyboard.getKeyIndex(mod.getKey()) && Keyboard.getKeyIndex(mod.getKey()) != Keyboard.KEY_NONE) {