I'm trying to create a runnable that will test to see if you're dead (health below 1) and if you are dead, then it will stop the runnable. If you aren't it will keep going. But I can't find a way to stop the runnable. Is there any way to stop the runnable within the runnable with a script?
Note that the runnable is being run through a thread:
Thread thread1 = new Thread(runnableName);
thread1.start();
Runnable Example:
Runnable r1 = new Runnable() {
public void run() {
while (true) {
if (health < 1) {
// How do i stop the runnable?
}
}
}
}