Interface Metadatable

All Known Subinterfaces:
AbstractArrow, AbstractHorse, AbstractSkeleton, AbstractVillager, Ageable, Ambient, Animals, AreaEffectCloud, ArmorStand, Arrow, Axolotl, Banner, Barrel, Bat, Beacon, Bed, Bee, Beehive, Bell, BlastFurnace, Blaze, Block, BlockState, Boat, Boss, Breedable, BrewingStand, Campfire, Cat, CaveSpider, Chest, ChestedHorse, Chicken, Cod, CommandBlock, CommandMinecart, Comparator, ComplexEntityPart, ComplexLivingEntity, Conduit, Container, Cow, Creature, CreatureSpawner, Creeper, Damageable, DaylightDetector, Dispenser, Dolphin, Donkey, DragonFireball, Dropper, Drowned, Egg, ElderGuardian, EnchantingTable, EnderChest, EnderCrystal, EnderDragon, EnderDragonPart, Enderman, Endermite, EnderPearl, EnderSignal, EndGateway, Entity, EntityBlockStorage<T>, Evoker, EvokerFangs, ExperienceOrb, Explosive, ExplosiveMinecart, FallingBlock, Fireball, Firework, Fish, FishHook, Flying, Fox, Furnace, Ghast, Giant, GlowItemFrame, GlowSquid, Goat, Golem, Guardian, Hanging, Hoglin, Hopper, HopperMinecart, Horse, HumanEntity, Husk, Illager, Illusioner, IronGolem, Item, ItemFrame, Jigsaw, Jukebox, LargeFireball, LeashHitch, Lectern, LightningStrike, LingeringPotion, LivingEntity, Llama, LlamaSpit, MagmaCube, Marker, Minecart, Mob, Monster, Mule, MushroomCow, NPC, Ocelot, Painting, Panda, Parrot, Phantom, Pig, Piglin, PiglinAbstract, PiglinBrute, PigZombie, Pillager, Player, PolarBear, PoweredMinecart, Projectile, PufferFish, Rabbit, Raider, RangedEntity, Ravager, RideableMinecart, Salmon, SculkSensor, Sheep, Shulker, ShulkerBox, ShulkerBullet, Sign, Silverfish, SizedFireball, Skeleton, SkeletonHorse, Skull, Slime, SmallFireball, Smoker, Snowball, Snowman, SpawnerMinecart, SpectralArrow, Spellcaster, Spider, SplashPotion, Squid, Steerable, StorageMinecart, Stray, Strider, Structure, Tameable, ThrowableProjectile, ThrownExpBottle, ThrownPotion, TileState, TippedArrow, TNTPrimed, TraderLlama, Trident, TropicalFish, Turtle, Vehicle, Vex, Villager, Vindicator, WanderingTrader, WaterMob, Witch, Wither, WitherSkeleton, WitherSkull, Wolf, World, Zoglin, Zombie, ZombieHorse, ZombieVillager

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

    • setMetadata

      void setMetadata(@NotNull @NotNull String metadataKey, @NotNull @NotNull 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:
      IllegalArgumentException - If value is null, or the owning plugin is null
    • getMetadata

      @NotNull @NotNull List<MetadataValue> getMetadata(@NotNull @NotNull 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(@NotNull @NotNull 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(@NotNull @NotNull String metadataKey, @NotNull @NotNull 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:
      IllegalArgumentException - If plugin is null