Jump to content
  • 0

Replaceall Thingy With Integer Code.


Question

Posted

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.

4 answers to this question

Recommended Posts

  • 0
Posted

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

 

this should work like a charm

  • 0
Posted

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

 

this should work like a charm

Yeah, thanks a lot.

  • 0
Posted (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 by xdem
  • 0
Posted

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.

Guest
This topic is now closed to further replies.


×
×
  • 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 Disabled AdBlock