Merge MoRanYue/FoliaFlow
This commit is contained in:
commit
a5172407b5
1 changed files with 9 additions and 5 deletions
|
|
@ -10,10 +10,11 @@ public class SchedulerUtil {
|
||||||
|
|
||||||
private static boolean tryFolia() {
|
private static boolean tryFolia() {
|
||||||
try {
|
try {
|
||||||
Bukkit.getAsyncScheduler();
|
Class.forName("io.papermc.paper.threadedregions.RegionizedServer");
|
||||||
return true;
|
return true;
|
||||||
} catch (Throwable ignored) {}
|
} catch (ClassNotFoundException e) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean isFolia() {
|
public static Boolean isFolia() {
|
||||||
|
|
@ -22,7 +23,10 @@ public class SchedulerUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runLaterEntity(Entity entity, Plugin plugin, Runnable runnable, int ticks) {
|
public static void runLaterEntity(Entity entity, Plugin plugin, Runnable runnable, int ticks) {
|
||||||
if (isFolia()) entity.getScheduler().runDelayed(plugin, (task) -> runnable.run(), null, ticks);
|
if (isFolia()) {
|
||||||
else Bukkit.getScheduler().runTaskLater(plugin, runnable, ticks);
|
entity.getScheduler().runDelayed(plugin, (task) -> runnable.run(), null, ticks);
|
||||||
|
} else {
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, runnable, ticks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue