88import com .tcoded .folialib .wrapper .task .WrappedTask ;
99import io .papermc .paper .threadedregions .scheduler .AsyncScheduler ;
1010import io .papermc .paper .threadedregions .scheduler .GlobalRegionScheduler ;
11+ import io .papermc .paper .threadedregions .scheduler .RegionScheduler ;
1112import io .papermc .paper .threadedregions .scheduler .ScheduledTask ;
1213import it .unimi .dsi .fastutil .longs .Long2ObjectOpenHashMap ;
1314import org .bukkit .Location ;
@@ -35,11 +36,13 @@ public class FoliaImplementation implements PlatformScheduler {
3536
3637 private final Plugin plugin ;
3738 private final GlobalRegionScheduler globalRegionScheduler ;
39+ private final RegionScheduler regionScheduler ;
3840 private final AsyncScheduler asyncScheduler ;
3941
4042 public FoliaImplementation (FoliaLib foliaLib ) {
4143 this .plugin = foliaLib .getPlugin ();
4244 this .globalRegionScheduler = plugin .getServer ().getGlobalRegionScheduler ();
45+ this .regionScheduler = plugin .getServer ().getRegionScheduler ();
4346 this .asyncScheduler = plugin .getServer ().getAsyncScheduler ();
4447 }
4548
@@ -234,7 +237,7 @@ public void runTimerAsync(@NotNull Consumer<WrappedTask> consumer, long delay, l
234237 public @ NotNull CompletableFuture <Void > runAtLocation (Location location , @ NotNull Consumer <WrappedTask > consumer ) {
235238 CompletableFuture <Void > future = new CompletableFuture <>();
236239
237- this .plugin . getServer (). getRegionScheduler () .run (plugin , location , task -> {
240+ this .regionScheduler .run (plugin , location , task -> {
238241 consumer .accept (this .wrapTask (task ));
239242 future .complete (null );
240243 });
@@ -249,7 +252,7 @@ public WrappedTask runAtLocationLater(Location location, @NotNull Runnable runna
249252 delay = 1 ;
250253 }
251254 return this .wrapTask (
252- this .plugin . getServer (). getRegionScheduler () .runDelayed (plugin , location , task -> runnable .run (), delay )
255+ this .regionScheduler .runDelayed (plugin , location , task -> runnable .run (), delay )
253256 );
254257 }
255258
@@ -261,7 +264,7 @@ public WrappedTask runAtLocationLater(Location location, @NotNull Runnable runna
261264 InvalidTickDelayNotifier .notifyOnce (plugin .getLogger (), delay );
262265 delay = 1 ;
263266 }
264- this .plugin . getServer (). getRegionScheduler () .runDelayed (plugin , location , task -> {
267+ this .regionScheduler .runDelayed (plugin , location , task -> {
265268 consumer .accept (this .wrapTask (task ));
266269 future .complete (null );
267270 }, delay );
@@ -290,7 +293,7 @@ public WrappedTask runAtLocationTimer(Location location, @NotNull Runnable runna
290293 period = 1 ;
291294 }
292295 return this .wrapTask (
293- this .plugin . getServer (). getRegionScheduler () .runAtFixedRate (plugin , location , task -> runnable .run (), delay , period )
296+ this .regionScheduler .runAtFixedRate (plugin , location , task -> runnable .run (), delay , period )
294297 );
295298 }
296299
@@ -304,7 +307,7 @@ public void runAtLocationTimer(Location location, @NotNull Consumer<WrappedTask>
304307 InvalidTickDelayNotifier .notifyOnce (plugin .getLogger (), period );
305308 period = 1 ;
306309 }
307- this .plugin . getServer (). getRegionScheduler () .runAtFixedRate (plugin , location , task -> consumer .accept (this .wrapTask (task )), delay , period );
310+ this .regionScheduler .runAtFixedRate (plugin , location , task -> consumer .accept (this .wrapTask (task )), delay , period );
308311 }
309312
310313 @ Override
0 commit comments