Package cn.nukkit
Class OfflinePlayer
java.lang.Object
cn.nukkit.OfflinePlayer
- All Implemented Interfaces:
IPlayer
,Metadatable
,ServerOperator
描述一个不在线的玩家的类。
Describes an offline player.
Describes an offline player.
- Since:
- Nukkit 1.0 | Nukkit API 1.0.0
- Author:
- MagicDroidX(code) @ Nukkit Project, 粉鞋大妈(javadoc) @ Nukkit Project
- See Also:
-
Constructor Summary
ConstructorDescriptionOfflinePlayer
(Server server, String name) OfflinePlayer
(Server server, UUID uuid) 初始化这个OfflinePlayer
对象。
Initializes the objectOfflinePlayer
.OfflinePlayer
(Server server, UUID uuid, String name) -
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.getMetadata
(String metadataKey) getName()
返回这个玩家的名称。
Returns the name of this player.得到这个接口的Player
对象。
Returns aPlayer
object for this interface.返回玩家所在的服务器。
Returns the server carrying this player.boolean
hasMetadata
(String metadataKey) 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
isOp()
返回这个对象是不是服务器管理员。
Returns if this object is an operator.boolean
返回这个玩家是否已加入白名单。
Returns if this player is pardoned by whitelist.void
removeMetadata
(String metadataKey, Plugin owningPlugin) void
setBanned
(boolean value) 设置这个玩家是否被封禁(ban)。
Sets this player to be banned or to be pardoned.void
setMetadata
(String metadataKey, MetadataValue newMetadataValue) void
setOp
(boolean value) 把这个对象设置成服务器管理员。
Sets this object to be an operator or not to be.void
setWhitelisted
(boolean value) 把这个玩家加入白名单,或者取消这个玩家的白名单。
Adds this player to the white list, or removes it from the whitelist.
-
Constructor Details
-
OfflinePlayer
初始化这个OfflinePlayer
对象。
Initializes the objectOfflinePlayer
.- Parameters:
server
- 这个玩家所在服务器的Server
对象。
The server this player is in, as aServer
object.uuid
- 这个玩家的UUID。
UUID of this player.- Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-
OfflinePlayer
-
OfflinePlayer
-
-
Method Details
-
isOnline
public boolean isOnline()Description copied from interface:IPlayer
返回这个玩家是否在线。
Returns if this player is online. -
getName
Description copied from interface:IPlayer
返回这个玩家的名称。
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()
-
getUniqueId
- Specified by:
getUniqueId
in interfaceIPlayer
-
getServer
Description copied from interface:IPlayer
返回玩家所在的服务器。
Returns the server carrying this player. -
isOp
public boolean isOp()Description copied from interface:ServerOperator
返回这个对象是不是服务器管理员。
Returns if this object is an operator.- Specified by:
isOp
in interfaceServerOperator
- Returns:
- 这个对象是不是服务器管理员。
if this object is an operator.
-
setOp
public void setOp(boolean value) Description copied from interface:ServerOperator
把这个对象设置成服务器管理员。
Sets this object to be an operator or not to be.- Specified by:
setOp
in interfaceServerOperator
- Parameters:
value
-true
为授予管理员,false
为取消管理员。
true
for giving this operator orfalse
for cancelling.
-
isBanned
public boolean isBanned()Description copied from interface:IPlayer
返回这个玩家是否被封禁(ban)。
Returns if this player is banned. -
setBanned
public void setBanned(boolean value) Description copied from interface:IPlayer
设置这个玩家是否被封禁(ban)。
Sets this player to be banned or to be pardoned. -
isWhitelisted
public boolean isWhitelisted()Description copied from interface:IPlayer
返回这个玩家是否已加入白名单。
Returns if this player is pardoned by whitelist.- Specified by:
isWhitelisted
in interfaceIPlayer
- Returns:
- 这个玩家是否已加入白名单。
If this player is pardoned by whitelist. - See Also:
-
setWhitelisted
public void setWhitelisted(boolean value) Description copied from interface:IPlayer
把这个玩家加入白名单,或者取消这个玩家的白名单。
Adds this player to the white list, or removes it from the whitelist.- Specified by:
setWhitelisted
in interfaceIPlayer
- Parameters:
value
- 如果为true
,把玩家加入白名单。如果为false
,取消这个玩家的白名单。
true
for add andfalse
for remove.- See Also:
-
getPlayer
Description copied from interface:IPlayer
得到这个接口的Player
对象。
Returns aPlayer
object for this interface. -
getFirstPlayed
Description copied from interface:IPlayer
得到这个玩家第一次游戏的时间。
Returns the time this player first played in this server.- Specified by:
getFirstPlayed
in interfaceIPlayer
- Returns:
- Unix时间(以秒为单位。
Unix time in seconds.
-
getLastPlayed
Description copied from interface:IPlayer
得到这个玩家上次加入游戏的时间。
Returns the time this player last joined in this server.- Specified by:
getLastPlayed
in interfaceIPlayer
- Returns:
- Unix时间(以秒为单位。
Unix time in seconds.
-
hasPlayedBefore
public boolean hasPlayedBefore()Description copied from interface:IPlayer
返回这个玩家以前是否来过服务器。
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()) {...}
- Specified by:
hasPlayedBefore
in interfaceIPlayer
- Returns:
- 这个玩家以前是不是玩过游戏。
If this player has played in this server before.
-
setMetadata
- Specified by:
setMetadata
in interfaceMetadatable
-
getMetadata
- Specified by:
getMetadata
in interfaceMetadatable
-
hasMetadata
- Specified by:
hasMetadata
in interfaceMetadatable
-
removeMetadata
- Specified by:
removeMetadata
in interfaceMetadatable
-