程序包 org.bukkit

接口 Nameable

所有已知子接口:
AbstractArrow, AbstractHorse, AbstractSkeleton, AbstractVillager, Ageable, Allay, Ambient, Animals, AreaEffectCloud, ArmorStand, Arrow, Axolotl, Barrel, Bat, Beacon, Bee, BlastFurnace, Blaze, BlockDisplay, Boat, Boss, Breedable, BrewingStand, Camel, Cat, CaveSpider, Chest, ChestBoat, ChestedHorse, Chicken, Cod, CommandMinecart, ComplexEntityPart, ComplexLivingEntity, Container, Cow, Creature, Creeper, Damageable, Dispenser, Display, Dolphin, Donkey, DragonFireball, Dropper, Drowned, Egg, ElderGuardian, EnchantingTable, EnderCrystal, EnderDragon, EnderDragonPart, Enderman, Endermite, EnderPearl, EnderSignal, Enemy, Entity, Evoker, EvokerFangs, ExperienceOrb, Explosive, ExplosiveMinecart, FallingBlock, Fireball, Firework, Fish, FishHook, Flying, Fox, Frog, Furnace, Ghast, Giant, GlowItemFrame, GlowSquid, Goat, Golem, Guardian, Hanging, Hoglin, Hopper, HopperMinecart, Horse, HumanEntity, Husk, Illager, Illusioner, Interaction, IronGolem, Item, ItemDisplay, ItemFrame, LargeFireball, LeashHitch, 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, Ravager, RideableMinecart, Salmon, Sheep, Shulker, ShulkerBox, ShulkerBullet, Silverfish, SizedFireball, Skeleton, SkeletonHorse, Slime, SmallFireball, Smoker, Sniffer, Snowball, Snowman, SpawnerMinecart, SpectralArrow, Spellcaster, Spider, SplashPotion, Squid, Steerable, StorageMinecart, Stray, Strider, Tadpole, Tameable, TextDisplay, ThrowableProjectile, ThrownExpBottle, ThrownPotion, TippedArrow, TNTPrimed, TraderLlama, Trident, TropicalFish, Turtle, Vehicle, Vex, Villager, Vindicator, WanderingTrader, Warden, WaterMob, Witch, Wither, WitherSkeleton, WitherSkull, Wolf, Zoglin, Zombie, ZombieHorse, ZombieVillager

public interface Nameable
表明此方块、实体或其它物体(对象)可接受一个自定义名称.
  • 方法概要

    修饰符和类型
    方法
    说明
    获取生物或方块的自定义名称,若无则返回null.
    void
    设置生物或方块的自定义名称,该名称可被用于死亡信息,且能作为生物头顶的标签内容被发送到客户端.
  • 方法详细资料

    • getCustomName

      @Nullable @Nullable String getCustomName()
      获取生物或方块的自定义名称,若无则返回null.

      这个方法对玩家没有作用,玩家将一直使用他们的真名.

      原文:

      Gets the custom name on a mob or block. If there is no name this method will return null.

      This value has no effect on players, they will always use their real name.

      返回:
      生物或方块的自定义名称(若无则返回null)
    • setCustomName

      void setCustomName(@Nullable @Nullable String name)
      设置生物或方块的自定义名称,该名称可被用于死亡信息,且能作为生物头顶的标签内容被发送到客户端.

      设置为空字符串或者null将会清除该生物或方块的自定义名称.

      这个方法对玩家没有作用,玩家将一直使用他们的真名.

      原文:

      Sets a custom name on a mob or block. This name will be used in death messages and can be sent to the client as a nameplate over the mob.

      Setting the name to null or an empty string will clear it.

      This value has no effect on players, they will always use their real name.

      参数:
      name - 自定义名称