java.lang.Object
nl.pim16aap2.animatedarchitecture.spigot.util.SpigotUtil

public final class SpigotUtil extends Object
Represents various small and Spigot-specific utility functions.
  • Method Details

    • durationToTicks

      public static long durationToTicks(Duration duration)
      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

      public static org.bukkit.ChatColor toBukkitColor(Color pColor)
      Gets the bukkit version of a Color.
      Parameters:
      pColor - The Color.
      Returns:
      The bukkit version of the Color.
    • 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 message
      msg - The message to be sent.
    • getBukkitFace

      public static org.bukkit.block.BlockFace getBukkitFace(BlockFace blockFace)
      Get the BlockFace parallel to the given BlockFace.
      Parameters:
      blockFace - BlockFace that will be converted.
      Returns:
      The parallel BlockFace.
    • getBlockFace

      public static BlockFace getBlockFace(org.bukkit.block.BlockFace blockFace)
      Get the BlockFace parallel to the given BlockFace.
      Parameters:
      blockFace - BlockFace that will be converted.
      Returns:
      The parallel BlockFace.
    • messagePlayer

      public static void messagePlayer(org.bukkit.entity.Player player, String msg)
      Send a white message to a player.
      Parameters:
      player - Player to receive the message.
      msg - The message.
    • getPermissionSuffixValue

      public static OptionalInt getPermissionSuffixValue(String permissionNode, String permissionBase)
      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 OptionalInt if none could be found.
    • isPrintDebugMessages

      public static boolean isPrintDebugMessages()
    • setPrintDebugMessages

      public static void setPrintDebugMessages(boolean printDebugMessages)