Interface Metadatable

All Known Subinterfaces:
Ageable, Ambient, Animals, ArmorStand, Arrow, Banner, Bat, Beacon, Blaze, Block, BlockState, Boat, BrewingStand, CaveSpider, Chest, Chicken, CommandBlock, CommandMinecart, ComplexEntityPart, ComplexLivingEntity, Cow, Creature, CreatureSpawner, Creeper, Damageable, Dispenser, Dropper, Egg, EnderCrystal, EnderDragon, EnderDragonPart, Enderman, Endermite, EnderPearl, EnderSignal, Entity, ExperienceOrb, Explosive, ExplosiveMinecart, FallingBlock, FallingSand, Fireball, Firework, Fish, FishHook, Flying, Furnace, Ghast, Giant, Golem, Guardian, Hanging, Hopper, HopperMinecart, Horse, HumanEntity, IronGolem, Item, ItemFrame, Jukebox, LargeFireball, LeashHitch, LightningStrike, LivingEntity, MagmaCube, Minecart, Monster, MushroomCow, NoteBlock, NPC, Ocelot, Painting, Pig, PigZombie, Player, PoweredMinecart, PoweredMinecart, Projectile, Rabbit, RideableMinecart, Sheep, Sign, Silverfish, Skeleton, Skull, Slime, SmallFireball, Snowball, Snowman, SpawnerMinecart, Spider, Squid, StorageMinecart, StorageMinecart, ThrownExpBottle, ThrownPotion, TNTPrimed, Vehicle, Villager, WaterMob, Weather, Witch, Wither, WitherSkull, Wolf, World, Zombie

public interface Metadatable
This interface is implemented by all objects that can provide metadata about themselves.
  • Method Summary

    Modifier and Type Method Description
    java.util.List<MetadataValue> getMetadata​(java.lang.String metadataKey)
    Returns a list of previously set metadata values from the implementing object's metadata store.
    boolean hasMetadata​(java.lang.String metadataKey)
    Tests to see whether the implementing object contains the given metadata value in its metadata store.
    void removeMetadata​(java.lang.String metadataKey, Plugin owningPlugin)
    Removes the given metadata value from the implementing object's metadata store.
    void setMetadata​(java.lang.String metadataKey, MetadataValue newMetadataValue)
    Sets a metadata value in the implementing object's metadata store.
  • Method Details

    • setMetadata

      void setMetadata​(java.lang.String metadataKey, MetadataValue newMetadataValue)
      Sets a metadata value in the implementing object's metadata store.
      Parameters:
      metadataKey - A unique key to identify this metadata.
      newMetadataValue - The metadata value to apply.
      Throws:
      java.lang.IllegalArgumentException - If value is null, or the owning plugin is null
    • getMetadata

      java.util.List<MetadataValue> getMetadata​(java.lang.String metadataKey)
      Returns a list of previously set metadata values from the implementing object's metadata store.
      Parameters:
      metadataKey - the unique metadata key being sought.
      Returns:
      A list of values, one for each plugin that has set the requested value.
    • hasMetadata

      boolean hasMetadata​(java.lang.String metadataKey)
      Tests to see whether the implementing object contains the given metadata value in its metadata store.
      Parameters:
      metadataKey - the unique metadata key being queried.
      Returns:
      the existence of the metadataKey within subject.
    • removeMetadata

      void removeMetadata​(java.lang.String metadataKey, Plugin owningPlugin)
      Removes the given metadata value from the implementing object's metadata store.
      Parameters:
      metadataKey - the unique metadata key identifying the metadata to remove.
      owningPlugin - This plugin's metadata value will be removed. All other values will be left untouched.
      Throws:
      java.lang.IllegalArgumentException - If plugin is null