Skip to content

Commit 2e30572

Browse files
committed
Introduce shouldStop()
1 parent d365220 commit 2e30572

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/com/thistestuser/cursormacro/player/DefaultPlayer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ public boolean isRunning()
8080
return execution != null && execution.isAlive();
8181
}
8282

83+
@Override
84+
public boolean shouldStop()
85+
{
86+
return !playing;
87+
}
88+
8389
@Override
8490
public boolean hasInstructions()
8591
{

src/com/thistestuser/cursormacro/player/Player.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ public abstract class Player
3030
* Check if the thread has terminated yet. If this is true, nothing is allowed to be run.
3131
*/
3232
public abstract boolean isRunning();
33+
34+
/**
35+
* Returns if the execution should stop. This is used to exit from instructions that may run forever.
36+
*/
37+
public abstract boolean shouldStop();
3338

3439
public void registerMouse(boolean press, int button)
3540
{

src/com/thistestuser/cursormacro/player/custom/HotkeyPlayer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ public boolean isRunning()
6161
return execution != null && execution.isAlive();
6262
}
6363

64+
@Override
65+
public boolean shouldStop()
66+
{
67+
return !listening;
68+
}
69+
6470
public void activateKeyMacro(int keyCode)
6571
{
6672
if(!listening || isRunning())

0 commit comments

Comments
 (0)