Moved general purpose stuff into util, renamed utils->util

This commit is contained in:
ondra
2014-04-16 14:32:56 +02:00
parent e58156b7ee
commit 6843e746bc
208 changed files with 656 additions and 629 deletions
+51
View File
@@ -0,0 +1,51 @@
package mightypork.util.control;
/**
* Triggered action
*
* @author MightyPork
*/
public abstract class Action implements Runnable, Enableable {
private boolean enabled = true;
/**
* Enable the action
*
* @param enable true to enable
*/
@Override
public final void enable(boolean enable)
{
this.enabled = enable;
}
/**
* @return true if this action is enabled.
*/
@Override
public final boolean isEnabled()
{
return enabled;
}
/**
* Run the action, if it's enabled.
*/
@Override
public final void run()
{
if (enabled) execute();
}
/**
* Do the work.
*/
protected abstract void execute();
}