Package net.citizensnpcs.api.util
Class SpigotUtil
java.lang.Object
net.citizensnpcs.api.util.SpigotUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSpigot has changed InventoryViews to be an abstract class instead of an interface necessitating an abstraction over the existing API to avoid java runtime errors. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckYSafe(double y, World world) static NamespacedKeystatic NamespacedKeystatic intgetMaxNameLength(EntityType type) static int[]static booleanstatic booleanisRegistryKeyed(Class<?> clazz) static booleanstatic DurationparseDuration(String raw, TimeUnit defaultUnits) static ItemStackparseItemStack(ItemStack base, String item) static intparseTicks(String raw) Parses a duration string and returns the number of ticks.static CompletableFuture<Boolean> teleportAsync(Entity entity, Location location) static CompletableFuture<Boolean> teleportAsync(Entity entity, Location location, PlayerTeleportEvent.TeleportCause cause) static intConverts a Duration to Minecraft ticks (20 ticks per second).
-
Constructor Details
-
SpigotUtil
public SpigotUtil()
-
-
Method Details
-
checkYSafe
-
getKey
-
getKey
-
getMaxNameLength
-
getVersion
public static int[] getVersion() -
isFoliaServer
public static boolean isFoliaServer() -
isRegistryKeyed
-
isUsing1_13API
public static boolean isUsing1_13API() -
parseDuration
-
parseItemStack
-
parseTicks
Parses a duration string and returns the number of ticks. Supports formats like "5s", "10m", "100t", or plain numbers (interpreted as ticks).- Parameters:
raw- the duration string to parse- Returns:
- the number of ticks, or -1 if parsing fails
-
teleportAsync
-
teleportAsync
public static CompletableFuture<Boolean> teleportAsync(Entity entity, Location location, PlayerTeleportEvent.TeleportCause cause) -
toTicks
Converts a Duration to Minecraft ticks (20 ticks per second).- Parameters:
duration- the duration to convert- Returns:
- the number of ticks
-