Round shop balance and price per item.
This commit is contained in:
@@ -5,6 +5,9 @@ import com.alttd.playershops.shop.PlayerShop;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
// TODO document
|
||||
public class EconomyUtils {
|
||||
|
||||
@@ -55,4 +58,11 @@ public class EconomyUtils {
|
||||
// if we ever need to limit the maximum balance a shop can have this is the place
|
||||
return true;
|
||||
}
|
||||
|
||||
public static double round(double value) {
|
||||
BigDecimal bd = BigDecimal.valueOf(value);
|
||||
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
||||
return bd.doubleValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user