Devlin Posted October 4, 2013 Posted October 4, 2013 Hello people. I have these lines: String message = ""; message = Config.PVP_REWARD_MESSAGE.replaceAll("%itemName%", PvpItemName); message = Config.PVP_REWARD_MESSAGE.replaceAll("%itemCount%", PvpItemCount); player.sendMessage(message); The 3rd line: message = Config.PVP_REWARD_MESSAGE.replaceAll("%itemCount%", PvpItemCount); It's Integer but replaceAll is String, String. I was away from developing for a while and I can't remember how to fix it. Any idea? Thanks in advance.
0 xdem Posted October 4, 2013 Posted October 4, 2013 message = Config.PVP_REWARD_MESSAGE.replaceAll("%itemName%", PvpItemName).replaceAll("%itemCount%", PvpItemCount+""); this should work like a charm
0 Devlin Posted October 4, 2013 Author Posted October 4, 2013 message = Config.PVP_REWARD_MESSAGE.replaceAll("%itemName%", PvpItemName).replaceAll("%itemCount%", PvpItemCount+""); this should work like a charm Yeah, thanks a lot.
0 xdem Posted October 4, 2013 Posted October 4, 2013 (edited) btw u dont have to store the String, garbage collector will take care of it but why whould you init a useless object? so change all ur code into player.sendMessage(Config.PVP_REWARD_MESSAGE.replaceAll("%itemName%", PvpItemName).replaceAll("%itemCount%", PvpItemCount+""); Edited October 4, 2013 by xdem
0 Devlin Posted October 4, 2013 Author Posted October 4, 2013 btw u dont have to store the String, garbage collector will take care of it but why whould you init a useless object? so change all ur code into player.sendMessage(Config.PVP_REWARD_MESSAGE.replaceAll("%itemName%", PvpItemName).replaceAll("%itemCount%", PvpItemCount+""); Exactly, thank you dude.
Question
Devlin
Hello people.
I have these lines:
4 answers to this question
Recommended Posts