From 8b799425b859e8f64e4424384e1fb2fbd1bc8894 Mon Sep 17 00:00:00 2001 From: ohnoey Date: Sat, 10 Aug 2024 07:02:22 -0700 Subject: [PATCH] Add iterator over entries --- .../movecraft/craft/datatag/CraftDataTagRegistry.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/src/main/java/net/countercraft/movecraft/craft/datatag/CraftDataTagRegistry.java b/api/src/main/java/net/countercraft/movecraft/craft/datatag/CraftDataTagRegistry.java index ea6388662..d542f8405 100644 --- a/api/src/main/java/net/countercraft/movecraft/craft/datatag/CraftDataTagRegistry.java +++ b/api/src/main/java/net/countercraft/movecraft/craft/datatag/CraftDataTagRegistry.java @@ -4,6 +4,8 @@ import org.bukkit.NamespacedKey; import org.jetbrains.annotations.NotNull; +import java.util.Enumeration; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.function.Function; @@ -41,4 +43,12 @@ public CraftDataTagRegistry(){ public boolean isRegistered(final @NotNull NamespacedKey key){ return _registeredTags.containsKey(key); } + + /** + * Get an iterable over all keys currently registered. + * @return An immutable iterable over the registry keys + */ + public @NotNull Iterable<@NotNull NamespacedKey> getAllKeys(){ + return _registeredTags.keySet().stream().toList(); + } }