Interface MetadataKey<V>
-
- Type Parameters:
V- Metadata value type.
- All Superinterfaces:
Comparable<net.kyori.adventure.key.Key>,net.kyori.examination.Examinable,net.kyori.adventure.key.Key,net.kyori.adventure.key.Keyed,net.kyori.adventure.key.Namespaced
@NonExtendable public interface MetadataKey<V> extends net.kyori.adventure.key.KeyAn identifying object used to store and retrieve metadata fromMetadataHolders.Metadata key are similar to the Adventure
Keyobjects, except metadata keys also consist of a value type.Key namespaces must match
[a-z0-9_\-.]+Key values must match
[a-z0-9_\-./]+
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static @NotNull MetadataKey<Boolean>bool(@NotNull String string)Returns a new boolean metadata key.static @NotNull MetadataKey<Boolean>bool(@NotNull String namespace, @NotNull String value)Returns a new boolean metadata key.static @NotNull MetadataKey<Integer>integer(@NotNull String string)Returns a new boolean metadata key.static @NotNull MetadataKey<Integer>integer(@NotNull String namespace, @NotNull String value)Returns a new boolean metadata key.static <V> @NotNull MetadataKey<V>of(@NotNull Class<V> type, @NotNull String string)Returns a new metadata key.static <V> @NotNull MetadataKey<V>of(@NotNull Class<V> type, @NotNull String namespace, @NotNull String value)Returns a new metadata key.static @NotNull MetadataKey<String>string(@NotNull String string)Returns a new string metadata key.static @NotNull MetadataKey<String>string(@NotNull String namespace, @NotNull String value)Returns a new string metadata key.@NotNull Class<V>type()Returns the metadata value type.static @NotNull MetadataKey<UUID>uuid(@NotNull String string)Returns a new UUID metadata key.static @NotNull MetadataKey<UUID>uuid(@NotNull String namespace, @NotNull String value)Returns a new UUID metadata key.
-
-
-
Method Detail
-
string
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull MetadataKey<String> string(@NotNull @KeyPattern @NotNull String string)Returns a new string metadata key.Equivalent to calling
of(Class, String)withString.classas the type.- Parameters:
string- Metadata key string.- Returns:
- new metadata key.
- See Also:
of(Class, String)
-
string
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull MetadataKey<String> string(@NotNull @Namespace @NotNull String namespace, @NotNull @Value @NotNull String value)Returns a new string metadata key.Equivalent to calling
of(Class, String, String)withString.classas the type.- Parameters:
namespace- Metadata key namespace.value- Metadata key value.- Returns:
- new metadata key.
- See Also:
of(Class, String)
-
bool
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull MetadataKey<Boolean> bool(@NotNull @KeyPattern @NotNull String string)Returns a new boolean metadata key.Equivalent to calling
of(Class, String)withBoolean.classas the type.- Parameters:
string- Metadata key string.- Returns:
- new metadata key.
- See Also:
of(Class, String)
-
bool
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull MetadataKey<Boolean> bool(@NotNull @Namespace @NotNull String namespace, @NotNull @Value @NotNull String value)Returns a new boolean metadata key.Equivalent to calling
of(Class, String, String)withBoolean.classas the type.- Parameters:
namespace- Metadata key namespace.value- Metadata key value.- Returns:
- new metadata key.
- See Also:
of(Class, String, String)
-
integer
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull MetadataKey<Integer> integer(@NotNull @KeyPattern @NotNull String string)Returns a new boolean metadata key.Equivalent to calling
of(Class, String)withInteger.classas the type.- Parameters:
string- Metadata key string.- Returns:
- new metadata key.
- See Also:
of(Class, String)
-
integer
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull MetadataKey<Integer> integer(@NotNull @Namespace @NotNull String namespace, @NotNull @Value @NotNull String value)Returns a new boolean metadata key.Equivalent to calling
of(Class, String, String)withInteger.classas the type.- Parameters:
namespace- Metadata key namespace.value- Metadata key value.- Returns:
- new metadata key.
- See Also:
of(Class, String, String)
-
uuid
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull MetadataKey<UUID> uuid(@NotNull @KeyPattern @NotNull String string)Returns a new UUID metadata key.Equivalent to calling
of(Class, String)withUUID.classas the type.- Parameters:
string- Metadata key string.- Returns:
- new metadata key.
- See Also:
of(Class, String)
-
uuid
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull MetadataKey<UUID> uuid(@NotNull @Namespace @NotNull String namespace, @Value @NotNull @NotNull String value)Returns a new UUID metadata key.Equivalent to calling
of(Class, String, String)withUUID.classas the type.- Parameters:
namespace- Metadata key namespace.value- Metadata key value.- Returns:
- new metadata key.
- See Also:
of(Class, String, String)
-
of
@Contract(value="_, _ -> new", pure=true) @NotNull static <V> @NotNull MetadataKey<V> of(@NotNull @NotNull Class<V> type, @NotNull @KeyPattern @NotNull String string)Returns a new metadata key.stringwill be parsed as a key, usingDEFAULT_SEPARATORas a separator between the namespace and value.The key namespace is optional. If you do not provide one, then
MINECRAFT_NAMESPACEwill be used as the namespace, and the string will be used as the value.- Type Parameters:
V- Metadata value type.- Parameters:
type- Metadata key value type class.string- Metadata key string.- Returns:
- new metadata key.
- Throws:
IllegalArgumentException- if the namespace or valid contains an invalid character.
-
of
@Contract(value="_, _, _ -> new", pure=true) @NotNull static <V> @NotNull MetadataKey<V> of(@NotNull @NotNull Class<V> type, @NotNull @Namespace @NotNull String namespace, @NotNull @Value @NotNull String value)Returns a new metadata key.- Type Parameters:
V- Metadata value type.- Parameters:
type- Metadata value type class.namespace- Metadata key namespace.value- Metadata key value.- Returns:
- new metadata key.
- Throws:
IllegalArgumentException- if the namespace or value contains an invalid character.
-
-