Package net.storm.api.plugins
Class PluginTask<T extends LoopedPlugin>
java.lang.Object
net.storm.api.plugins.PluginTask<T>
- Type Parameters:
T- the type of the parent plugin, must extendLoopedPlugin
- All Implemented Interfaces:
Task
Abstract base class for tasks that maintain a reference to their parent plugin.
PluginTask provides a convenient way to create tasks that need access to their parent plugin's state, configuration, or methods. The generic type parameter allows type-safe access to the specific plugin type.
Example usage:
public class CombatTask extends PluginTask<MyCombatPlugin> {
public CombatTask(MyCombatPlugin plugin) {
super(plugin);
}
@Override
public boolean validate() {
// Access plugin configuration through context
return getContext().getConfig().enableCombat();
}
@Override
public int execute() {
// Use plugin's helper methods
getContext().attackNearestEnemy();
return 600;
}
}
- See Also:
-
Constructor Details
-
PluginTask
public PluginTask()
-