I'm coding this thing and i would like to add currency but i don't know how to implement the max .99 cent rule
Im using
public static double getBal(Player player){
if(!PlayerData.getPlayerDataFile(player).contains("Money")){
return 0.00;
}
double bal = PlayerData.getPlayerDataFile(player).getDouble("Money");
return bal;
}
So if i charge the player some amount it could end up as 2.9333333333 or something how could i fix this?
I charge them with
public static void setBal(Player player, double newBal){
PlayerData.setPlayerDataFileValue(player, "Money", newBal);
}