Placeholders

Discussion in 'Spigot Plugin Development' started by The_AxeMaster, Mar 6, 2017.

  1. Alright, so I'm trying to add a placeholder, instead of using target.getName() I'm trying to make it be %PLAYER% or {PLAYER}. I have never worked with placeholders before.
    Any replies would be much appreciated :)
     
  2. String#replace("%player%", Player#getName)
     
  3. Do i put this into where all of my command are?
     
  4. I would assume you have a config file. So an example of this is an announcement that is broadcasted, so if you want to broadcast a string in the config you would do (pseudo code)


    Code (Text):
    String msg = config.getString("Message.").replace("%PLAYER%", p.getName());
    broadCast(msg);