Class RegistryParser<R extends org.bukkit.Keyed>

java.lang.Object
ch.njol.skript.classes.Parser<R>
ch.njol.skript.classes.registry.RegistryParser<R>
Type Parameters:
R - Registry class

public class RegistryParser<R extends org.bukkit.Keyed> extends Parser<R>
A parser based on a Registry used to parse data from a string or turn data into a string.
  • Constructor Details

    • RegistryParser

      public RegistryParser(org.bukkit.Registry<R> registry, String languageNode)
  • Method Details

    • parse

      @Nullable public R parse(String input, @NotNull @NotNull ParseContext context)
      This method attempts to match the string input against one of the string representations of the registry.
      Overrides:
      parse in class Parser<R extends org.bukkit.Keyed>
      Parameters:
      input - a string to attempt to match against one in the registry.
      context - of parsing, may not be null
      Returns:
      The registry object matching the input, or null if no match could be made.
    • toString

      @NotNull public @NotNull String toString(R object, int flags)
      This method returns the string representation of a registry.
      Specified by:
      toString in class Parser<R extends org.bukkit.Keyed>
      Parameters:
      object - The object to represent as a string.
      flags - not currently used
      Returns:
      A string representation of the registry object.
      See Also:
    • toVariableNameString

      @NotNull public @NotNull String toVariableNameString(R object)
      Returns a registry object's string representation in a variable name.
      Specified by:
      toVariableNameString in class Parser<R extends org.bukkit.Keyed>
      Parameters:
      object - Object to represent in a variable name.
      Returns:
      The given object's representation in a variable name.
    • getAllNames

      public String getAllNames()
      Returns:
      A comma-separated string containing a list of all names representing the registry. Note that some entries may represent the same registry object.