Solved Get all arguments and behind

Discussion in 'Spigot Plugin Development' started by brooky1010, May 28, 2016.

  1. Hello, I'm trying to make that someone else can make a player chat. I have a little problem.
    I've made:
    Code (Text):
    player.chat(args[1]);
    But if I do for example:
    /cmd [Player] Hello from Europe!
    It only says
    [Player]: Hello

    So how can I make it takes all arguments including args[1] and behind? Thanks
     
  2. you need a string builder, to get the args from args[1] +
     
  3. Thanks ^^
    For those who are interested, I used
    Code (Text):
    String message = "";
                    for (int i = 1; i < args.length; i++) {
                        message += args[i] + " ";
                    }
                    message = message.trim();
    (Argument 1 is the message)
     
  4. Don't use an empty string and add more to it. Why?
    1) It's bad coding practice.
    2) StringBuilder is made for this exact purpose. Strings aren't. StringBuilder is more efficient.