Package org.bukkit
Class NamespacedKey
- java.lang.Object
-
- org.bukkit.NamespacedKey
-
public final class NamespacedKey extends Object
Represents a String based key which consists of two components - a namespace and a key. Namespaces may only contain lowercase alphanumeric characters, periods, underscores, and hyphens.Keys may only contain lowercase alphanumeric characters, periods, underscores, hyphens, and forward slashes.
-
-
Constructor Summary
Constructors Constructor Description NamespacedKey(@NotNull String namespace, @NotNull String key)
Deprecated.should never be used by plugins, for internal use only!!NamespacedKey(@NotNull Plugin plugin, @NotNull String key)
Create a key in the plugin's namespace.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object obj)
@NotNull String
getKey()
@NotNull String
getNamespace()
int
hashCode()
static @NotNull NamespacedKey
minecraft(@NotNull String key)
Get a key in the Minecraft namespace.static @NotNull NamespacedKey
randomKey()
Deprecated.should never be used by plugins, for internal use only!!String
toString()
-
-
-
Field Detail
-
MINECRAFT
public static final String MINECRAFT
The namespace representing all inbuilt keys.- See Also:
- Constant Field Values
-
BUKKIT
public static final String BUKKIT
The namespace representing all keys generated by Bukkit for backwards compatibility measures.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NamespacedKey
@Deprecated public NamespacedKey(@NotNull @NotNull String namespace, @NotNull @NotNull String key)
Deprecated.should never be used by plugins, for internal use only!!Create a key in a specific namespace.- Parameters:
namespace
- namespacekey
- key
-
NamespacedKey
public NamespacedKey(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String key)
Create a key in the plugin's namespace.Namespaces may only contain lowercase alphanumeric characters, periods, underscores, and hyphens.
Keys may only contain lowercase alphanumeric characters, periods, underscores, hyphens, and forward slashes.
- Parameters:
plugin
- the plugin to use for the namespacekey
- the key to create
-
-
Method Detail
-
getNamespace
@NotNull public @NotNull String getNamespace()
-
getKey
@NotNull public @NotNull String getKey()
-
randomKey
@Deprecated @NotNull public static @NotNull NamespacedKey randomKey()
Deprecated.should never be used by plugins, for internal use only!!Return a new random key in theBUKKIT
namespace.- Returns:
- new key
-
minecraft
@NotNull public static @NotNull NamespacedKey minecraft(@NotNull @NotNull String key)
Get a key in the Minecraft namespace.- Parameters:
key
- the key to use- Returns:
- new key in the Minecraft namespace
-
-