Solved Replacing char sequences

Discussion in 'Spigot Plugin Development' started by ApplePie, Jun 8, 2016.

  1. Hello.
    I am trying to get messages from a file, and players will be able to modify the messages in the file with %p.
    %p will then be replaced, as the players name.
    I've tried this so far.
    Code (Text):
    PasswordSetAs.replace("%p", args[0]);
                PasswordSetAs = getConfig().getString("Password-set-as");
    But my output will always be %p instead of the args[0].

    EDIT: I fixed it.
  2. .replace() does not modify the original String. You will have to do PasswordSetAs = PasswordSetAs.replace(etc);