Better fix for prices rounding

This commit is contained in:
Teriuihi 2022-09-02 03:38:43 +02:00 committed by Len
parent 4215d18ca5
commit a4065ee41c
2 changed files with 4 additions and 1 deletions

View File

@ -152,7 +152,7 @@ public class PlayerShop {
MiniMessage miniMessage = MiniMessage.miniMessage();
TagResolver tagResolver = TagResolver.resolver(
Placeholder.unparsed("ownername", getOwnerName()),
Placeholder.unparsed("price", trimPrice(String.valueOf(getPrice()))),
Placeholder.unparsed("price", trimPrice(String.valueOf(ShopUtil.round(getPrice())))),
Placeholder.unparsed("amount", String.valueOf(getAmount())),
Placeholder.component("itemname", ShopUtil.trimmedItemNameComponent(getItemStack()))
);

View File

@ -226,4 +226,7 @@ public class ShopUtil {
return sb.toString();
}
public static double round(double price) {
return (double) Math.round(price * 100) / 100;
}
}