/**
 * This file is part of XtraAPI, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2016 - 2016 XtraStudio <https://github.com/XtraStudio>
 * Copyright (c) Contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.xtra.api.registry;

import java.util.Collection;
import java.util.Map;
import java.util.Optional;

import com.xtra.api.command.Command;
import com.xtra.api.plugin.XtraCorePluginContainer;

/**
 * The global registry for {@link Command}s. All {@link Command}s are registered
 * through here.
 */
public interface CommandRegistry {

    /**
     * Gets the specified {@link Command} from the global command registry.
     * 
     * @param clazz The class of the command to get
     * @return The command object, or {@link Optional#empty()} if the command
     *         could not be found
     */
    Optional<Command> getCommand(Class<? extends Command> clazz);

    /**
     * Gets a mapping entry of the specified {@link Command} object and its
     * corresponding {@link XtraCorePluginContainer}.
     * 
     * @param clazz The class of the command to get
     * @return The command and container mapping entry, or
     *         {@link Optional#empty()} if the command could not be found
     */
    Optional<Map.Entry<Command, XtraCorePluginContainer>> getEntry(Class<? extends Command> clazz);

    /**
     * Gets a collection of all of the registered commands.
     * 
     * @return A collection of the commands
     */
    Collection<Command> getAllCommands();

    /**
     * Gets a mapping of all of the registered commands and their
     * {@link XtraCorePluginContainer}s.
     * 
     * @return A mapping of all of the commands and their containers
     */
    Map<Command, XtraCorePluginContainer> getAllCommandMappings();
}

@@ -1401,16 +1401,118 @@
 ommand;%0A
+import com.xtra.api.command.runnable.CommandRunnable;%0Aimport com.xtra.api.command.state.CommandState;%0A
 import c
@@ -2906,11 +2906,1621 @@
 pings();
+%0A%0A    /**%0A     * Adds the specified %7B@link CommandRunnable%7D to be ran with the specified%0A     * classes using the global command registry.%0A     * %0A     * @param runnable The runnable to run with the specified classes%0A     * @param classes The classes to run the command runnable on%0A     */%0A    @SuppressWarnings(%22unchecked%22)%0A    void addRunnables(CommandRunnable runnable, Class%3C? extends Command%3E... classes);%0A%0A    /**%0A     * Checks if the specified command class has any corresponding%0A     * %7B@link CommandRunnable%7Ds.%0A     * %0A     * @param clazz The class to check%0A     * @return If the class has any corresponding command runnables%0A     */%0A    boolean doesCommandHaveRunnable(Class%3C? extends Command%3E clazz);%0A%0A    /**%0A     * Removes all %7B@link CommandRunnable%7Ds from the specified class using the%0A     * global command registry.%0A     * %0A     * @param clazz The class to remove runnables from%0A     */%0A    void removeRunnables(Class%3C? extends Command%3E clazz);%0A%0A    /**%0A     * Sets the %7B@link CommandState%7D for the specified command using the global%0A     * command registry.%0A     * %0A     * @param clazz The class of the command%0A     * @param state The new state of the command%0A     */%0A    void setState(Class%3C? extends Command%3E clazz, CommandState state);%0A%0A    /**%0A     * Gets the %7B@link CommandState%7D for the specified command using the global%0A     * command registry.%0A     * %0A     * @param clazz The class of the command%0A     * @return The command state, or %7B@link Optional#empty()%7D if the command%0A     *         could not be found%0A     */%0A    Optional%3CCommandState%3E getState(Class%3C? extends Command%3E clazz);
 %0A%7D%0A

Add basic methods for CommandRunnables and CommandStates in the CommandRegistry