public interface BanEntry
封禁条目包括以下属性:
属性 | 描述 |
---|---|
目标玩家名 / IP地址 | 目标的玩家名或IP地址 |
创建日期 | 本次封禁的创建日期(开始日期) |
创建者 | 封禁的创建者,可以是玩家、控制台、插件等 |
到期时间 | 封禁的到期事件 |
理由 | 封禁的理由 |
未保存的信息不会自动写入到实现的封禁列表中,
反而, save()
方法必须被调用, 以保存到封禁列表中.
如果本封禁条目已经过期(例如unban命令)或不再存在于封禁列表中,save()
方法
的调用将重新添加本条目至封禁列表,
因而导致再次封禁指定的受害者.
同样地, 对相关的BanList
或其他的条目的更改可能或可能不会反映在此条目上.
译注: 最后一句是什么意思呢? 您每次从BanList里获取的BanEntry都是 不同的对象(不同的内存地址), 您对其中一个BanEntry进行了修改, 但这并不会影响另一个 已经获取到的BanEntry, 另一个BanEntry获取到的信息自然跟您修改后的信息不符.
限定符和类型 | 方法和说明 |
---|---|
java.util.Date |
getCreated()
获取本次封禁的开始时间.
|
java.util.Date |
getExpiration()
获取本次封禁的过期时间.
|
java.lang.String |
getReason()
获取此次封禁的理由.
|
java.lang.String |
getSource()
获取本次封禁的操作者.
|
java.lang.String |
getTarget()
获取本次封禁的目标.
|
void |
save()
保存这个封禁条目, 将覆盖在封禁列表里的数据.
|
void |
setCreated(java.util.Date created)
设置本次封禁的开始时间.
|
void |
setExpiration(java.util.Date expiration)
设置本次封禁的过期时间.
|
void |
setReason(java.lang.String reason)
设置此次封禁的理由.
|
void |
setSource(java.lang.String source)
设置本次封禁的操作者.
|
java.lang.String getTarget()
原文: Gets the target involved. This may be in the form of an IP or a player name.
java.util.Date getCreated()
原文: Gets the date this ban entry was created.
void setCreated(java.util.Date created)
原文: Sets the date this ban entry was created.
created
- 要设置的日期,不能为null保存更改
java.lang.String getSource()
注意: 操作者可以是任何字符串, 虽然大部分情况是玩家名.
原文: Gets the source of this ban.
Note: A source is considered any String, although this is generally a player name.
void setSource(java.lang.String source)
注意: 操作者可以是任何字符串,虽然大部分情况是玩家名.
原文: Sets the source of this ban.
Note: A source is considered any String, although this is generally a player name.
source
- 新的操作者, 若设为null将变为空字符串保存更改
java.util.Date getExpiration()
原文: Gets the date this ban expires on, or null for no defined end date.
void setExpiration(java.util.Date expiration)
原文: Sets the date this ban expires on. Null values are considered "infinite" bans.
expiration
- 新的封禁过期时间, null则表示永不过期保存更改
java.lang.String getReason()
原文: Gets the reason for this ban.
void setReason(java.lang.String reason)
原文: Sets the reason for this ban. Reasons must not be null.
reason
- 新的封禁理由, null表示使用默认值保存更改
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.