Class TagSource<T extends org.bukkit.Keyed>

java.lang.Object
org.skriptlang.skript.bukkit.tags.sources.TagSource<T>
Type Parameters:
T - The type of tags this source will return. For example, the Bukkit "items" tag registry would return Materials.
Direct Known Subclasses:
BukkitTagSource, CustomTagSource

public abstract class TagSource<T extends org.bukkit.Keyed> extends Object
A source for Tags, be it Bukkit's tag registries, Paper's handmade tags, or custom tags made by the user.
  • Constructor Details

    • TagSource

      @SafeVarargs protected TagSource(TagOrigin origin, TagType<T>... types)
      Parameters:
      origin - The origin of this source.
      types - The tag types this source represents.
  • Method Details

    • getAllTags

      public abstract Iterable<org.bukkit.Tag<T>> getAllTags()
      Returns:
      All the tags associated with this source.
    • getAllTagsMatching

      public Iterable<org.bukkit.Tag<T>> getAllTagsMatching(Predicate<org.bukkit.Tag<T>> predicate)
      For use in getting specific subsets of tags.
      Parameters:
      predicate - A Predicate used to filter tags.
      Returns:
      All the tags from this source, filtered based on the predicate.
    • getTag

      @Nullable public abstract @Nullable org.bukkit.Tag<T> getTag(org.bukkit.NamespacedKey key)
      Gets a specific tag by the key.
      Parameters:
      key - The key to use to find the tag.
      Returns:
      The tag associated with the key. Null if no such tag exists.
    • getTypes

      public TagType<T>[] getTypes()
      Returns:
      All the tag types that are represented by this source.
    • getOrigin

      public TagOrigin getOrigin()
      Returns:
      The origin of this source.