Class WbsEnums

java.lang.Object
wbs.utils.util.WbsEnums

public final class WbsEnums extends Object
Enum-related utilities, including for configuration and rendering.
  • Method Details

    • joiningPrettyStrings

      public static String joiningPrettyStrings(Class<? extends Enum<?>> type)
    • joiningPrettyStrings

      public static String joiningPrettyStrings(Class<? extends Enum<?>> type, String delimiter)
    • toPrettyString

      public static String toPrettyString(Enum<?> enumConstant)
    • toStringArray

      public static String[] toStringArray(Class<? extends Enum<?>> type)
      Get all enum constants in a string array entirely in lower case.
      Parameters:
      type - The enum class to convert
      Returns:
      An array of strings representing each enum constant
    • toStringList

      public static List<String> toStringList(Class<? extends Enum<?>> type)
      Same as toStringArray(Class) but as a List
    • getEnumFromString

      public static <T extends Enum<T>> T getEnumFromString(Class<T> clazz, String string)
      A common method for all enums since they can't have another base class
      Type Parameters:
      T - Enum type
      Parameters:
      clazz - Enum class
      string - The string that represents the value of the enum to return
      Returns:
      corresponding enum, or null
    • soundFromString

      public static org.bukkit.Sound soundFromString(String from)
      Converts from a string to a Sound Enum.
      Parameters:
      from - The string to convert
      Returns:
      The Sound enum. Returns null if the string could not be parsed.
    • gameModeFromString

      public static org.bukkit.GameMode gameModeFromString(String from)
      Converts from a string to a GameMode Enum.
      Parameters:
      from - The string to convert
      Returns:
      The GameMode enum. Returns null if the string could not be parsed.
    • particleFromString

      public static org.bukkit.Particle particleFromString(String from)
      Converts from a string to a Particle Enum.
      Parameters:
      from - The string to convert
      Returns:
      The Particle enum. Returns null if the string could not be parsed.
    • materialFromString

      public static org.bukkit.Material materialFromString(String from)
      Same as toStringArray(Class) but returns null if not found.
    • materialFromString

      public static org.bukkit.Material materialFromString(String from, org.bukkit.Material defaultMaterial)
      Converts from a string to a Material Enum.
      Parameters:
      from - The string to convert
      defaultMaterial - The default if the string could not be parsed.
      Returns:
      The Material enum. Returns defaultMaterial if the string could not be parsed.