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

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..