diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/InputCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/InputCommand.java index e453767910..ae4fc9ad57 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/InputCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/InputCommand.java @@ -48,6 +48,10 @@ public InputCommand() { public void build(LiteralArgumentBuilder builder) { for (Pair keyBinding : holdKeys) { builder.then(literal(keyBinding.getSecond()) + .executes(context -> { + activeHandlers.add(new KeypressHandler(keyBinding.getFirst(), 1)); + return SINGLE_SUCCESS; + }) .then(argument("ticks", IntegerArgumentType.integer(1)) .executes(context -> { activeHandlers.add(new KeypressHandler(keyBinding.getFirst(), context.getArgument("ticks", Integer.class))); @@ -129,8 +133,11 @@ public KeypressHandler(KeyBinding key, int ticks) { @EventHandler private void onTick(TickEvent.Post event) { - if (ticks-- > 0) key.setPressed(true); - else { + if (ticks == totalTicks) press(key); + + if (ticks-- > 0) { + key.setPressed(true); + } else { key.setPressed(false); MeteorClient.EVENT_BUS.unsubscribe(this); activeHandlers.remove(this);