Jump to content
  • 0

Help Replaceall Thingy With Integer Code.


Devlin
 Share

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.
 Share



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disbaled AdBlock