Class NullRouteCommandSender

  • All Implemented Interfaces:
    org.bukkit.command.CommandSender, org.bukkit.permissions.Permissible, org.bukkit.permissions.ServerOperator

    public final class NullRouteCommandSender
    extends Object
    implements org.bukkit.command.CommandSender
    CommandSender which does nothing at all Use getInstance() to get the singleton instance
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.bukkit.command.CommandSender

        org.bukkit.command.CommandSender.Spigot
    • Method Summary

      Modifier and Type Method Description
      @NotNull org.bukkit.permissions.PermissionAttachment addAttachment​(@NotNull org.bukkit.plugin.Plugin plugin)
      Adds a new empty PermissionAttachment to this object
      @Nullable org.bukkit.permissions.PermissionAttachment addAttachment​(@NotNull org.bukkit.plugin.Plugin plugin, int ticks)
      Temporarily adds a new empty PermissionAttachment to this object
      @NotNull org.bukkit.permissions.PermissionAttachment addAttachment​(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String name, boolean value)
      Adds a new PermissionAttachment with a single permission by name and value
      @NotNull org.bukkit.permissions.PermissionAttachment addAttachment​(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String name, boolean value, int ticks)
      Temporarily adds a new PermissionAttachment with a single permission by name and value
      @NotNull Set<org.bukkit.permissions.PermissionAttachmentInfo> getEffectivePermissions()
      Gets a set containing all of the permissions currently in effect by this object
      static @NotNull NullRouteCommandSender getInstance()  
      @NotNull String getName()
      Gets the name of this command sender
      @NotNull org.bukkit.Server getServer()
      Returns the server instance that this command is running on
      boolean hasPermission​(@NotNull String name)
      Gets the value of the specified permission, if set.
      boolean hasPermission​(@NotNull org.bukkit.permissions.Permission perm)
      Gets the value of the specified permission, if set.
      boolean isOp()
      Checks if this object is a server operator
      boolean isPermissionSet​(@NotNull String name)
      Checks if this object contains an override for the specified permission, by fully qualified name
      boolean isPermissionSet​(@NotNull org.bukkit.permissions.Permission perm)
      Checks if this object contains an override for the specified Permission
      void recalculatePermissions()
      Recalculates the permissions for this object, if the attachments have changed values.
      void removeAttachment​(@NotNull org.bukkit.permissions.PermissionAttachment attachment)
      Removes the given PermissionAttachment from this object
      void sendMessage​(@NotNull String message)
      Sends this sender a message
      void sendMessage​(@NotNull String[] messages)
      Sends this sender multiple messages
      void setOp​(boolean value)
      Sets the operator status of this object
      @NotNull org.bukkit.command.CommandSender.Spigot spigot()  
    • Method Detail

      • sendMessage

        public void sendMessage​(@NotNull
                                @NotNull String message)
        Description copied from interface: org.bukkit.command.CommandSender
        Sends this sender a message
        Specified by:
        sendMessage in interface org.bukkit.command.CommandSender
        Parameters:
        message - Message to be displayed
      • sendMessage

        public void sendMessage​(@NotNull
                                @NotNull String[] messages)
        Description copied from interface: org.bukkit.command.CommandSender
        Sends this sender multiple messages
        Specified by:
        sendMessage in interface org.bukkit.command.CommandSender
        Parameters:
        messages - An array of messages to be displayed
      • getServer

        @NotNull
        public @NotNull org.bukkit.Server getServer()
        Description copied from interface: org.bukkit.command.CommandSender
        Returns the server instance that this command is running on
        Specified by:
        getServer in interface org.bukkit.command.CommandSender
        Returns:
        Server instance
      • getName

        @NotNull
        public @NotNull String getName()
        Description copied from interface: org.bukkit.command.CommandSender
        Gets the name of this command sender
        Specified by:
        getName in interface org.bukkit.command.CommandSender
        Returns:
        Name of the sender
      • spigot

        @NotNull
        public @NotNull org.bukkit.command.CommandSender.Spigot spigot()
        Specified by:
        spigot in interface org.bukkit.command.CommandSender
      • isPermissionSet

        public boolean isPermissionSet​(@NotNull
                                       @NotNull String name)
        Description copied from interface: org.bukkit.permissions.Permissible
        Checks if this object contains an override for the specified permission, by fully qualified name
        Specified by:
        isPermissionSet in interface org.bukkit.permissions.Permissible
        Parameters:
        name - Name of the permission
        Returns:
        true if the permission is set, otherwise false
      • isPermissionSet

        public boolean isPermissionSet​(@NotNull
                                       @NotNull org.bukkit.permissions.Permission perm)
        Description copied from interface: org.bukkit.permissions.Permissible
        Checks if this object contains an override for the specified Permission
        Specified by:
        isPermissionSet in interface org.bukkit.permissions.Permissible
        Parameters:
        perm - Permission to check
        Returns:
        true if the permission is set, otherwise false
      • hasPermission

        public boolean hasPermission​(@NotNull
                                     @NotNull String name)
        Description copied from interface: org.bukkit.permissions.Permissible
        Gets the value of the specified permission, if set.

        If a permission override is not set on this object, the default value of the permission will be returned.

        Specified by:
        hasPermission in interface org.bukkit.permissions.Permissible
        Parameters:
        name - Name of the permission
        Returns:
        Value of the permission
      • hasPermission

        public boolean hasPermission​(@NotNull
                                     @NotNull org.bukkit.permissions.Permission perm)
        Description copied from interface: org.bukkit.permissions.Permissible
        Gets the value of the specified permission, if set.

        If a permission override is not set on this object, the default value of the permission will be returned

        Specified by:
        hasPermission in interface org.bukkit.permissions.Permissible
        Parameters:
        perm - Permission to get
        Returns:
        Value of the permission
      • addAttachment

        @NotNull
        public @NotNull org.bukkit.permissions.PermissionAttachment addAttachment​(@NotNull
                                                                                  @NotNull org.bukkit.plugin.Plugin plugin,
                                                                                  @NotNull
                                                                                  @NotNull String name,
                                                                                  boolean value)
        Description copied from interface: org.bukkit.permissions.Permissible
        Adds a new PermissionAttachment with a single permission by name and value
        Specified by:
        addAttachment in interface org.bukkit.permissions.Permissible
        Parameters:
        plugin - Plugin responsible for this attachment, may not be null or disabled
        name - Name of the permission to attach
        value - Value of the permission
        Returns:
        The PermissionAttachment that was just created
      • addAttachment

        @NotNull
        public @NotNull org.bukkit.permissions.PermissionAttachment addAttachment​(@NotNull
                                                                                  @NotNull org.bukkit.plugin.Plugin plugin)
        Description copied from interface: org.bukkit.permissions.Permissible
        Adds a new empty PermissionAttachment to this object
        Specified by:
        addAttachment in interface org.bukkit.permissions.Permissible
        Parameters:
        plugin - Plugin responsible for this attachment, may not be null or disabled
        Returns:
        The PermissionAttachment that was just created
      • addAttachment

        @NotNull
        public @NotNull org.bukkit.permissions.PermissionAttachment addAttachment​(@NotNull
                                                                                  @NotNull org.bukkit.plugin.Plugin plugin,
                                                                                  @NotNull
                                                                                  @NotNull String name,
                                                                                  boolean value,
                                                                                  int ticks)
        Description copied from interface: org.bukkit.permissions.Permissible
        Temporarily adds a new PermissionAttachment with a single permission by name and value
        Specified by:
        addAttachment in interface org.bukkit.permissions.Permissible
        Parameters:
        plugin - Plugin responsible for this attachment, may not be null or disabled
        name - Name of the permission to attach
        value - Value of the permission
        ticks - Amount of ticks to automatically remove this attachment after
        Returns:
        The PermissionAttachment that was just created
      • addAttachment

        @Nullable
        public @Nullable org.bukkit.permissions.PermissionAttachment addAttachment​(@NotNull
                                                                                   @NotNull org.bukkit.plugin.Plugin plugin,
                                                                                   int ticks)
        Description copied from interface: org.bukkit.permissions.Permissible
        Temporarily adds a new empty PermissionAttachment to this object
        Specified by:
        addAttachment in interface org.bukkit.permissions.Permissible
        Parameters:
        plugin - Plugin responsible for this attachment, may not be null or disabled
        ticks - Amount of ticks to automatically remove this attachment after
        Returns:
        The PermissionAttachment that was just created
      • removeAttachment

        public void removeAttachment​(@NotNull
                                     @NotNull org.bukkit.permissions.PermissionAttachment attachment)
        Description copied from interface: org.bukkit.permissions.Permissible
        Removes the given PermissionAttachment from this object
        Specified by:
        removeAttachment in interface org.bukkit.permissions.Permissible
        Parameters:
        attachment - Attachment to remove
      • recalculatePermissions

        public void recalculatePermissions()
        Description copied from interface: org.bukkit.permissions.Permissible
        Recalculates the permissions for this object, if the attachments have changed values.

        This should very rarely need to be called from a plugin.

        Specified by:
        recalculatePermissions in interface org.bukkit.permissions.Permissible
      • getEffectivePermissions

        @NotNull
        public @NotNull Set<org.bukkit.permissions.PermissionAttachmentInfo> getEffectivePermissions()
        Description copied from interface: org.bukkit.permissions.Permissible
        Gets a set containing all of the permissions currently in effect by this object
        Specified by:
        getEffectivePermissions in interface org.bukkit.permissions.Permissible
        Returns:
        Set of currently effective permissions
      • isOp

        public boolean isOp()
        Description copied from interface: org.bukkit.permissions.ServerOperator
        Checks if this object is a server operator
        Specified by:
        isOp in interface org.bukkit.permissions.ServerOperator
        Returns:
        true if this is an operator, otherwise false
      • setOp

        public void setOp​(boolean value)
        Description copied from interface: org.bukkit.permissions.ServerOperator
        Sets the operator status of this object
        Specified by:
        setOp in interface org.bukkit.permissions.ServerOperator
        Parameters:
        value - New operator value