Package org.bukkit

Class NamespacedKey

java.lang.Object
org.bukkit.NamespacedKey
All Implemented Interfaces:
Comparable<Key>, Key, Keyed, Namespaced, net.kyori.examination.Examinable

public final class NamespacedKey extends Object implements Key
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 Details

    • MINECRAFT

      public static final String MINECRAFT
      The namespace representing all inbuilt keys.
      See Also:
    • BUKKIT

      public static final String BUKKIT
      The namespace representing all keys generated by Bukkit for backwards compatibility measures.
      See Also:
  • Constructor Details

    • NamespacedKey

      public NamespacedKey(@NotNull @NotNull String namespace, @NotNull @NotNull String key)
      Create a key in a specific namespace.

      For most plugin related code, you should prefer using the NamespacedKey(Plugin, String) constructor.

      Parameters:
      namespace - namespace
      key - key
      See Also:
    • NamespacedKey

      public NamespacedKey(@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