I was wondering how people made it so like in their plugins config file, if you put like %PLAYER% in a string, it would replace it with the players name.
@__Sour When you want to use the string, for example "Hello, %PLAYER%" you would replace the variable with the players name. Code: String base = "Hello, %PLAYER%"; //The base string base = base.replaceAll(Pattern.quote("%PLAYER%"), playername); //playername is the player's name obviously //%PLAYER% has now been replaced with whatever you put in for playername.
p.sendMessage(ChatColor.TranslateAlt....('&', getConfig().getString("path").replace("%player%", p.getName())); This allows color codes too. I think this is what your asking? - typed on phone.
@__Sour You should also consider what @VG.Developments said, if you want to be able to use color codes in your message then add this: Code: String base = "Hello, %PLAYER%"; base = ChatColor.translateAlternateColorCodes('&', base.replaceAll(Pattern.quote("%PLAYER%"), playername)); //For using color codes.