Output an array without Commas

Discussion in 'Plugin Development' started by Funky StylzZz, Apr 20, 2014.

Thread Status:
Not open for further replies.
  1. Hey guys i created a little plugin that adds a /support command to the game. If you enter only /support the player who executed this command gets a message that a supporter is informed and all players with the supporter permission get a message that there is a player who need help.

    Now i want to extend that command so that you can add a reason ,/support [reason]
    I created this:

    Code:java
    1. else if(args.length >= 1) {
    2. String[] reasonar = args;
    3. String reason = Arrays.toString(reasonar);
    4. String prefix = plugin.getConfig().getString("prefix");
    5. ArrayList<Player> supporters = new ArrayList<Player>();
    6.  
    7. for(Player players : Bukkit.getServer().getOnlinePlayers())
    8. {
    9. if(players.hasPermission("supportix.supporter"))
    10. supporters.add(players);
    11. }
    12. for(Player supporter : supporters)
    13. supporter.sendMessage(prefix +ChatColor.AQUA +" The player "+ ChatColor.GOLD + p.getName() + ChatColor.AQUA + " needs your help! Have a look on his request\n" + ChatColor.GOLD +"Reason: " + reason);
    14. if(supporters.size() == 0)
    15. p.sendMessage(prefix +ChatColor.AQUA +" Sorry, no supporters online! Please use /ticket to open a support-ticket");
    16. else
    17. p.sendMessage(prefix +ChatColor.AQUA +" Supporters have been informed!");
    18. return true;
    19.  
    20.  
    21. }


    it works but it outputs this:
    [​IMG]

    but i want that it outputs Reason: need help here

    Thanks in advance :)
     
  2. Offline

    rfsantos1996

    Code:java
    1. String reason = "";
    2.  
    3. for(String arg : reasonar) {
    4. reason = reason + arg + " ";
    5. }
     
    Funky StylzZz likes this.
  3. ohh of course.....:X
    Thank you
     
  4. Offline

    rfsantos1996

    (;
     
    Funky StylzZz likes this.
Thread Status:
Not open for further replies.

Share This Page