Folia scheduler and owned region API

Pulling Folia API to Paper is primarily intended for plugins
that want to target both Paper and Folia without unnecessary
compatibility layers.

Add both a location based scheduler, an entity based scheduler,
and a global region scheduler.

Owned region API may be useful for plugins which want to perform
operations over large areas outside of the buffer zone provided
by the regionaliser, as it is not guaranteed that anything
outside of the buffer zone is owned. Then, the plugins may use
the schedulers depending on the result of the ownership check.
This commit is contained in:
Spottedleaf
2023-06-17 11:52:41 +02:00
parent fa0ad8f494
commit 7920d9020b
8 changed files with 755 additions and 0 deletions

View File

@ -1101,4 +1101,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
// Paper end - Collision API
// Paper start - Folia schedulers
/**
* Returns the task scheduler for this entity. The entity scheduler can be used to schedule tasks
* that are guaranteed to always execute on the tick thread that owns the entity.
* <p><b>If you do not need/want to make your plugin run on Folia, use {@link org.bukkit.Server#getScheduler()} instead.</b></p>
* @return the task scheduler for this entity.
* @see io.papermc.paper.threadedregions.scheduler.EntityScheduler
*/
@NotNull io.papermc.paper.threadedregions.scheduler.EntityScheduler getScheduler();
// Paper end - Folia schedulers
}