diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt index 73fc82622..368877079 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt @@ -13,11 +13,14 @@ class NEUInternalName private constructor(private val internalName: String) { val SKYBLOCK_COIN = "SKYBLOCK_COIN".asInternalName() fun String.asInternalName(): NEUInternalName { - val internalName = uppercase() + val internalName = uppercase().replace(" ", "_") return map.getOrPut(internalName) { NEUInternalName(internalName) } } - fun fromItemName(itemName: String) = NEUItems.getInternalNameFromItemName(itemName) + fun fromItemNameOrNull(itemName: String): NEUInternalName? = ItemNameResolver.getInternalNameOrNull(itemName) + + fun fromItemName(itemName: String): NEUInternalName = + fromItemNameOrNull(itemName) ?: throw Error("NEUInternalName is null for item name '$itemName'") } fun asString() = internalName |