File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/main/java/meteordevelopment/meteorclient/commands/commands Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ public InputCommand() {
4848 public void build (LiteralArgumentBuilder <CommandSource > builder ) {
4949 for (Pair <KeyBinding , String > keyBinding : holdKeys ) {
5050 builder .then (literal (keyBinding .getSecond ())
51+ .executes (context -> {
52+ activeHandlers .add (new KeypressHandler (keyBinding .getFirst (), 1 ));
53+ return SINGLE_SUCCESS ;
54+ })
5155 .then (argument ("ticks" , IntegerArgumentType .integer (1 ))
5256 .executes (context -> {
5357 activeHandlers .add (new KeypressHandler (keyBinding .getFirst (), context .getArgument ("ticks" , Integer .class )));
@@ -129,8 +133,11 @@ public KeypressHandler(KeyBinding key, int ticks) {
129133
130134 @ EventHandler
131135 private void onTick (TickEvent .Post event ) {
132- if (ticks -- > 0 ) key .setPressed (true );
133- else {
136+ if (ticks == totalTicks ) press (key );
137+
138+ if (ticks -- > 0 ) {
139+ key .setPressed (true );
140+ } else {
134141 key .setPressed (false );
135142 MeteorClient .EVENT_BUS .unsubscribe (this );
136143 activeHandlers .remove (this );
You can’t perform that action at this time.
0 commit comments