Class ConsoleCommandSender

java.lang.Object
cn.nukkit.command.ConsoleCommandSender
All Implemented Interfaces:
CommandSender, Permissible, ServerOperator
Direct Known Subclasses:
RemoteConsoleCommandSender

public class ConsoleCommandSender extends Object implements CommandSender
Author:
MagicDroidX (Nukkit Project)
  • Constructor Details

    • ConsoleCommandSender

      public ConsoleCommandSender()
  • Method Details

    • isPermissionSet

      public boolean isPermissionSet(String name)
      Specified by:
      isPermissionSet in interface Permissible
    • isPermissionSet

      public boolean isPermissionSet(Permission permission)
      Specified by:
      isPermissionSet in interface Permissible
    • hasPermission

      public boolean hasPermission(String name)
      Specified by:
      hasPermission in interface Permissible
    • hasPermission

      public boolean hasPermission(Permission permission)
      Specified by:
      hasPermission in interface Permissible
    • addAttachment

      public PermissionAttachment addAttachment(Plugin plugin)
      Specified by:
      addAttachment in interface Permissible
    • addAttachment

      public PermissionAttachment addAttachment(Plugin plugin, String name)
      Specified by:
      addAttachment in interface Permissible
    • addAttachment

      public PermissionAttachment addAttachment(Plugin plugin, String name, Boolean value)
      Specified by:
      addAttachment in interface Permissible
    • removeAttachment

      public void removeAttachment(PermissionAttachment attachment)
      Specified by:
      removeAttachment in interface Permissible
    • recalculatePermissions

      public void recalculatePermissions()
      Specified by:
      recalculatePermissions in interface Permissible
    • getEffectivePermissions

      public Map<String,PermissionAttachmentInfo> getEffectivePermissions()
      Specified by:
      getEffectivePermissions in interface Permissible
    • isPlayer

      public boolean isPlayer()
      Specified by:
      isPlayer in interface CommandSender
    • getServer

      public Server getServer()
      Description copied from interface: CommandSender
      EntitySelector 返回命令发送者所在的服务器。
      Returns the server of the command sender.
      Specified by:
      getServer in interface CommandSender
      Returns:
      命令发送者所在的服务器。
      the server of the command sender.
    • sendMessage

      public void sendMessage(String message)
      Description copied from interface: CommandSender
      给命令发送者返回信息。
      Sends a message to the command sender.
      Specified by:
      sendMessage in interface CommandSender
      Parameters:
      message - 要发送的信息。
      Message to send.
      See Also:
    • sendMessage

      public void sendMessage(TextContainer message)
      Description copied from interface: CommandSender
      给命令发送者返回信息。
      Sends a message to the command sender.
      Specified by:
      sendMessage in interface CommandSender
      Parameters:
      message - 要发送的信息。
      Message to send.
    • getName

      public String 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 interface CommandSender
      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 interface ServerOperator
      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 interface ServerOperator
      Parameters:
      value - true为授予管理员,false为取消管理员。
      true for giving this operator or false for cancelling.