Class NamespacedTag

java.lang.Object
com.destroystokyo.paper.NamespacedTag
All Implemented Interfaces:
Namespaced

public final class NamespacedTag extends Object implements Namespaced
Represents a String based key pertaining to a tagged entry. 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 Details

    • 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 Details

    • NamespacedTag

      @Deprecated public NamespacedTag(@NotNull @NotNull String namespace, @NotNull @NotNull String key)
      Deprecated.
      should never be used by plugins, for internal use only!!
      Create a key in a specific namespace.
      Parameters:
      namespace - String representing a grouping of keys
      key - Name for this specific key
    • NamespacedTag

      public NamespacedTag(@NotNull @NotNull Plugin plugin, @NotNull @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 namespace
      key - the key to create
  • Method Details

    • getNamespace

      @NotNull public @NotNull String getNamespace()
      Description copied from interface: Namespaced
      Gets the namespace this resource is a part of

      This is contractually obligated to only contain lowercase alphanumeric characters, periods, underscores, and hyphens.

      Specified by:
      getNamespace in interface Namespaced
      Returns:
      resource namespace
    • getKey

      @NotNull public @NotNull String getKey()
      Description copied from interface: Namespaced
      Gets the key corresponding to this resource

      This is contractually obligated to only contain lowercase alphanumeric characters, periods, underscores, hyphens, and forward slashes.

      Specified by:
      getKey in interface Namespaced
      Returns:
      resource key
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • randomKey

      @Deprecated public static NamespacedTag randomKey()
      Deprecated.
      should never be used by plugins, for internal use only!!
      Return a new random key in the BUKKIT namespace.
      Returns:
      new key
    • minecraft

      @NotNull public static @NotNull NamespacedTag minecraft(@NotNull @NotNull String key)
      Get a key in the Minecraft namespace.
      Parameters:
      key - the key to use
      Returns:
      new key in the Minecraft namespace