From 2276f0ef458475a541fa31df52dfef012af2c260 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 29 Dec 2023 10:51:13 +0700 Subject: [PATCH] Fix zero decimal formatting --- src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt index 2147a53ab..7ca9fdc8f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt @@ -1350,8 +1350,10 @@ sealed class Decimal : Number(), Comparable { } override fun toString(decimals: Int): String { - if (decimals <= 0) + if (decimals == 0) return "0" + else if (decimals < 0) + return "0.0" else return "0." + "0".repeat(decimals) }