Hey I was wondering if it would be possible to make it so that {name} would get change to the player name when the message is gotten from the config So like the config is Welcome to the server {name} and the message that is sent is Welcome to the server p.getName() This is only en example and not that I want to use it for.
@Mao String message = myConfig().get("my.Path"); message.replace(What I want to replace, replace with);
@Mao Yeah. Get the message, for example (EXAMPLE!) config.getString("MyMessageHere").replace("{name}", p.getName()); That would get you the message and replace {name} with your players name.
Yhea the fun thins is that just before reloading this page I stumbled into a thread where I got my answer, but much thanks to all of you
@Dmrtje Yes, either way, but by the looks of it he only wants to replace one. Therefore, it's not mandatory.
String#replaceAll is mainly used for RegEx. String#replace also doesn't just replace one instance, it replaces all.
@CraftCreeper6 but just to be sure if he wants to add more of {name} for Example Hello {name}, I know you {name} EDIT: @TGRHavoc didn't saw you post
I don't believe that the "{}" characters need to be escaped. I've used strings such as {name} in strings many times without escaping with no issues what so ever.
Fair point, just don't want people to be spreading false information @Mao Has your issue been solved?
@Mao Could you please mark this thread as "Solved" then? It's under "Thread Tools". Glad you've managed to fix your problem Edit: Blimey, the Ninjas are out tonight