Add Plugin Chunk Ticket API

Allows plugins to force certain chunks to be kept loaded for as long as they are enabled.

By: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
CraftBukkit/Spigot
2019-07-08 12:14:16 +10:00
parent 09309c363f
commit aedce73dd1
6 changed files with 268 additions and 2 deletions

View File

@@ -9,15 +9,16 @@
public static final TicketType<Unit> START = a("start", (unit, unit1) -> {
return 0;
});
@@ -19,6 +19,7 @@
@@ -19,6 +19,8 @@
public static final TicketType<BlockPosition2D> PORTAL = a("portal", Comparator.comparingLong(BlockPosition2D::b));
public static final TicketType<Integer> POST_TELEPORT = a("post_teleport", Integer::compareTo, 5);
public static final TicketType<ChunkCoordIntPair> UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1);
+ public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit
+ public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // Craftbukkit
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {
return new TicketType<>(s, comparator, 0L);
@@ -45,4 +46,10 @@
@@ -45,4 +47,10 @@
public long b() {
return this.k;
}