Jump to content
  • 0

Replaceall Thingy With Integer Code.


Devlin

Question

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.
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

message = Config.PVP_REWARD_MESSAGE.replaceAll("%itemName%", PvpItemName).replaceAll("%itemCount%", PvpItemCount+"");

 

this should work like a charm

Link to comment
Share on other sites

  • 0

message = Config.PVP_REWARD_MESSAGE.replaceAll("%itemName%", PvpItemName).replaceAll("%itemCount%", PvpItemCount+"");

 

this should work like a charm

Yeah, thanks a lot.

Link to comment
Share on other sites

  • 0

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 by xdem
Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...