Class Key

java.lang.Object
com.viaversion.viaversion.util.Key

public final class Key extends Object
  • Method Details

    • of

      public static Key of(String namespace, String path)
      Creates a new key with the given namespace and path.
      Parameters:
      namespace - the namespace of the identifier
      path - the path of the identifier
      Returns:
      a new key with the given namespace and path
    • ofPath

      public static Key ofPath(String path)
      Creates a new key with the given path and the default namespace "minecraft".
      Parameters:
      path - the path of the identifier
      Returns:
      a new key with the given path and the default namespace
    • of

      public static Key of(String identifier)
      Creates a new key from the given identifier string, with or without an explicit namespace.
      Parameters:
      identifier - the identifier string
      Returns:
      a new key with the given identifier
    • tryParse

      public static @Nullable Key tryParse(String identifier)
      Tries to create a new key from the given identifier string, with or without an explicit namespace.
      Parameters:
      identifier - the identifier string
      Returns:
      a new key with the given identifier, or null if the identifier is invalid
    • stripNamespace

      public static String stripNamespace(String identifier)
    • namespace

      public static String namespace(String identifier)
    • stripMinecraftNamespace

      public static String stripMinecraftNamespace(String identifier)
    • equals

      public static boolean equals(String firstIdentifier, String secondIdentifier)
    • namespaced

      public static String namespaced(String identifier)
    • isValid

      public static boolean isValid(String identifier)
    • namespace

      public String namespace()
    • path

      public String path()
    • original

      public String original()
      Returns the unmodified original identifier, possbily without an explicit namespace.
      Returns:
      the original identifier, possibly without an explicit namespace
    • minimized

      public String minimized()
      Returns the identifier in a minimized form. If the namespace is "minecraft", it will return just the path.
      Returns:
      the identifier in a minimized form
    • hasMinecraftNamespace

      public boolean hasMinecraftNamespace()
    • withNamespace

      public Key withNamespace(String namespace)
    • withPath

      public Key withPath(String path)
    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
    • equals

      public final boolean equals(String identifier)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object