diff --git a/paper-api/src/main/java/io/papermc/paper/registry/set/RegistryKeySet.java b/paper-api/src/main/java/io/papermc/paper/registry/set/RegistryKeySet.java index d5a5e332ab..e383014a7f 100644 --- a/paper-api/src/main/java/io/papermc/paper/registry/set/RegistryKeySet.java +++ b/paper-api/src/main/java/io/papermc/paper/registry/set/RegistryKeySet.java @@ -3,6 +3,7 @@ package io.papermc.paper.registry.set; import io.papermc.paper.registry.TypedKey; import java.util.Collection; import java.util.Iterator; +import io.papermc.paper.registry.tag.TagKey; import org.bukkit.Keyed; import org.bukkit.Registry; import org.jetbrains.annotations.ApiStatus; @@ -33,6 +34,7 @@ public non-sealed interface RegistryKeySet extends Iterable resolve(final Registry registry); diff --git a/paper-api/src/main/java/org/bukkit/Registry.java b/paper-api/src/main/java/org/bukkit/Registry.java index b64fdfe979..e882045d19 100644 --- a/paper-api/src/main/java/org/bukkit/Registry.java +++ b/paper-api/src/main/java/org/bukkit/Registry.java @@ -491,10 +491,27 @@ public interface Registry extends Iterable { * @throws NoSuchElementException if no tag with the given key is found * @throws UnsupportedOperationException if this registry doesn't have or support tags * @see #hasTag(TagKey) + * @see #getTagValues(TagKey) */ @ApiStatus.Experimental Tag getTag(TagKey key); + /** + * Gets the named registry set (tag) for the given key and resolves it with this registry. + * + * @param key the key to get the tag for + * @return the resolved values + * @throws NoSuchElementException if no tag with the given key is found + * @throws UnsupportedOperationException if this registry doesn't have or support tags + * @see #getTag(TagKey) + * @see Tag#resolve(Registry) + */ + @ApiStatus.Experimental + default Collection getTagValues(TagKey key) { + Tag tag = getTag(key); + return tag.resolve(this); + } + /** * Gets all the tags in this registry. *