Interface CommandManager

  • All Known Subinterfaces:
    CommandManager.Mutable

    @DoNotStore
    public interface CommandManager
    Registers and dispatches commands.

    The command manager may be replaced at any point during the game lifecycle when the client chooses to reload registries.

    • Method Detail

      • registrar

        <T> Optional<CommandRegistrar<T>> registrar​(Class<T> type)
        Get a registrar that will register commands of type to the active command manager.

        This allows for out-of-band command registrations between calls to RegisterCommandEvent, though where possible that event should be preferred.

        When commands are registered outside of events, changes will not be automatically reflected in client command views. To update any applicable clients, see updateCommandTreeForPlayer(ServerPlayer).

        Type Parameters:
        T - registrar type
        Parameters:
        type - the registrar type
        Returns:
        a registrar, if any is known for type
      • registrar

        <T> Optional<CommandRegistrar<T>> registrar​(io.leangen.geantyref.TypeToken<T> type)
        Get a registrar that will register commands of type to the active command manager.

        This allows for out-of-band command registrations between calls to RegisterCommandEvent, though where possible that event should be preferred.

        When commands are registered outside of events, changes will not be automatically reflected in client command views. To update any applicable clients, see updateCommandTreeForPlayer(ServerPlayer).

        Type Parameters:
        T - registrar type
        Parameters:
        type - the registrar type
        Returns:
        a registrar, if any is known for type
      • complete

        List<CommandCompletion> complete​(String arguments)
        Provides possible completions based on the input argument string.
        Parameters:
        arguments - The arguments
        Returns:
        The completions
      • complete

        <T extends Subject & AudienceList<CommandCompletion> complete​(T subjectReceiver,
                                                                        String arguments)
        Provides possible completions based on the input argument string, with a provided object that is both a Subject for permission checks and a Audience to return command messages to.
        Type Parameters:
        T - The type of receiver
        Parameters:
        subjectReceiver - The Subject & Audience
        arguments - The arguments
        Returns:
        The completions
      • complete

        List<CommandCompletion> complete​(Subject subject,
                                         Audience receiver,
                                         String arguments)
        Provides possible completions based on the input argument string, with a provided a Subject for permission checks and a Audience to return command messages to.
        Parameters:
        subject - The Subject
        receiver - The Audience
        arguments - The arguments
        Returns:
        The completions
      • knownAliases

        Set<String> knownAliases()
        Gets all the command aliases known to this command manager.
        Returns:
        The known aliases
      • knownMappings

        Set<CommandMapping> knownMappings()
        Gets all the mappings known to this command manager.
        Returns:
        The known mappings.
      • plugins

        Collection<org.spongepowered.plugin.PluginContainer> plugins()
        Gets a Collection of PluginContainers with commands registered.
        Returns:
        A Collection of PluginContainers.
      • updateCommandTreeForPlayer

        void updateCommandTreeForPlayer​(ServerPlayer player)
        Asks the server to send an updated client completion command tree to the specified ServerPlayer.

        This should be used sparingly as repeated calls may cause performance issues. Implementations may choose to ignore this call if it deems it unnecessary to send an update.

        This method may return before the updates have been sent.

        Parameters:
        player - The ServerPlayer to send the command tree to.