From 15757b3892325aa63e526407e90ff0654e0d84cd Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sun, 17 Feb 2019 12:59:39 +1000 Subject: [PATCH] Added a method to get a list of tags By: Matthew Miller --- paper-api/src/main/java/org/bukkit/Bukkit.java | 17 +++++++++++++++++ paper-api/src/main/java/org/bukkit/Server.java | 15 +++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/Bukkit.java b/paper-api/src/main/java/org/bukkit/Bukkit.java index f47ba0e22a..055c323d1a 100644 --- a/paper-api/src/main/java/org/bukkit/Bukkit.java +++ b/paper-api/src/main/java/org/bukkit/Bukkit.java @@ -1374,6 +1374,23 @@ public final class Bukkit { return server.getTag(registry, tag, clazz); } + /** + * Gets a all tags which have been defined within the server. + *
+ * Server implementations are allowed to handle only the registries + * indicated in {@link Tag}. + *
+ * No guarantees are made about the mutability of the returned iterator. + * + * @param type of the tag + * @param registry the tag registry to look at + * @param clazz the class of the tag entries + * @return all defined tags + */ + public static Iterable> getTags(String registry, Class clazz) { + return server.getTags(registry, clazz); + } + /** * Gets the specified {@link LootTable}. * diff --git a/paper-api/src/main/java/org/bukkit/Server.java b/paper-api/src/main/java/org/bukkit/Server.java index 29ae7da768..22352f7aea 100644 --- a/paper-api/src/main/java/org/bukkit/Server.java +++ b/paper-api/src/main/java/org/bukkit/Server.java @@ -1145,6 +1145,21 @@ public interface Server extends PluginMessageRecipient { */ Tag getTag(String registry, NamespacedKey tag, Class clazz); + /** + * Gets a all tags which have been defined within the server. + *
+ * Server implementations are allowed to handle only the registries + * indicated in {@link Tag}. + *
+ * No guarantees are made about the mutability of the returned iterator. + * + * @param type of the tag + * @param registry the tag registry to look at + * @param clazz the class of the tag entries + * @return all defined tags + */ + Iterable> getTags(String registry, Class clazz); + /** * Gets the specified {@link LootTable}. *