/*
 * Router.java
 *
 * Copyright (c) 2014. Graham Howden <graham_howden1 at yahoo.co.uk>.
 *
 * This file is part of PluginFramework.
 *
 * PluginFramework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PluginFramework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PluginFramework.  If not, see <http ://www.gnu.org/licenses/>.
 */

package com.publicuhc.pluginframework.routing;

import com.publicuhc.pluginframework.routing.exception.CommandParseException;
import org.bukkit.command.TabExecutor;

import java.util.List;

public interface Router extends TabExecutor
{

    /**
     * Register a class for commands, creates a new instance using the DI injector
     *
     * @param klass the class to register commands for
     * @return the created object after injection
     * @throws com.publicuhc.pluginframework.routing.exception.CommandParseException when failing to parse any commands in the class
     */
    Object registerCommands(Class klass) throws CommandParseException;

    /**
     * Register an already created class for commands and (optionally) inject dependencies
     * <b>
     * If injecting dependencies construction injection doesn't happen,
     * use {@link #registerCommands(Class)} to do constructor injection</b>
     * </b>
     *
     * @param object the object to register commands for
     * @param inject whether to inject dependencies or not (no constructor injection)
     * @throws com.publicuhc.pluginframework.routing.exception.CommandParseException when failing to parse any commands in the class
     */
    void registerCommands(Object object, boolean inject) throws CommandParseException;

    /**
     * Set the messages to be displayed if a command is triggered but has no method to call
     *
     * @param commandName the name of the command
     * @param message     the messages to send
     */
    void setDefaultMessageForCommand(String commandName, List<String> message);

    /**
     * Set a message to be displayed if a command is triggered but has no method to call.
     *
     * @param commandName the name of the command
     * @param message     the message to send
     * @see #setDefaultMessageForCommand(String, java.util.List)
     */
    void setDefaultMessageForCommand(String commandName, String message);
}

@@ -840,16 +840,57 @@
 uting;%0A%0A
+import com.google.inject.AbstractModule;%0A
 import c
@@ -1118,11 +1118,11 @@
 ands
-, c
+. C
 reat
@@ -1139,16 +1139,45 @@
 nstance 
+of said class and injects it 
 using th
@@ -1178,16 +1178,24 @@
 ing the 
+default 
 DI injec
@@ -1197,16 +1197,17 @@
 injector
+.
 %0A     *%0A
@@ -1553,79 +1553,1351 @@
 er a
-n already created class for commands and (optionally) inject dependenci
+ class for commands. Creates a new instance of said class and injects it using the default DI injector%0A     * with the provided modules added%0A     *%0A     * @param klass the class to register commands for%0A     * @param modules the extra modules to add to the injector%0A     * @return the created object after injection%0A     * @throws com.publicuhc.pluginframework.routing.exception.CommandParseException when failing to parse any commands in the class%0A     */%0A    Object registerCommands(Class klass, List%3CAbstractModule%3E modules) throws CommandParseException;%0A%0A    /**%0A     * Register an instance for commands, optionally injecting using the DI injector%0A     * %3Cb%3E%0A     * If injecting dependencies construction/property injection doesn't happen,%0A     * use %7B@link #registerCommands(Class)%7D to do constructor/property injection%3C/b%3E%0A     * %3C/b%3E%0A     *%0A     * @param object the object to register commands for%0A     * @param inject whether to inject dependencies or not (no constructor injection)%0A     * @throws com.publicuhc.pluginframework.routing.exception.CommandParseException when failing to parse any commands in the class%0A     */%0A    void registerCommands(Object object, boolean inject) throws CommandParseException;%0A%0A    /**%0A     * Register an instance for commands, optionally injecting using the DI injector with the extra provided modul
 es%0A 
@@ -2951,16 +2951,25 @@
 truction
+/property
  injecti
@@ -3020,32 +3020,38 @@
 erCommands(Class
+, List
 )%7D to do constru
@@ -3046,32 +3046,41 @@
 o do constructor
+/property
  injection%3C/b%3E%0A 
@@ -3428,32 +3428,62 @@
 , boolean inject
+, List%3CAbstractModule%3E modules
 ) throws Command

add new interface methods to specify custom modules when creating a command class