Class MetadataUtils
java.lang.Object
net.apartium.cocoabeans.spigot.utils.MetadataUtils
Utility class for working with Bukkit metadata.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <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.
-
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 valuemetadataKey- the key of the metadata valueclazz- the class type of the metadata valueplugin- 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
-