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 7c7186da3..3fcd85b4c 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 @@ -701,6 +701,14 @@ sealed class Decimal : Number(), Comparable { override val isFinite: Boolean get() = false + override fun equals(other: Any?): Boolean { + return this === other + } + + override fun hashCode(): Int { + return super.hashCode() + } + override fun compareTo(other: Decimal): Int { return if (other === this) 0 else 1 } @@ -942,6 +950,14 @@ sealed class Decimal : Number(), Comparable { override val isFinite: Boolean get() = false + override fun equals(other: Any?): Boolean { + return this === other + } + + override fun hashCode(): Int { + return super.hashCode() + } + override fun compareTo(other: Decimal): Int { return if (other === this) 0 else -1 } @@ -1177,6 +1193,14 @@ sealed class Decimal : Number(), Comparable { override val isFinite: Boolean get() = true + override fun equals(other: Any?): Boolean { + return this === other || other is Decimal && other.isZero + } + + override fun hashCode(): Int { + return super.hashCode() + } + override fun compareTo(other: Decimal): Int { return -other.signum() }