Package org.spongepowered.api
Interface ResourceKey
- All Superinterfaces:
Comparable<Key>,net.kyori.examination.Examinable,Key,Keyed,Namespaced
An object representation of a location or pointer to resources.
The key can be represented as a
String by Object.toString().
The key is built with two parts:
- The Namespace
- The Value
ResourceKey, including but
not restricted to DataRegistrations, ConfigurationNodes,
DataTranslators, and DataSerializables.
Note that the methods minecraft(String) and
sponge(String) should only be used by the implementations for
creating new keys and usage by plugins may result in
a crash condition by the implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder to createResourceKeys.static interfaceA factory to generateResourceKeys. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe brigadier namespace.static final StringThe minecraft namespace.static final StringThe sponge namespace.Fields inherited from interface net.kyori.adventure.key.Key
DEFAULT_SEPARATOR -
Method Summary
Modifier and TypeMethodDescriptiondefault StringasString()static @NonNull ResourceKeyCreates a resource key with a namespace ofbrigadier.static ResourceKey.Builderbuilder()Creates a newResourceKey.Builderfor creatingResourceKeys.default intdefault StringGets this key as a formatted value.static @NonNull ResourceKeyCreates a resource key with a namespace ofminecraft.static ResourceKeyCreates a resource key.static ResourceKeyCreates a resource key.static ResourceKeyResolves a resource key from a string.static @NonNull ResourceKeyCreates a resource key with a namespace ofsponge.Methods inherited from interface net.kyori.examination.Examinable
examinableName, examineMethods inherited from interface net.kyori.adventure.key.Key
asMinimalString, examinableProperties, key, namespace, value
-
Field Details
-
BRIGADIER_NAMESPACE
The brigadier namespace.- See Also:
-
MINECRAFT_NAMESPACE
The minecraft namespace.- See Also:
-
SPONGE_NAMESPACE
The sponge namespace.- See Also:
-
-
Method Details
-
brigadier
Creates a resource key with a namespace ofbrigadier.- Parameters:
value- The value- Returns:
- A new resource key
-
minecraft
Creates a resource key with a namespace ofminecraft.- Parameters:
value- The value- Returns:
- A new resource key
-
sponge
Creates a resource key with a namespace ofsponge.- Parameters:
value- The value- Returns:
- A new resource key
-
builder
Creates a newResourceKey.Builderfor creatingResourceKeys. The builder can be used for creating keys based onPluginContainers,Objects of plugins, andStringnamespaces.- Returns:
- The new builder instance
-
of
Creates a resource key.- Parameters:
namespace- The namespacevalue- The value- Returns:
- A new resource key
-
of
Creates a resource key.- Parameters:
plugin- The pluginvalue- The value- Returns:
- A new resource key
-
resolve
Resolves a resource key from a string.- Parameters:
formatted- The formatted string to parse- Returns:
- A new resource key
-
formatted
Gets this key as a formatted value.It is up to the implementation to determine the formatting. In vanilla Minecraft, keys are formatted as "namespace:value". For example, "minecraft:carrot".
- Returns:
- The key, formatted
-
asString
-
compareTo
- Specified by:
compareToin interfaceComparable<Key>- Specified by:
compareToin interfaceKey
-