程序包 org.bukkit

接口 Nameable

所有已知子接口:
AbstractHorse, Ageable, Ambient, Animals, AreaEffectCloud, ArmorStand, Arrow, Bat, Beacon, Blaze, Boat, BrewingStand, CaveSpider, Chest, ChestedHorse, Chicken, CommandMinecart, ComplexEntityPart, ComplexLivingEntity, Cow, Creature, Creeper, Damageable, Dispenser, Donkey, DragonFireball, Dropper, Egg, ElderGuardian, EnchantingTable, EnderCrystal, EnderDragon, EnderDragonPart, Enderman, Endermite, EnderPearl, EnderSignal, Entity, Evoker, EvokerFangs, ExperienceOrb, Explosive, ExplosiveMinecart, FallingBlock, Fireball, Firework, Fish, FishHook, Flying, Furnace, Ghast, Giant, Golem, Guardian, Hanging, Hopper, HopperMinecart, Horse, HumanEntity, Husk, Illager, Illusioner, IronGolem, Item, ItemFrame, LargeFireball, LeashHitch, LightningStrike, LingeringPotion, LivingEntity, Llama, LlamaSpit, MagmaCube, Minecart, Monster, Mule, MushroomCow, NPC, Ocelot, Painting, Parrot, Pig, PigZombie, Player, PolarBear, PoweredMinecart, Projectile, Rabbit, RideableMinecart, Sheep, Shulker, ShulkerBox, ShulkerBullet, Silverfish, Skeleton, SkeletonHorse, Slime, SmallFireball, Snowball, Snowman, SpawnerMinecart, SpectralArrow, Spellcaster, Spider, SplashPotion, Squid, StorageMinecart, Stray, Tameable, ThrownExpBottle, ThrownPotion, TippedArrow, TNTPrimed, Vehicle, Vex, Villager, Vindicator, WaterMob, Weather, Witch, Wither, WitherSkeleton, WitherSkull, Wolf, Zombie, ZombieHorse, ZombieVillager

public interface Nameable
  • 方法概要

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

    • getCustomName

      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(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 - 自定义名称