Class WGMetadata
java.lang.Object
com.sk89q.worldguard.bukkit.internal.WGMetadata
Utility methods for dealing with metadata on entities.
WorldGuard is placed as the owner of all values.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
getIfPresent
(org.bukkit.metadata.Metadatable target, String key, Class<T> expected) Get the (first) metadata value on the given target that has the given key and is of the given class type.static void
Add some metadata to a target.static void
Removes metadata from the target.
-
Method Details
-
put
Add some metadata to a target.- Parameters:
target
- the targetkey
- the keyvalue
- the value
-
getIfPresent
@Nullable public static <T> T getIfPresent(org.bukkit.metadata.Metadatable target, String key, Class<T> expected) Get the (first) metadata value on the given target that has the given key and is of the given class type.- Type Parameters:
T
- the type of the value- Parameters:
target
- the targetkey
- the keyexpected
- the type of the value- Returns:
- a value, or
null
if one does not exists
-
remove
Removes metadata from the target.- Parameters:
target
- the targetkey
- the key
-