name(@NonNull String name);
+ Builder persists(boolean persists);
/**
- * Sets the {@link Comparator comparator} used by requested {@link Ticket tickets}
- * of this type used to determine the appropriate ticket to be used during collisions.
- *
- * If this call is omitted, it is up to the implementation on how the comparison is handled.
- * In the official implementation, the resulting comparison value is '0'.
+ * @param loadsChunks Whether tickets of this type will load chunks.
+ * @return This builder, for chaining
+ */
+ Builder loadsChunks(boolean loadsChunks);
+
+ /**
+ * @param simulatesChunks Whether tickets of this type will cause chunks to update their blocks and entities.
+ * @return This builder, for chaining
+ */
+ Builder simulatesChunks(boolean simulatesChunks);
+
+ /**
+ * Sets whether tickets of this type keeps the world active.
+ * The world may stop processing after being inactive for a certain amount of time.
*
- * @param comparator The comparator
- * @return The builder, for chaining
+ * @param keepsWorldActive Whether tickets of this type keeps the world active.
+ * @return This builder, for chaining
+ */
+ Builder keepsWorldActive(boolean keepsWorldActive);
+
+ /**
+ * @param canExpireIfUnloaded Whether tickets of this type count down their remaining ticks even their chunks are not loaded.
+ * @return This builder, for chaining
*/
- Builder comparator(@Nullable Comparator comparator);
+ Builder canExpireIfUnloaded(boolean canExpireIfUnloaded);
/**
* Sets the lifetime of the {@link TicketType type}.
@@ -89,13 +118,13 @@ interface Builder extends ResettableBuilder> {
* @param lifetime The lifetime
* @return The builder, for chaining
*/
- Builder lifetime(Ticks lifetime);
+ Builder lifetime(Ticks lifetime);
/**
* Builds a new {@link TicketType type}.
*
* @return The type
*/
- TicketType build();
+ TicketType build();
}
}
diff --git a/src/main/java/org/spongepowered/api/world/server/TicketTypes.java b/src/main/java/org/spongepowered/api/world/server/TicketTypes.java
new file mode 100644
index 00000000000..bb6fff8aac4
--- /dev/null
+++ b/src/main/java/org/spongepowered/api/world/server/TicketTypes.java
@@ -0,0 +1,71 @@
+/*
+ * This file is part of SpongeAPI, licensed under the MIT License (MIT).
+ *
+ * Copyright (c) SpongePowered
+ * Copyright (c) contributors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package org.spongepowered.api.world.server;
+
+import org.spongepowered.api.ResourceKey;
+import org.spongepowered.api.Sponge;
+import org.spongepowered.api.registry.DefaultedRegistryReference;
+import org.spongepowered.api.registry.Registry;
+import org.spongepowered.api.registry.RegistryKey;
+import org.spongepowered.api.registry.RegistryScope;
+import org.spongepowered.api.registry.RegistryScopes;
+import org.spongepowered.api.registry.RegistryTypes;
+
+/**
+ *
+ */
+@SuppressWarnings("unused")
+@RegistryScopes(scopes = RegistryScope.GAME)
+public final class TicketTypes {
+
+ public static final DefaultedRegistryReference DRAGON = TicketTypes.key(ResourceKey.minecraft("dragon"));
+
+ public static final DefaultedRegistryReference ENDER_PEARL = TicketTypes.key(ResourceKey.minecraft("ender_pearl"));
+
+ public static final DefaultedRegistryReference FORCED = TicketTypes.key(ResourceKey.minecraft("forced"));
+
+ public static final DefaultedRegistryReference PLAYER_LOADING = TicketTypes.key(ResourceKey.minecraft("player_loading"));
+
+ public static final DefaultedRegistryReference PLAYER_SIMULATION = TicketTypes.key(ResourceKey.minecraft("player_simulation"));
+
+ public static final DefaultedRegistryReference PLAYER_SPAWN = TicketTypes.key(ResourceKey.minecraft("player_spawn"));
+
+ public static final DefaultedRegistryReference PORTAL = TicketTypes.key(ResourceKey.minecraft("portal"));
+
+ public static final DefaultedRegistryReference SPAWN_SEARCH = TicketTypes.key(ResourceKey.minecraft("spawn_search"));
+
+ public static final DefaultedRegistryReference UNKNOWN = TicketTypes.key(ResourceKey.minecraft("unknown"));
+
+ private TicketTypes() {
+ }
+
+ public static Registry registry() {
+ return Sponge.game().registry(RegistryTypes.TICKET_TYPE);
+ }
+
+ private static DefaultedRegistryReference key(final ResourceKey location) {
+ return RegistryKey.of(RegistryTypes.TICKET_TYPE, location).asDefaultedReference(Sponge::game);
+ }
+}