-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathSchedulerAdapter.java
More file actions
95 lines (85 loc) · 3.5 KB
/
SchedulerAdapter.java
File metadata and controls
95 lines (85 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package de.rapha149.signgui.scheduler;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.Nullable;
/**
* Adapter interface for scheduling tasks across different server implementations.
* Supports both Bukkit/Paper and Folia schedulers.
*/
public interface SchedulerAdapter {
/**
* Runs a task on the next server tick (main thread for Bukkit, global region for Folia).
*
* @param plugin the plugin owning this task
* @param runnable the task to execute
*/
void runNextTick(Plugin plugin, Runnable runnable);
/**
* Runs a task after a delay (main thread for Bukkit, global region for Folia).
*
* @param plugin the plugin owning this task
* @param runnable the task to execute
* @param delayTicks the delay in ticks before execution
*/
void runNextTick(Plugin plugin, Runnable runnable, long delayTicks);
/**
* Runs a task asynchronously.
*
* @param plugin the plugin owning this task
* @param runnable the task to execute
*/
void runAsync(Plugin plugin, Runnable runnable);
/**
* Runs a task asynchronously after a delay.
*
* @param plugin the plugin owning this task
* @param runnable the task to execute
* @param delayTicks the delay in ticks before execution
*/
void runAsync(Plugin plugin, Runnable runnable, long delayTicks);
/**
* Runs a task on the thread that owns the given entity.
* On Bukkit, this runs on the main thread.
* On Folia, this runs on the entity's region thread.
*
* @param plugin the plugin owning this task
* @param entity the entity to run the task for
* @param runnable the task to execute
* @param retired called if the entity is removed before the task executes (may be null)
*/
void runAtEntity(Plugin plugin, Entity entity, Runnable runnable, @Nullable Runnable retired);
/**
* Runs a task on the thread that owns the given entity after a delay.
* On Bukkit, this runs on the main thread.
* On Folia, this runs on the entity's region thread.
*
* @param plugin the plugin owning this task
* @param entity the entity to run the task for
* @param runnable the task to execute
* @param retired called if the entity is removed before the task executes (may be null)
* @param delayTicks the delay in ticks before execution
*/
void runAtEntity(Plugin plugin, Entity entity, Runnable runnable, @Nullable Runnable retired, long delayTicks);
/**
* Runs a task on the thread that owns the given location.
* On Bukkit, this runs on the main thread.
* On Folia, this runs on the region thread that owns the location.
*
* @param plugin the plugin owning this task
* @param location the location to run the task at
* @param runnable the task to execute
*/
void runAtLocation(Plugin plugin, Location location, Runnable runnable);
/**
* Runs a task on the thread that owns the given location after a delay.
* On Bukkit, this runs on the main thread.
* On Folia, this runs on the region thread that owns the location.
*
* @param plugin the plugin owning this task
* @param location the location to run the task at
* @param runnable the task to execute
* @param delayTicks the delay in ticks before execution
*/
void runAtLocation(Plugin plugin, Location location, Runnable runnable, long delayTicks);
}