// Path: bungee/src/main/java/me/leoko/advancedban/bungee/BungeeMain.java
// public class BungeeMain extends Plugin {
// 
//     private static BungeeMain instance;
// 
//     private static CloudSupport cloudSupport;
// 
// 
//     public static BungeeMain get() {
//         return instance;
//     }
// 
//     public static CloudSupport getCloudSupport() {
//         return cloudSupport;
//     }
// 
//     @Override
//     public void onEnable() {
//         instance = this;
//         Universal.get().setup(new BungeeMethods());
//         ProxyServer.getInstance().getPluginManager().registerListener(this, new ConnectionListenerBungee());
//         ProxyServer.getInstance().getPluginManager().registerListener(this, new ChatListenerBungee());
//         ProxyServer.getInstance().getPluginManager().registerListener(this, new InternalListener());
//         ProxyServer.getInstance().registerChannel("advancedban:main");
// 
//         cloudSupport = CloudSupportHandler.getCloudSystem();
// 
// 
//         if (ProxyServer.getInstance().getPluginManager().getPlugin("RedisBungee") != null) {
//             Universal.setRedis(true);
//             ProxyServer.getInstance().getPluginManager().registerListener(this, new PubSubMessageListener());
//             RedisBungee.getApi().registerPubSubChannels("advancedban:main", "advancedban:connection");
//             Universal.get().log("RedisBungee detected, hooking into it!");
//         }
//     }
// 
//     @Override
//     public void onDisable() {
//         Universal.get().shutdown();
//     }
// }
// 
// 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.bungee.BungeeMain;
import me.leoko.advancedban.manager.CommandManager;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;
package me.leoko.advancedban.bungee.listener;


/**
 * Created by Leoko @ dev.skamps.eu on 24.07.2016.
 */

public class CommandReceiverBungee extends Command {

    public CommandReceiverBungee(String name) {
        super(name);
    }
    
    @Override
	public void execute(final CommandSender sender, final String[] args) {
    	if (args.length > 0) {
// Path: bungee/src/main/java/me/leoko/advancedban/bungee/BungeeMain.java
// public class BungeeMain extends Plugin {
// 
//     private static BungeeMain instance;
// 
//     private static CloudSupport cloudSupport;
// 
// 
//     public static BungeeMain get() {
//         return instance;
//     }
// 
//     public static CloudSupport getCloudSupport() {
//         return cloudSupport;
//     }
// 
//     @Override
//     public void onEnable() {
//         instance = this;
//         Universal.get().setup(new BungeeMethods());
//         ProxyServer.getInstance().getPluginManager().registerListener(this, new ConnectionListenerBungee());
//         ProxyServer.getInstance().getPluginManager().registerListener(this, new ChatListenerBungee());
//         ProxyServer.getInstance().getPluginManager().registerListener(this, new InternalListener());
//         ProxyServer.getInstance().registerChannel("advancedban:main");
// 
//         cloudSupport = CloudSupportHandler.getCloudSystem();
// 
// 
//         if (ProxyServer.getInstance().getPluginManager().getPlugin("RedisBungee") != null) {
//             Universal.setRedis(true);
//             ProxyServer.getInstance().getPluginManager().registerListener(this, new PubSubMessageListener());
//             RedisBungee.getApi().registerPubSubChannels("advancedban:main", "advancedban:connection");
//             Universal.get().log("RedisBungee detected, hooking into it!");
//         }
//     }
// 
//     @Override
//     public void onDisable() {
//         Universal.get().shutdown();
//     }
// }
// 
// 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: bungee/src/main/java/me/leoko/advancedban/bungee/listener/CommandReceiverBungee.java
import me.leoko.advancedban.bungee.BungeeMain;
import me.leoko.advancedban.manager.CommandManager;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;

package me.leoko.advancedban.bungee.listener;


/**
 * Created by Leoko @ dev.skamps.eu on 24.07.2016.
 */

public class CommandReceiverBungee extends Command {

    public CommandReceiverBungee(String name) {
        super(name);
    }
    
    @Override
	public void execute(final CommandSender sender, final String[] args) {
    	if (args.length > 0) {
    		args[0] = (BungeeMain.get().getProxy().getPlayer(args[0]) != null ? BungeeMain.get().getProxy().getPlayer(args[0]).getName() : args[0]);