Skip to content

Commit 812e261

Browse files
committed
Fix Folia throwing errors with <= 0 delay on enable
1 parent ea3046c commit 812e261

File tree

1 file changed

+2
-2
lines changed
  • commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi

1 file changed

+2
-2
lines changed

commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/Schedulers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public Schedulers(PaperImplementations paperImplementations) {
1212

1313
public int scheduleSyncRepeatingTask(Plugin plugin, Runnable runnable, long delay, long period) {
1414
if (paperImplementations.isFoliaPresent()) {
15-
plugin.getServer().getGlobalRegionScheduler().runAtFixedRate(plugin, task -> runnable.run(), delay, period);
15+
plugin.getServer().getGlobalRegionScheduler().runAtFixedRate(plugin, task -> runnable.run(), delay <= 0 ? 1 : delay, period);
1616
return 1;
1717
} else {
1818
return plugin.getServer().getScheduler().runTaskTimer(plugin, runnable, delay, period).getTaskId();
@@ -37,7 +37,7 @@ public void scheduleSync(Plugin plugin, Runnable runnable) {
3737

3838
public void scheduleSyncDelayed(Plugin plugin, Runnable runnable, long delay) {
3939
if (paperImplementations.isFoliaPresent()) {
40-
plugin.getServer().getGlobalRegionScheduler().runDelayed(plugin, task -> runnable.run(), delay);
40+
plugin.getServer().getGlobalRegionScheduler().runDelayed(plugin, task -> runnable.run(), delay <= 0 ? 1 : delay);
4141
} else {
4242
plugin.getServer().getScheduler().runTaskLater(plugin, runnable, delay);
4343
}

0 commit comments

Comments
 (0)