Class TagType<T extends org.bukkit.Keyed>

java.lang.Object
org.skriptlang.skript.bukkit.tags.TagType<T>
Type Parameters:
T - see type.

public class TagType<T extends org.bukkit.Keyed> extends Object
The type of a tag. Represents a category or context that the tags apply in. For example, ITEMS tags apply to Materials, like BLOCKS, but in item form rather than as placed blocks.
This class also contains a static registry of all tag types.
  • Field Details

    • ITEMS

      public static final TagType<org.bukkit.Material> ITEMS
    • BLOCKS

      public static final TagType<org.bukkit.Material> BLOCKS
    • ENTITIES

      public static final TagType<org.bukkit.entity.EntityType> ENTITIES
  • Constructor Details

    • TagType

      public TagType(String pattern, Class<T> type)
      Parameters:
      pattern - The pattern to use when constructing the selection Skript pattern.
      type - The class this tag type applies to.
    • TagType

      public TagType(String pattern, String toString, Class<T> type)
      Parameters:
      pattern - The pattern to use when constructing the selection Skript pattern.
      toString - The string to use when printing a toString.
      type - The class this tag type applies to.
  • Method Details

    • pattern

      public String pattern()
    • type

      public Class<T> type()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addType

      public static void addType(TagType<?>... type)
      Adds types to the registered tag types.
      Parameters:
      type - The types to add.
    • getTypes

      @Contract(pure=true) @NotNull public static @NotNull @UnmodifiableView List<TagType<?>> getTypes()
      Returns:
      An unmodifiable list of all the registered types.
    • getType

      public static TagType<?> @NotNull [] getType(int i)
      Gets tag types by index. If a negative value is used, gets all the tag types.
      Parameters:
      i - The index of the type to get.
      Returns:
      The type at that index, or all tags if index invalid input: '<' 0.
    • fromParseMark

      public static TagType<?> @NotNull [] fromParseMark(int i)
      Gets tag types by parser mark. Equivalent to getType(i - 1).
      Parameters:
      i - The index of the type to get.
      Returns:
      The type at that index, or all tags if index invalid input: '<' 0.
      See Also:
    • getFullPattern

      @NotNull public static @NotNull String getFullPattern()
      Returns:
      Returns an optional choice pattern for use in Skript patterns. Contains parse marks. Pass the parse mark to fromParseMark(int) to get the selected tag type in SyntaxElement.init(Expression[], int, Kleenean, SkriptParser.ParseResult).
    • getFullPattern

      @NotNull public static @NotNull String getFullPattern(boolean required)
      Parameters:
      required - whether the choice should be optional or required.
      Returns:
      Returns a choice pattern for use in Skript patterns. Contains parse marks. Pass the parse mark to fromParseMark(int) to get the selected tag type in SyntaxElement.init(Expression[], int, Kleenean, SkriptParser.ParseResult).