@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        Player player = (Player) sender;
        
        if(cmd.getName().equalsIgnoreCase("name")){
                    
            if(player.hasPermission("messenger.name")){
                            
                if(args.length == 0){

                    player.sendMessage(ChatColor.BLUE + MPlugin.pName + ChatColor.DARK_GRAY + " >>" + ChatColor.GREEN + " Your name is: " + ChatColor.RESET + player.getDisplayName());

                }else{

                    if(args.length == 1){
                        
                        if(args[0].equals("help")){
                        
                            player.sendMessage(ChatColor.BLUE + MPlugin.pName + ChatColor.DARK_GRAY + " >> " + ChatColor.GREEN + "Use /name newname or /name player newname");
                        
                        }else{
                        
                            String oldName = player.getName();
                                
                            String myString = "";

                            for(int i = 0; i < args.length; i++){
                                String arg = args[i] + " ";
                                myString = myString + arg;
                            }

                            String cName = MListener.colourMessage(myString);
                            String ccName = cName.replace(cName.substring(cName.length() - 1),"");
                            
                            player.sendMessage(ChatColor.LIGHT_PURPLE + "Name: Successfully changed your name to - " + ChatColor.RESET + ccName);
                            player.setDisplayName(ccName + ChatColor.RESET);
 
                        }
                        
                    }else if(args.length == 2){
                            
                        Player target = Bukkit.getServer().getPlayer(args[0]);

                        if (target == null) {

                            player.sendMessage(ChatColor.BLUE + MPlugin.pName + ChatColor.DARK_GRAY + " >> " + ChatColor.RED + "Player: " + args[0] + " is not online.");

                        }else{

                            String oldName = target.getName();
                                
                            String myString = "";

                            for(int i = 1; i < args.length; i++){
                                String arg = args[i] + " ";
                                myString = myString + arg;
                            }

                            String cName = MListener.colourMessage(myString);
                            String ccName = cName.replace(cName.substring(cName.length() - 1),"");
                            target.setDisplayName(ccName + ChatColor.RESET);
                                
                            target.sendMessage(ChatColor.LIGHT_PURPLE + "Name ALERT: " + ChatColor.GOLD + oldName + ChatColor.LIGHT_PURPLE + ", you have a new name - " + ChatColor.RESET + ccName);
                            player.sendMessage(ChatColor.LIGHT_PURPLE + "Name: Successfully gave " + ChatColor.GOLD + oldName + ChatColor.LIGHT_PURPLE + " a new name of - " + ChatColor.RESET + ccName);
                        }  
                    }
                }
           }else{
              player.sendMessage(ChatColor.BLUE + MPlugin.pName + ChatColor.DARK_GRAY + " >> " + ChatColor.RED + " You don't have access to this.");
           }
        }
        return true;
    }