Skip to content

Commit 24d7ebb

Browse files
committed
add SchedulerUtil
1 parent 0b62a4c commit 24d7ebb

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package me.hsgamer.bettergui.util;
2+
3+
import io.github.projectunified.minelib.scheduler.async.AsyncScheduler;
4+
import io.github.projectunified.minelib.scheduler.entity.EntityScheduler;
5+
import io.github.projectunified.minelib.scheduler.global.GlobalScheduler;
6+
import org.bukkit.entity.Entity;
7+
import org.bukkit.plugin.Plugin;
8+
import org.bukkit.plugin.java.JavaPlugin;
9+
10+
/**
11+
* The utility class for the scheduler
12+
*/
13+
public class SchedulerUtil {
14+
private static Plugin getProvidingPlugin() {
15+
return JavaPlugin.getProvidingPlugin(SchedulerUtil.class);
16+
}
17+
18+
/**
19+
* Get the global scheduler
20+
*
21+
* @return the global scheduler
22+
*/
23+
public static GlobalScheduler global() {
24+
return GlobalScheduler.get(getProvidingPlugin());
25+
}
26+
27+
/**
28+
* Get the async scheduler
29+
*
30+
* @return the async scheduler
31+
*/
32+
public static AsyncScheduler async() {
33+
return AsyncScheduler.get(getProvidingPlugin());
34+
}
35+
36+
/**
37+
* Get the entity scheduler
38+
*
39+
* @param entity the entity
40+
*
41+
* @return the entity scheduler
42+
*/
43+
public static EntityScheduler entity(Entity entity) {
44+
return EntityScheduler.get(getProvidingPlugin(), entity);
45+
}
46+
}

0 commit comments

Comments
 (0)