Class SpigotUtil
java.lang.Object
nl.pim16aap2.animatedarchitecture.spigot.util.SpigotUtil
Represents various small and Spigot-specific utility functions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic longdurationToTicks(Duration duration) Gets the number of ticks required to cover a duration.static BlockFacegetBlockFace(org.bukkit.block.BlockFace blockFace) Get theBlockFaceparallel to the givenBlockFace.static org.bukkit.block.BlockFacegetBukkitFace(BlockFace blockFace) Get theBlockFaceparallel to the givenBlockFace.static OptionalIntgetHighestPermissionSuffix(org.bukkit.entity.Player player, String permissionBase) Retrieves the highest integer value of a specific permission node, if it exists.static OptionalIntgetPermissionSuffixValue(String permissionNode, String permissionBase) Retrieves the integer value suffix of a specific permission node, if it exists.static booleanstatic voidmessagePlayer(org.bukkit.entity.Player player, String msg) Send a white message to a player.static voidmessagePlayer(org.bukkit.entity.Player player, org.bukkit.ChatColor color, String msg) Send a colored message to a specific player.static voidsetPrintDebugMessages(boolean printDebugMessages) static org.bukkit.ChatColortoBukkitColor(Color pColor) Gets the bukkit version of aColor.
-
Method Details
-
durationToTicks
Gets the number of ticks required to cover a duration.For example, given a tick duration of 50ms, any duration > 0 ms and <= 50ms will return 1 tick.
If the duration is negative or zero, 0 is returned.
- Parameters:
duration- The duration.- Returns:
- The number of ticks required to cover the duration.
-
toBukkitColor
Gets the bukkit version of aColor. -
messagePlayer
public static void messagePlayer(org.bukkit.entity.Player player, org.bukkit.ChatColor color, String msg) Send a colored message to a specific player.- Parameters:
player- The player that will receive the message.color- Color of the messagemsg- The message to be sent.
-
getBukkitFace
Get theBlockFaceparallel to the givenBlockFace.- Parameters:
blockFace-BlockFacethat will be converted.- Returns:
- The parallel
BlockFace.
-
getBlockFace
Get theBlockFaceparallel to the givenBlockFace.- Parameters:
blockFace-BlockFacethat will be converted.- Returns:
- The parallel
BlockFace.
-
messagePlayer
Send a white message to a player.- Parameters:
player- Player to receive the message.msg- The message.
-
getPermissionSuffixValue
Retrieves the integer value suffix of a specific permission node, if it exists.For example, if the permission node is "
example.permission.10" and the permission base is "example.permission.", then this method would return "10".- Parameters:
permissionNode- The permission node to analyze.permissionBase- The base permission node to find the suffix for. E.g. "example.permission.".- Returns:
- The integer suffix or -1 if none could be found.
-
getHighestPermissionSuffix
public static OptionalInt getHighestPermissionSuffix(org.bukkit.entity.Player player, String permissionBase) Retrieves the highest integer value of a specific permission node, if it exists.E.g., if a player has two permission nodes: "
example.permission.10" and "example.permission.20", then this method would return "20" for a permission base of "example.permission.".- Parameters:
player- The player whose permissions to analyze.permissionBase- The base permission node to find the suffix for. E.g. "example.permission.".- Returns:
- The highest integer suffix or an empty
OptionalIntif none could be found.
-
isPrintDebugMessages
public static boolean isPrintDebugMessages() -
setPrintDebugMessages
public static void setPrintDebugMessages(boolean printDebugMessages)
-