// Path: core/src/main/java/me/leoko/advancedban/manager/CommandManager.java
// public class CommandManager {
// 
//     private static CommandManager instance = null;
// 
//     /**
//      * Get the instance of the command manager
//      *
//      * @return the command manager instance
//      */
//     public static synchronized CommandManager get() {
//         return instance == null ? instance = new CommandManager() : instance;
//     }
// 
//     /**
//      * Handle/Perform a command.
//      *
//      * @param sender the sender which executes the command
//      * @param cmd    the command name
//      * @param args   the arguments for this command
//      */
//     public void onCommand(final Object sender, final String cmd, final String[] args) {
//         Universal.get().getMethods().runAsync(() -> {
//             Command command = Command.getByName(cmd);
//             if (command == null)
//                 return;
// 
//             String permission = command.getPermission();
//             if (permission != null && !Universal.get().hasPerms(sender, permission)) {
//                 MessageManager.sendMessage(sender, "General.NoPerms", true);
//                 return;
//             }
// 
//             if (!command.validateArguments(args)) {
//                 MessageManager.sendMessage(sender, command.getUsagePath(), true);
//                 return;
//             }
// 
//             command.execute(sender, args);
//         });
//     }
// }


import me.leoko.advancedban.manager.CommandManager;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
package me.leoko.advancedban.bukkit.listener;


/**
 * Created by Leoko @ dev.skamps.eu on 23.07.2016.
 */
public class CommandReceiver implements CommandExecutor {
    private static CommandReceiver instance = null;

    public static CommandReceiver get() {
        return instance == null ? instance = new CommandReceiver() : instance;
    }

    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
    	if (strings.length > 0) {
    		strings[0] = (Bukkit.getPlayer(strings[0]) != null ? Bukkit.getPlayer(strings[0]).getName() : strings[0]);
    	}
// Path: core/src/main/java/me/leoko/advancedban/manager/CommandManager.java
// public class CommandManager {
// 
//     private static CommandManager instance = null;
// 
//     /**
//      * Get the instance of the command manager
//      *
//      * @return the command manager instance
//      */
//     public static synchronized CommandManager get() {
//         return instance == null ? instance = new CommandManager() : instance;
//     }
// 
//     /**
//      * Handle/Perform a command.
//      *
//      * @param sender the sender which executes the command
//      * @param cmd    the command name
//      * @param args   the arguments for this command
//      */
//     public void onCommand(final Object sender, final String cmd, final String[] args) {
//         Universal.get().getMethods().runAsync(() -> {
//             Command command = Command.getByName(cmd);
//             if (command == null)
//                 return;
// 
//             String permission = command.getPermission();
//             if (permission != null && !Universal.get().hasPerms(sender, permission)) {
//                 MessageManager.sendMessage(sender, "General.NoPerms", true);
//                 return;
//             }
// 
//             if (!command.validateArguments(args)) {
//                 MessageManager.sendMessage(sender, command.getUsagePath(), true);
//                 return;
//             }
// 
//             command.execute(sender, args);
//         });
//     }
// }


// Path: bukkit/src/main/java/me/leoko/advancedban/bukkit/listener/CommandReceiver.java
import me.leoko.advancedban.manager.CommandManager;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

package me.leoko.advancedban.bukkit.listener;


/**
 * Created by Leoko @ dev.skamps.eu on 23.07.2016.
 */
public class CommandReceiver implements CommandExecutor {
    private static CommandReceiver instance = null;

    public static CommandReceiver get() {
        return instance == null ? instance = new CommandReceiver() : instance;
    }

    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
    	if (strings.length > 0) {
    		strings[0] = (Bukkit.getPlayer(strings[0]) != null ? Bukkit.getPlayer(strings[0]).getName() : strings[0]);
    	}
        CommandManager.get().onCommand(commandSender, command.getName(), strings);