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()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.CharSequence

    chars, codePoints
  • 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, the
      namespaceID
      is returned.
      Parameters:
      namespaceID - the namespace id to get the path from
      Returns:
      the path of the namespace ID
    • from

      public static NamespaceID from​(java.lang.String domain, java.lang.String path)
    • from

      public static NamespaceID from​(java.lang.String id)
    • getDomain

      public java.lang.String getDomain()
    • getPath

      public java.lang.String getPath()
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • length

      public int length()
      Specified by:
      length in interface java.lang.CharSequence
    • charAt

      public char charAt​(int index)
      Specified by:
      charAt in interface java.lang.CharSequence
    • subSequence

      public java.lang.CharSequence subSequence​(int start, int end)
      Specified by:
      subSequence in interface java.lang.CharSequence
    • toString

      @NotNull public java.lang.String toString()
      Specified by:
      toString in interface java.lang.CharSequence
      Overrides:
      toString in class java.lang.Object