Interface MapMetadatable

All Superinterfaces:
Metadatable
All Known Subinterfaces:
Actor, Player
All Known Implementing Classes:
AbstractNonPlayerActor, AbstractPlayerActor, AsyncPlayer, LocationMaskedPlayerWrapper, PlayerProxy, SilentPlayerWrapper

public interface MapMetadatable extends Metadatable
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.fastasyncworldedit.core.entity.Metadatable

    Metadatable.METADATA_KEYS
  • Method Summary

    Modifier and Type
    Method
    Description
    default <V> V
    Deletes the given metadata key from object.
    default <T> T
    getAndSetMeta(String key, T value)
    default <V> V
    Gets the metadata value to which the specified key is mapped, or null if the key is not set.
    default <V> V
    getMeta(String key, V def)
    Gets the metadata value to which the specified key is mapped, or the default value if no metadata exists for the key.
     
    default boolean
    Checks if the object contains any metadata.
    default Object
    putIfAbsent(String key, Object value)
     
    default void
    setMeta(String key, Object value)
    Set some session only metadata for the player
  • Method Details

    • getRawMeta

      Map<String,Object> getRawMeta()
    • setMeta

      default void setMeta(String key, Object value)
      Set some session only metadata for the player
      Specified by:
      setMeta in interface Metadatable
    • getAndSetMeta

      default <T> T getAndSetMeta(String key, T value)
      Specified by:
      getAndSetMeta in interface Metadatable
    • hasMeta

      default boolean hasMeta()
      Checks if the object contains any metadata.
      Specified by:
      hasMeta in interface Metadatable
      Returns:
      true if there is metadata set for the object
    • putIfAbsent

      default Object putIfAbsent(String key, Object value)
    • getMeta

      default <V> V getMeta(String key)
      Gets the metadata value to which the specified key is mapped, or null if the key is not set.
      Specified by:
      getMeta in interface Metadatable
      Parameters:
      key - the key of the metadata value to retrieve
      Returns:
      the value of the metadata or null if none exists
    • getMeta

      @Nonnull default <V> V getMeta(String key, @Nonnull V def)
      Gets the metadata value to which the specified key is mapped, or the default value if no metadata exists for the key.
      Specified by:
      getMeta in interface Metadatable
      Parameters:
      key - the key of the metadata value to retrieve
      def - the value to return if there is no metadata for the given key
      Returns:
      the metadata value for the key, if present; else the default value
    • deleteMeta

      default <V> V deleteMeta(String key)
      Deletes the given metadata key from object. Do not delete metadata set by another plugin unless you know what you are doing.
      Specified by:
      deleteMeta in interface Metadatable
      Parameters:
      key - the key identifying the metadata to remove.
      Returns:
      the previous value associated with they given key