public abstract class PluginTask<T> extends Task
getOwner() to get its owner.
An example for plugin create a task:
public class ExampleTask extends PluginTask<ExamplePlugin>{
public ExampleTask(ExamplePlugin plugin){
super(plugin);
}
@Override
public void onRun(int currentTick){
getOwner().getLogger().info("Task is executed in tick "+currentTick);
}
}
If you want Cloudburst to execute this task with delay or repeat, use ServerScheduler.
| Modifier and Type | Field and Description |
|---|---|
protected PluginContainer |
container |
protected T |
owner |
| Constructor and Description |
|---|
PluginTask(T owner)
Constructs a plugin-owned task.
|
| Modifier and Type | Method and Description |
|---|---|
PluginContainer |
getContainer() |
T |
getOwner()
Returns the owner of this task.
|
cancel, getHandler, getTaskId, onCancel, onRun, run, setHandlerprotected final T owner
protected final PluginContainer container
@Nonnull public final T getOwner()
@Nonnull public PluginContainer getContainer()
Copyright © 2020. All rights reserved.