From ec79cfcdc90ac7c526a288cdb37383632b55fea2 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sat, 4 Jan 2025 12:51:16 +0100 Subject: fix: Overaggressive method stripping --- src/main/kotlin/moe/nea/ledger/ItemId.kt | 5 +++++ src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java (limited to 'src') diff --git a/src/main/kotlin/moe/nea/ledger/ItemId.kt b/src/main/kotlin/moe/nea/ledger/ItemId.kt index ade63fb..8211cd3 100644 --- a/src/main/kotlin/moe/nea/ledger/ItemId.kt +++ b/src/main/kotlin/moe/nea/ledger/ItemId.kt @@ -1,12 +1,16 @@ package moe.nea.ledger +import moe.nea.ledger.utils.NoSideEffects + data class ItemId( val string: String ) { + @NoSideEffects fun singleItem(): Pair { return withStackSize(1) } + @NoSideEffects fun withStackSize(size: Number): Pair { return Pair(this, size.toDouble()) } @@ -15,6 +19,7 @@ data class ItemId( companion object { @JvmStatic + @NoSideEffects fun forName(string: String) = ItemId(string) fun skill(skill: String) = ItemId("SKYBLOCK_SKILL_$skill") diff --git a/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java b/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java new file mode 100644 index 0000000..f432130 --- /dev/null +++ b/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java @@ -0,0 +1,8 @@ +package moe.nea.ledger.utils; + +import kotlin.annotation.AnnotationRetention; +import kotlin.annotation.Retention; + +@Retention(AnnotationRetention.BINARY) +public @interface NoSideEffects { +} -- cgit