Interface Registry<T>
- All Superinterfaces:
net.kyori.adventure.key.Keyed
- All Known Subinterfaces:
DynamicRegistry<T>
-
Method Summary
Modifier and TypeMethodDescriptionget
(int id) get
(@NotNull net.kyori.adventure.key.Key key) default T
get
(@NotNull RegistryKey<T> key) int
getId
(@NotNull RegistryKey<T> key) Returns the protocol ID associated with the givenRegistryKey
, or -1 if none is registered.@Nullable RegistryKey
<T> getKey
(int id) @Nullable RegistryKey
<T> getKey
(@NotNull net.kyori.adventure.key.Key key) @Nullable RegistryKey
<T> @NotNull RegistryTag
<T> getOrCreateTag
(@NotNull TagKey<T> key) Get a tag by its key, or create it if it does not exist.@Nullable DataPack
getPack
(int id) default @Nullable DataPack
getPack
(@NotNull RegistryKey<T> key) default @Nullable RegistryTag
<T> getTag
(@NotNull net.kyori.adventure.key.Key key) @Nullable RegistryTag
<T> Get a tag by its key.@NotNull Collection
<RegistryKey<T>> keys()
Returns the keys in this registry as an immutable list.boolean
Removes the given tag from this registry if it exists.int
size()
Returns the number of entries present in this registry.@NotNull Collection
<RegistryTag<T>> tags()
Returns the available tags in this registry.@NotNull Collection
<T> values()
Returns the entries in this registry as an immutable list.Methods inherited from interface net.kyori.adventure.key.Keyed
key
-
Method Details
-
get
-
get
-
get
-
getKey
-
getKey
-
getKey
-
getId
Returns the protocol ID associated with the givenRegistryKey
, or -1 if none is registered. -
getPack
-
getPack
-
size
int size()Returns the number of entries present in this registry. -
keys
Returns the keys in this registry as an immutable list.
Note: The list order is not guaranteed, and the contents are not guaranteed to update with the registry, it should be fetched again for updated values.
- Returns:
- An immutable collection of the keys in this registry.
-
values
Returns the entries in this registry as an immutable list.
Note: The list order is not guaranteed, and the contents are not guaranteed to update with the registry, it should be fetched again for updated values.
- Returns:
- An immutable list of the entries in this registry.
-
getTag
Get a tag by its key.- Parameters:
key
- The key of the tag- Returns:
- The tag, or null if not found
-
getTag
@Nullable default @Nullable RegistryTag<T> getTag(@NotNull @NotNull net.kyori.adventure.key.Key key) -
getOrCreateTag
Get a tag by its key, or create it if it does not exist.Note that if a tag is created by this operation, it will not be added to clients who previously received tags. You must resend updated registry tags manually for this to take effect. Referencing a tag for which the client is not aware will result in an immediate clientside disconnect.
- Parameters:
key
- The key of the tag- Returns:
- The tag, never null
-
removeTag
Removes the given tag from this registry if it exists.Note that this does _not_ remove the tag from clients who have previously received tags. You must resend updated registry tags manually for this to take effect.
- Parameters:
key
- The registry tag to remove.- Returns:
- True if the tag was removed, false if it did not exist in this registry.
-
tags
Returns the available tags in this registry.
Note: The returned list is not guaranteed to update with the registry, it should be fetched again for updated values.
- Returns:
- An immutable collection of the tags in this registry.
-
tagRegistry
-