You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
464 B
37 lines
464 B
package mightypork.gamecore.input;
|
|
|
|
|
|
/**
|
|
* Triggered action
|
|
*
|
|
* @author MightyPork
|
|
*/
|
|
public abstract class Action implements Runnable {
|
|
|
|
private boolean enabled = true;
|
|
|
|
|
|
/**
|
|
* Enable the action
|
|
*
|
|
* @param enable true to enable
|
|
*/
|
|
public final void enable(boolean enable)
|
|
{
|
|
this.enabled = enable;
|
|
}
|
|
|
|
|
|
@Override
|
|
public final void run()
|
|
{
|
|
if (enabled) execute();
|
|
}
|
|
|
|
|
|
/**
|
|
* Do the work.
|
|
*/
|
|
public abstract void execute();
|
|
|
|
}
|
|
|