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 org.cloudburstmc.api.plugin.PluginContainer |
container |
protected T |
owner |
| Constructor and Description |
|---|
PluginTask(T owner)
Constructs a plugin-owned task.
|
| Modifier and Type | Method and Description |
|---|---|
org.cloudburstmc.api.plugin.PluginContainer |
getContainer() |
T |
getOwner()
Returns the owner of this task.
|
cancel, getHandler, getTaskId, onCancel, onRun, run, setHandlerprotected final T owner
protected final org.cloudburstmc.api.plugin.PluginContainer container
Copyright © 2021. All rights reserved.