Package cn.nukkit.command
Class ConsoleCommandSender
java.lang.Object
cn.nukkit.command.ConsoleCommandSender
- All Implemented Interfaces:
CommandSender
,Permissible
,ServerOperator
- Direct Known Subclasses:
RemoteConsoleCommandSender
- Author:
- MagicDroidX (Nukkit Project)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAttachment
(Plugin plugin) addAttachment
(Plugin plugin, String name) addAttachment
(Plugin plugin, String name, Boolean value) getName()
返回命令发送者的名称.
如果命令发送者是一个玩家,将会返回他的玩家名字(name)不是显示名字(display name).
如果命令发送者是控制台,将会返回"CONSOLE"
.
当你需要判断命令的执行者是不是控制台时,可以用这个:
if(sender instanceof ConsoleCommandSender) .....;
返回命令发送者所在的服务器.boolean
hasPermission
(Permission permission) boolean
hasPermission
(String name) 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
sendCommandOutput
(CommandOutputContainer container) Send command output.void
sendMessage
(TextContainer message) 给命令发送者返回信息.void
sendMessage
(String message) 给命令发送者返回信息.void
setOp
(boolean value) 把这个对象设置成服务器管理员。
Sets this object to be an operator or not to be.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cn.nukkit.command.CommandSender
asEntity, asPlayer, getLocation, getPosition, isEntity
-
Constructor Details
-
ConsoleCommandSender
public ConsoleCommandSender()
-
-
Method Details
-
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
-
isPlayer
public boolean isPlayer()- Specified by:
isPlayer
in interfaceCommandSender
- Returns:
- 发送者是否为玩家
whether the sender is an player
-
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.
-
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.
-
sendCommandOutput
Description copied from interface:CommandSender
Send command output.- Specified by:
sendCommandOutput
in interfaceCommandSender
- Parameters:
container
- the container
-
getName
Description copied from interface:CommandSender
返回命令发送者的名称.
如果命令发送者是一个玩家,将会返回他的玩家名字(name)不是显示名字(display name).
如果命令发送者是控制台,将会返回"CONSOLE"
.
当你需要判断命令的执行者是不是控制台时,可以用这个:
if(sender instanceof ConsoleCommandSender) .....;
Returns the name of the command sender.
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:
-
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.
-