类 MetadataValueAdapter

java.lang.Object
org.bukkit.metadata.MetadataValueAdapter
所有已实现的接口:
MetadataValue
直接已知子类:
LazyMetadataValue

public abstract class MetadataValueAdapter extends Object implements MetadataValue
用于简化MetadataValue实现的可选基类.

此类为MetadataValue提供所有转换函数, 使得编写MetadataValue实现只需实现value()和invalidate()即可.

  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getOwningPlugin

      @Nullable public @Nullable Plugin getOwningPlugin()
      从接口复制的说明: MetadataValue
      返回创建此元数据项的Plugin.

      原文: Returns the Plugin that created this metadata item.

      指定者:
      getOwningPlugin 在接口中 MetadataValue
      返回:
      拥有此元数据值的插件. 如果插件已被卸载则可能为null.
    • asInt

      public int asInt()
      从接口复制的说明: MetadataValue
      尝试将此元数据项的值转换为int.

      原文: Attempts to convert the value of this metadata item into an int.

      指定者:
      asInt 在接口中 MetadataValue
      返回:
      int类型的值.
    • asFloat

      public float asFloat()
      从接口复制的说明: MetadataValue
      尝试将此元数据项的值转换为float.

      原文: Attempts to convert the value of this metadata item into a float.

      指定者:
      asFloat 在接口中 MetadataValue
      返回:
      float类型的值.
    • asDouble

      public double asDouble()
      从接口复制的说明: MetadataValue
      尝试将此元数据项的值转换为double.

      原文: Attempts to convert the value of this metadata item into a double.

      指定者:
      asDouble 在接口中 MetadataValue
      返回:
      double类型的值.
    • asLong

      public long asLong()
      从接口复制的说明: MetadataValue
      尝试将此元数据项的值转换为long.

      原文: Attempts to convert the value of this metadata item into a long.

      指定者:
      asLong 在接口中 MetadataValue
      返回:
      long类型的值.
    • asShort

      public short asShort()
      从接口复制的说明: MetadataValue
      尝试将此元数据项的值转换为short.

      原文: Attempts to convert the value of this metadata item into a short.

      指定者:
      asShort 在接口中 MetadataValue
      返回:
      short类型的值.
    • asByte

      public byte asByte()
      从接口复制的说明: MetadataValue
      尝试将此元数据项的值转换为byte.

      原文: Attempts to convert the value of this metadata item into a byte.

      指定者:
      asByte 在接口中 MetadataValue
      返回:
      byte类型的值.
    • asBoolean

      public boolean asBoolean()
      从接口复制的说明: MetadataValue
      尝试将此元数据项的值转换为boolean.

      原文: Attempts to convert the value of this metadata item into a boolean.

      指定者:
      asBoolean 在接口中 MetadataValue
      返回:
      boolean类型的值.
    • asString

      @NotNull public @NotNull String asString()
      从接口复制的说明: MetadataValue
      尝试将此元数据项的值转换为字符串.

      原文: Attempts to convert the value of this metadata item into a string.

      指定者:
      asString 在接口中 MetadataValue
      返回:
      字符串类型的值.