Kingdomkey01
June 10th, 2011, 02:47
This takes your KDR command and cuts off any numbers after the hundredths place.
Before:
"My KDR is: 0.3427987234"
After:
"My KDR is 0.34"
This is the command that I use
if (cmd.equalsIgnoreCase("kdr") || cmd.equalsIgnoreCase("ratio")) {
DecimalFormat df = new DecimalFormat("#.##");
double ratio = ((double) c.pkPoints) / ((double) c.deathPoints);
c.say("My KDR is: " + df.format(ratio) + "");
}
Change the red to your own PKpoints and death points.
Add this import:
import java.text.DecimalFormat;
Before:
"My KDR is: 0.3427987234"
After:
"My KDR is 0.34"
This is the command that I use
if (cmd.equalsIgnoreCase("kdr") || cmd.equalsIgnoreCase("ratio")) {
DecimalFormat df = new DecimalFormat("#.##");
double ratio = ((double) c.pkPoints) / ((double) c.deathPoints);
c.say("My KDR is: " + df.format(ratio) + "");
}
Change the red to your own PKpoints and death points.
Add this import:
import java.text.DecimalFormat;