Solved MSG Problem

Discussion in 'Plugin Help/Development/Requests' started by bubblefat_, Dec 30, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    bubblefat_

    I know I need to add something but I don't know what. This is my msg command and it works well besides when a player tries sending a player more then one word. If they say "Hello there" It would come out "Hello Hello".

    Code:
            if(cmd.getName().equalsIgnoreCase("msg")) {
            
                Player target = Bukkit.getPlayer(args[0]);
    
                if(target != null) {
                    String message = " ";
    
           
                    for(int i = 1; i != args.length; i++)
                        message += args[1] + " ";
    
                    target.sendMessage(ChatColor.GOLD + "PM> " + ChatColor.RED + ChatColor.BOLD + sender.getName() + ChatColor.GRAY + ChatColor.BOLD + " >> " + ChatColor.RED + ChatColor.BOLD + target.getName() + "" + ChatColor.GRAY + ChatColor.BOLD + " " + message);
                    sender.sendMessage(ChatColor.GOLD + "PM> " + ChatColor.RED + ChatColor.BOLD + sender.getName() + ChatColor.GRAY + ChatColor.BOLD + " >> " + ChatColor.RED + ChatColor.BOLD + target.getName() + "" + ChatColor.GRAY + ChatColor.BOLD + " " + message);
                } else if(!(target != null)) {
    
                    sender.sendMessage(ChatColor.GOLD + "PM> " + ChatColor.GRAY + "Player not found.");           
                }
                return true;
            }
     
  2. Offline

    bubblefat_

    Bump (Has been 24 hours)
     
Thread Status:
Not open for further replies.

Share This Page