程序包 org.bukkit

接口 BanEntry


public interface BanEntry
封禁列表里的单个封禁条目. 本封禁条目可以代表关于一个玩家的封禁或关于一个IP地址的封禁.

封禁条目包括以下属性:

属性信息
属性 描述
目标玩家名 / IP地址 目标的玩家名或IP地址
创建日期 本次封禁的创建日期(开始日期)
创建者 封禁的创建者,可以是玩家、控制台、插件等
到期时间 封禁的到期时间
理由 封禁的理由

未保存的信息不会自动写入到实现的封禁列表中, 反而, save() 方法必须被调用, 以保存到封禁列表中. 如果本封禁条目已经过期(例如unban命令)或不再存在于封禁列表中,save() 方法 的调用将重新添加本条目至封禁列表, 因而导致再次封禁指定的受害者. 同样地, 对相关的BanList或其他的条目的更改可能或可能不会反映在此条目上.

译注: 最后一句是什么意思呢? 您每次从BanList里获取的BanEntry都是 不同的对象(不同的内存地址), 您对其中一个BanEntry进行了修改, 但这并不会影响另一个 已经获取到的BanEntry, 另一个BanEntry获取到的信息自然跟您修改后的信息不符.

  • 方法详细资料

    • getTarget

      @NotNull @NotNull String getTarget()
      获取本次封禁的目标. 这可能是一个IP地址或玩家名.

      原文: Gets the target involved. This may be in the form of an IP or a player name.

      返回:
      被封禁的玩家的名字或IP地址
    • getCreated

      @NotNull @NotNull Date getCreated()
      获取本次封禁的开始时间.

      原文: Gets the date this ban entry was created.

      返回:
      封禁开始时间
    • setCreated

      void setCreated(@NotNull @NotNull Date created)
      设置本次封禁的开始时间.

      原文: Sets the date this ban entry was created.

      参数:
      created - 要设置的日期,不能为null
      另请参阅:
    • getSource

      @NotNull @NotNull String getSource()
      获取本次封禁的操作者.

      注意: 操作者可以是任何字符串, 虽然大部分情况是玩家名.

      原文: Gets the source of this ban.

      Note: A source is considered any String, although this is generally a player name.

      返回:
      封禁操作者
    • setSource

      void setSource(@NotNull @NotNull String source)
      设置本次封禁的操作者.

      注意: 操作者可以是任何字符串,虽然大部分情况是玩家名.

      原文: Sets the source of this ban.

      Note: A source is considered any String, although this is generally a player name.

      参数:
      source - 新的操作者, 若设为null将变为空字符串
      另请参阅:
    • getExpiration

      @Nullable @Nullable Date getExpiration()
      获取本次封禁的过期时间. null为永不过期.

      原文: Gets the date this ban expires on, or null for no defined end date.

      返回:
      过期时间
    • setExpiration

      void setExpiration(@Nullable @Nullable Date expiration)
      设置本次封禁的过期时间. 设为null则表示永不过期.

      原文: Sets the date this ban expires on. Null values are considered "infinite" bans.

      参数:
      expiration - 新的封禁过期时间, null则表示永不过期
      另请参阅:
    • getReason

      获取此次封禁的理由.

      原文: Gets the reason for this ban.

      返回:
      封禁理由, null为尚未设置, 使用默认值
    • setReason

      void setReason(@Nullable @Nullable String reason)
      设置此次封禁的理由.

      原文: Sets the reason for this ban. Reasons must not be null.

      参数:
      reason - 新的封禁理由, null表示使用默认值
      另请参阅:
    • save

      void save()
      保存这个封禁条目, 将覆盖在封禁列表里的数据.

      保存关于一个未被封禁的玩家的封禁条目, 将导致这个玩家再一次被封禁.

      原文: Saves the ban entry, overwriting any previous data in the ban list.

      Saving the ban entry of an unbanned player will cause the player to be banned once again.