Package cn.nukkit
Interface IPlayer
- All Superinterfaces:
Metadatable
,ServerOperator
- All Known Implementing Classes:
OfflinePlayer
,Player
用来描述一个玩家和获得这个玩家相应信息的接口。
An interface to describe a player and get its information.
An interface to describe a player and get its information.
这个玩家可以在线,也可以是不在线。
This player can be online or offline.
- Since:
- Nukkit 1.0 | Nukkit API 1.0.0
- Author:
- MagicDroidX(code) @ Nukkit Project, 粉鞋大妈(javadoc) @ Nukkit Project
- See Also:
-
Method Summary
Modifier and TypeMethodDescription得到这个玩家第一次游戏的时间。
Returns the time this player first played in this server.得到这个玩家上次加入游戏的时间。
Returns the time this player last joined in this server.getName()
返回这个玩家的名称。
Returns the name of this player.得到这个接口的Player
对象。
Returns aPlayer
object for this interface.返回玩家所在的服务器。
Returns the server carrying this player.boolean
返回这个玩家以前是否来过服务器。
Returns if this player has played in this server before.boolean
isBanned()
返回这个玩家是否被封禁(ban)。
Returns if this player is banned.boolean
isOnline()
返回这个玩家是否在线。
Returns if this player is online.boolean
返回这个玩家是否已加入白名单。
Returns if this player is pardoned by whitelist.void
setBanned
(boolean value) 设置这个玩家是否被封禁(ban)。
Sets this player to be banned or to be pardoned.void
setWhitelisted
(boolean value) 把这个玩家加入白名单,或者取消这个玩家的白名单。
Adds this player to the white list, or removes it from the whitelist.Methods inherited from interface cn.nukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface cn.nukkit.permission.ServerOperator
isOp, setOp
-
Method Details
-
isOnline
boolean isOnline()返回这个玩家是否在线。
Returns if this player is online.- Returns:
- 这个玩家是否在线。
If this player is online. - Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-
getName
String getName()返回这个玩家的名称。
Returns the name of this player.如果是在线的玩家,这个函数只会返回登录名字。如果要返回显示的名字,参见
Player.getDisplayName()
Notice that this will only return its login name. If you need its display name, turn toPlayer.getDisplayName()
- Returns:
- 这个玩家的名称。
The name of this player. - Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-
getUniqueId
UUID getUniqueId() -
isBanned
boolean isBanned()返回这个玩家是否被封禁(ban)。
Returns if this player is banned.- Returns:
- 这个玩家的名称。
The name of this player. - Since:
- Nukkit 1.0 | Nukkit API 1.0.0
- See Also:
-
setBanned
void setBanned(boolean value) 设置这个玩家是否被封禁(ban)。
Sets this player to be banned or to be pardoned.- Parameters:
value
- 如果为true
,封禁这个玩家。如果为false
,解封这个玩家。
true
for ban andfalse
for pardon.- Since:
- Nukkit 1.0 | Nukkit API 1.0.0
- See Also:
-
isWhitelisted
boolean isWhitelisted()返回这个玩家是否已加入白名单。
Returns if this player is pardoned by whitelist.- Returns:
- 这个玩家是否已加入白名单。
If this player is pardoned by whitelist. - Since:
- Nukkit 1.0 | Nukkit API 1.0.0
- See Also:
-
setWhitelisted
void setWhitelisted(boolean value) 把这个玩家加入白名单,或者取消这个玩家的白名单。
Adds this player to the white list, or removes it from the whitelist.- Parameters:
value
- 如果为true
,把玩家加入白名单。如果为false
,取消这个玩家的白名单。
true
for add andfalse
for remove.- Since:
- Nukkit 1.0 | Nukkit API 1.0.0
- See Also:
-
getPlayer
Player getPlayer()得到这个接口的Player
对象。
Returns aPlayer
object for this interface.- Returns:
- 这个接口的
Player
对象。
aPlayer
object for this interface. - Since:
- Nukkit 1.0 | Nukkit API 1.0.0
- See Also:
-
getServer
Server getServer()返回玩家所在的服务器。
Returns the server carrying this player.- Returns:
- 玩家所在的服务器。
the server carrying this player. - Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-
getFirstPlayed
Long getFirstPlayed()得到这个玩家第一次游戏的时间。
Returns the time this player first played in this server.- Returns:
- Unix时间(以秒为单位。
Unix time in seconds. - Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-
getLastPlayed
Long getLastPlayed()得到这个玩家上次加入游戏的时间。
Returns the time this player last joined in this server.- Returns:
- Unix时间(以秒为单位。
Unix time in seconds. - Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-
hasPlayedBefore
boolean hasPlayedBefore()返回这个玩家以前是否来过服务器。
Returns if this player has played in this server before.如果想得到这个玩家是不是第一次玩,可以使用:
If you want to know if this player is the first time playing in this server, you can use:
if(!player.hasPlayerBefore()) {...}
- Returns:
- 这个玩家以前是不是玩过游戏。
If this player has played in this server before. - Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-