mkremins / fanciful

Fancy Bukkit message formatting
MIT License
95 stars 82 forks source link

Add replace function #62

Open JonathanBrouwer opened 9 years ago

JonathanBrouwer commented 9 years ago

Add a way to replace a certain String with a FancyMessagePart

mkremins commented 9 years ago

Could you describe your example use-case in a little more detail? It'd be nice to know what your code currently looks like and what it'd look like after this feature is put into place.

JonathanBrouwer commented 9 years ago

I have a .properties file with messages like "Homes: %Homes" and "The player %Player is now in creative mode".

I am making a FancyMessage from the key and then want replace %Homes with another FancyMessage, where you can click the home to teleport to the home.

Wundero commented 9 years ago

You can parse the string from the properties file into a fancy message up to your variable, then get your "homes" fancy variable or "player" fancy variable and append it to the current one (you can either use a builder or write your own append method) and then continue parsing.