public class ConsoleCommandSender extends Object implements CommandSender
| Constructor and Description |
|---|
ConsoleCommandSender() |
| Modifier and Type | Method and Description |
|---|---|
PermissionAttachment |
addAttachment(Plugin plugin) |
PermissionAttachment |
addAttachment(Plugin plugin,
String name) |
PermissionAttachment |
addAttachment(Plugin plugin,
String name,
Boolean value) |
Map<String,PermissionAttachmentInfo> |
getEffectivePermissions() |
String |
getName()
返回命令发送者的名称。
Returns the name of the command sender. |
Server |
getServer()
返回命令发送者所在的服务器。
Returns the server of the command sender. |
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 |
recalculatePermissions() |
void |
removeAttachment(PermissionAttachment attachment) |
void |
sendMessage(String message)
给命令发送者返回信息。
Sends a message to the command sender. |
void |
sendMessage(TextContainer message)
给命令发送者返回信息。
Sends a message to the command sender. |
void |
setOp(boolean value)
把这个对象设置成服务器管理员。
Sets this object to be an operator or not to be. |
public boolean isPermissionSet(String name)
isPermissionSet in interface Permissiblepublic boolean isPermissionSet(Permission permission)
isPermissionSet in interface Permissiblepublic boolean hasPermission(String name)
hasPermission in interface Permissiblepublic boolean hasPermission(Permission permission)
hasPermission in interface Permissiblepublic PermissionAttachment addAttachment(Plugin plugin)
addAttachment in interface Permissiblepublic PermissionAttachment addAttachment(Plugin plugin, String name)
addAttachment in interface Permissiblepublic PermissionAttachment addAttachment(Plugin plugin, String name, Boolean value)
addAttachment in interface Permissiblepublic void removeAttachment(PermissionAttachment attachment)
removeAttachment in interface Permissiblepublic void recalculatePermissions()
recalculatePermissions in interface Permissiblepublic Map<String,PermissionAttachmentInfo> getEffectivePermissions()
getEffectivePermissions in interface Permissiblepublic boolean isPlayer()
isPlayer in interface CommandSenderpublic Server getServer()
CommandSendergetServer in interface CommandSenderpublic void sendMessage(String message)
CommandSendersendMessage in interface CommandSendermessage - 要发送的信息。TextFormatpublic void sendMessage(TextContainer message)
CommandSendersendMessage in interface CommandSendermessage - 要发送的信息。public String getName()
CommandSender如果命令发送者是一个玩家,将会返回他的玩家名字(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) .....;
getName in interface CommandSenderPlayer.getName(),
getName(),
PluginDescriptionpublic boolean isOp()
ServerOperatorisOp in interface ServerOperatorpublic void setOp(boolean value)
ServerOperatorsetOp in interface ServerOperatorvalue - true为授予管理员,false为取消管理员。true for giving this operator or false for cancelling.Copyright © 2020. All rights reserved.