Class GameModeParser

java.lang.Object
com.ultikits.ultitools.abstracts.command.parser.GameModeParser
All Implemented Interfaces:
TypeParser<org.bukkit.GameMode>

public class GameModeParser extends Object implements TypeParser<org.bukkit.GameMode>
Type parser for Bukkit GameMode. Supports parsing by name (SURVIVAL, CREATIVE, etc.) or number (0, 1, 2, 3).
Since:
6.2.0
  • Constructor Details

    • GameModeParser

      public GameModeParser()
  • Method Details

    • getPrimaryType

      public Class<org.bukkit.GameMode> getPrimaryType()
      Description copied from interface: TypeParser
      Gets the primary type this parser handles.
      Specified by:
      getPrimaryType in interface TypeParser<org.bukkit.GameMode>
      Returns:
      the primary type class
    • getSupportedTypes

      public List<Class<?>> getSupportedTypes()
      Description copied from interface: TypeParser
      Gets all types this parser can handle, including array types.
      Specified by:
      getSupportedTypes in interface TypeParser<org.bukkit.GameMode>
      Returns:
      list of supported types
    • parse

      public org.bukkit.GameMode parse(String value) throws TypeParseException
      Description copied from interface: TypeParser
      Parses a string value into the target type.
      Specified by:
      parse in interface TypeParser<org.bukkit.GameMode>
      Parameters:
      value - the string value to parse
      Returns:
      the parsed value, or null if parsing fails
      Throws:
      TypeParseException - if parsing fails with an error
    • parseArray

      public org.bukkit.GameMode[] parseArray(String[] values) throws TypeParseException
      Description copied from interface: TypeParser
      Parses multiple string values into an array of the target type. Default implementation calls parse() for each value.
      Specified by:
      parseArray in interface TypeParser<org.bukkit.GameMode>
      Parameters:
      values - the string values to parse
      Returns:
      the parsed array
      Throws:
      TypeParseException - if parsing fails with an error