diff --git a/src/main/java/net/minestom/server/registry/Registry.java b/src/main/java/net/minestom/server/registry/Registry.java index 0e82c0cd6..360af5262 100644 --- a/src/main/java/net/minestom/server/registry/Registry.java +++ b/src/main/java/net/minestom/server/registry/Registry.java @@ -66,6 +66,7 @@ public final class Registry { private final Map namespaceMap = new HashMap<>(); // id -> registry data private final Int2ObjectMap idMap = new Int2ObjectOpenHashMap<>(); + private final Collection objects = Collections.unmodifiableCollection(namespaceMap.values()); @ApiStatus.Internal public Container(Resource resource, Loader loader) { @@ -90,7 +91,7 @@ public final class Registry { } public Collection values() { - return Collections.unmodifiableCollection(namespaceMap.values()); + return objects; } public void register(@NotNull T value) {