Package cn.nukkit.command
Class ExecutorCommandSender
java.lang.Object
cn.nukkit.command.ExecutorCommandSender
- All Implemented Interfaces:
CommandSender
,Permissible
,ServerOperator
@PowerNukkitXOnly
@Since("1.6.0.0-PNX")
public class ExecutorCommandSender
extends Object
implements CommandSender
-
Constructor Summary
ConstructorsConstructorDescriptionExecutorCommandSender
(CommandSender executor, Entity entity, Location executeLocation) -
Method Summary
Modifier and TypeMethodDescriptionaddAttachment
(Plugin plugin) addAttachment
(Plugin plugin, String name) addAttachment
(Plugin plugin, String name, Boolean value) asEntity()
asPlayer()
getName()
返回命令发送者的名称。
Returns the name of the command sender.返回命令发送者所在的服务器。
Returns the server of the command sender.boolean
hasPermission
(Permission permission) boolean
hasPermission
(String name) boolean
isEntity()
boolean
isOp()
返回这个对象是不是服务器管理员。
Returns if this object is an operator.boolean
isPermissionSet
(Permission permission) boolean
isPermissionSet
(String name) boolean
isPlayer()
void
void
removeAttachment
(PermissionAttachment attachment) void
sendMessage
(TextContainer message) 给命令发送者返回信息。
Sends a message to the command sender.void
sendMessage
(String message) 给命令发送者返回信息。
Sends a message to the command sender.void
setOp
(boolean value) 把这个对象设置成服务器管理员。
Sets this object to be an operator or not to be.
-
Constructor Details
-
ExecutorCommandSender
-
-
Method Details
-
sendMessage
Description copied from interface:CommandSender
给命令发送者返回信息。
Sends a message to the command sender.- Specified by:
sendMessage
in interfaceCommandSender
- Parameters:
message
- 要发送的信息。
Message to send.- See Also:
-
sendMessage
Description copied from interface:CommandSender
给命令发送者返回信息。
Sends a message to the command sender.- Specified by:
sendMessage
in interfaceCommandSender
- Parameters:
message
- 要发送的信息。
Message to send.
-
getServer
Description copied from interface:CommandSender
返回命令发送者所在的服务器。
Returns the server of the command sender.- Specified by:
getServer
in interfaceCommandSender
- Returns:
- 命令发送者所在的服务器。
the server of the command sender.
-
getName
Description copied from interface:CommandSender
返回命令发送者的名称。
Returns the name of the command sender.如果命令发送者是一个玩家,将会返回他的玩家名字(name)不是显示名字(display name)。 如果命令发送者是控制台,将会返回
"CONSOLE"
。
If this command sender is a player, will return his/her player name(not display name). If it is a console, will return"CONSOLE"
.当你需要判断命令的执行者是不是控制台时,可以用这个:
When you need to determine if the sender is a console, use this:
if(sender instanceof ConsoleCommandSender) .....;
- Specified by:
getName
in interfaceCommandSender
- Returns:
- 命令发送者的名称。
the name of the command sender. - See Also:
-
isPlayer
public boolean isPlayer()- Specified by:
isPlayer
in interfaceCommandSender
-
isEntity
public boolean isEntity()- Specified by:
isEntity
in interfaceCommandSender
- Returns:
- whether the sender is an entity
please use this method to check whether the sender is an entity instead of using code"xxx instanceof Entity"
because the sender may not an instance of"Entity"
but in fact it is executing commands identity as an entity(eg:"ExecutorCommandSender"
)
-
asEntity
- Specified by:
asEntity
in interfaceCommandSender
-
asPlayer
- Specified by:
asPlayer
in interfaceCommandSender
-
getPosition
- Specified by:
getPosition
in interfaceCommandSender
-
getLocation
- Specified by:
getLocation
in interfaceCommandSender
-
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.
-
isPermissionSet
- Specified by:
isPermissionSet
in interfacePermissible
-
isPermissionSet
- Specified by:
isPermissionSet
in interfacePermissible
-
hasPermission
- Specified by:
hasPermission
in interfacePermissible
-
hasPermission
- Specified by:
hasPermission
in interfacePermissible
-
addAttachment
- Specified by:
addAttachment
in interfacePermissible
-
addAttachment
- Specified by:
addAttachment
in interfacePermissible
-
addAttachment
- Specified by:
addAttachment
in interfacePermissible
-
removeAttachment
- Specified by:
removeAttachment
in interfacePermissible
-
recalculatePermissions
public void recalculatePermissions()- Specified by:
recalculatePermissions
in interfacePermissible
-
getEffectivePermissions
- Specified by:
getEffectivePermissions
in interfacePermissible
-
getExecutor
-