Class MetadataUtils

java.lang.Object
net.apartium.cocoabeans.spigot.utils.MetadataUtils

public class MetadataUtils extends Object
Utility class for working with Bukkit metadata.
  • Constructor Details

    • MetadataUtils

      public MetadataUtils()
  • Method Details

    • getMetadataValue

      public static <T> Optional<T> getMetadataValue(org.bukkit.metadata.Metadatable metadatable, String metadataKey, Class<T> clazz, org.bukkit.plugin.Plugin plugin)
      Retrieves a metadata value associated with the specified key from a Metadatable object.
      Type Parameters:
      T - the type of the metadata value
      Parameters:
      metadatable - the Metadatable object from which to retrieve the metadata value
      metadataKey - the key of the metadata value
      clazz - the class type of the metadata value
      plugin - the Plugin instance that owns the metadata
      Returns:
      an Optional containing the metadata value if found, or an empty Optional if not found or if the value is not of the specified class type