Package net.minestom.server.utils
Class NamespaceID
java.lang.Object
net.minestom.server.utils.NamespaceID
- All Implemented Interfaces:
java.lang.CharSequence
public class NamespaceID
extends java.lang.Object
implements java.lang.CharSequence
Represents a namespaced ID
https://minecraft.gamepedia.com/Namespaced_ID
-
Method Summary
Modifier and Type Method Description char
charAt(int index)
boolean
equals(java.lang.Object o)
static NamespaceID
from(java.lang.String id)
static NamespaceID
from(java.lang.String domain, java.lang.String path)
java.lang.String
getDomain()
static java.lang.String
getDomain(java.lang.String namespaceID)
Extracts the domain from the namespace ID.java.lang.String
getPath()
static java.lang.String
getPath(java.lang.String namespaceID)
Extracts the path from the namespace ID.int
hashCode()
int
length()
java.lang.CharSequence
subSequence(int start, int end)
java.lang.String
toString()
-
Method Details
-
getDomain
@NotNull public static java.lang.String getDomain(@NotNull java.lang.String namespaceID)Extracts the domain from the namespace ID. "minecraft:stone" would return "minecraft". If no ':' character is found, "minecraft" is returned.- Parameters:
namespaceID
- the namespace id to get the domain from- Returns:
- the domain of the namespace ID
-
getPath
public static java.lang.String getPath(@NotNull java.lang.String namespaceID)Extracts the path from the namespace ID. "minecraft:blocks/stone" would return "blocks/stone". If no ':' character is found, thenamespaceID
is returned.- Parameters:
namespaceID
- the namespace id to get the path from- Returns:
- the path of the namespace ID
-
from
-
from
-
getDomain
public java.lang.String getDomain() -
getPath
public java.lang.String getPath() -
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
length
public int length()- Specified by:
length
in interfacejava.lang.CharSequence
-
charAt
public char charAt(int index)- Specified by:
charAt
in interfacejava.lang.CharSequence
-
subSequence
public java.lang.CharSequence subSequence(int start, int end)- Specified by:
subSequence
in interfacejava.lang.CharSequence
-
toString
@NotNull public java.lang.String toString()- Specified by:
toString
in interfacejava.lang.CharSequence
- Overrides:
toString
in classjava.lang.Object
-