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(String namespace, String key)
Deprecated.should never be used by plugins, for internal use only!!NamespacedKey(Plugin plugin, 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)
String
getKey()
String
getNamespace()
int
hashCode()
static NamespacedKey
minecraft(String key)
Get a key in the Minecraft namespace.static 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 String namespace, @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 Plugin plugin, @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 String getNamespace()
-
getKey
@NotNull public String getKey()
-
randomKey
@Deprecated @NotNull public static 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 NamespacedKey minecraft(@NotNull String key)
Get a key in the Minecraft namespace.- Parameters:
key
- the key to use- Returns:
- new key in the Minecraft namespace
-
-