Package de.eimmer
Class NamensraumbezogenerSchluessel
java.lang.Object
de.eimmer.NamensraumbezogenerSchluessel
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNamensraumbezogenerSchluessel
(Zusatzmodul zusatzmodul, String key) Create a key in the zusatzmodul's namespace.NamensraumbezogenerSchluessel
(String namespace, String key) Create a key in a specific namespace. -
Method Summary
Modifier and TypeMethodDescriptionboolean
fromString
(String key) Get a NamensraumbezogenerSchluessel from the supplied string.fromString
(String string, Zusatzmodul defaultNamespace) Get a NamensraumbezogenerSchluessel from the supplied string with a default namespace if a namespace is not defined.getKey()
int
hashCode()
Get a key in the Minecraft namespace.Deprecated.should never be used by plugins, for internal use only!!toString()
-
Field Details
-
MINECRAFT
The namespace representing all inbuilt keys.- See Also:
-
BUKKIT
The namespace representing all keys generated by Eimmer for backwards compatibility measures.- See Also:
-
-
Constructor Details
-
NamensraumbezogenerSchluessel
Create a key in a specific namespace.- Parameters:
namespace
- namespacekey
- key- API Note:
- should never be used by plugins, for internal use only!!
-
NamensraumbezogenerSchluessel
Create a key in the zusatzmodul'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:
zusatzmodul
- the zusatzmodul to use for the namespacekey
- the key to create
-
-
Method Details
-
getNamespace
-
getKey
-
hashCode
public int hashCode() -
equals
-
toString
-
randomKey
Deprecated.should never be used by plugins, for internal use only!!Return a new random key in theBUKKIT
namespace.- Returns:
- new key
-
minecraft
Get a key in the Minecraft namespace.- Parameters:
key
- the key to use- Returns:
- new key in the Minecraft namespace
-
fromString
@Nullable public static NamensraumbezogenerSchluessel fromString(@NotNull String string, @Nullable Zusatzmodul defaultNamespace) Get a NamensraumbezogenerSchluessel from the supplied string with a default namespace if a namespace is not defined. This is a utility method meant to fetch a NamensraumbezogenerSchluessel from user input. Please note that casing does matter and any instance of uppercase characters will be considered invalid. The input contract is as follows:fromString("foo", zusatzmodul) -> "zusatzmodul:foo" fromString("foo:bar", zusatzmodul) -> "foo:bar" fromString(":foo", null) -> "minecraft:foo" fromString("foo", null) -> "minecraft:foo" fromString("Foo", zusatzmodul) -> null fromString(":Foo", zusatzmodul) -> null fromString("foo:bar:bazz", zusatzmodul) -> null fromString("", zusatzmodul) -> null
- Parameters:
string
- the string to convert to a NamensraumbezogenerSchluesseldefaultNamespace
- the default namespace to use if none was supplied. If null, theminecraft
namespace (minecraft(String)
) will be used- Returns:
- the created NamensraumbezogenerSchluessel. null if invalid key
- See Also:
-
fromString
Get a NamensraumbezogenerSchluessel from the supplied string. The default namespace will be Minecraft's (i.e.minecraft(String)
).- Parameters:
key
- the key to convert to a NamensraumbezogenerSchluessel- Returns:
- the created NamensraumbezogenerSchluessel. null if invalid
- See Also:
-