mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Replace if cascade with when
This commit is contained in:
parent
0ade1f308c
commit
32293edd1a
1 changed files with 10 additions and 6 deletions
|
|
@ -52,9 +52,11 @@ class ShelfListener : InteractionListener {
|
|||
)
|
||||
|
||||
private val oakshelf_2_items = oakshelf_1_items.map { (name, itemId) ->
|
||||
if (name == "Cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7732 }
|
||||
else if (name == "Teapot") { "Teapot" to Items.TEAPOT_7714 }
|
||||
else { name to itemId}
|
||||
when (name) {
|
||||
"Cup" -> { "Porcelain cup" to Items.PORCELAIN_CUP_7732 }
|
||||
"Teapot" -> { "Teapot" to Items.TEAPOT_7714 }
|
||||
else -> { name to itemId}
|
||||
}
|
||||
} + listOf( "Pie dish" to Items.PIE_DISH_2313 )
|
||||
|
||||
private val teakshelf_1_items = oakshelf_2_items + listOf(
|
||||
|
|
@ -62,9 +64,11 @@ class ShelfListener : InteractionListener {
|
|||
)
|
||||
|
||||
private val teakshelf_2_items = teakshelf_1_items.map { (name, itemId) ->
|
||||
if (name == "Porcelain cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7735 }
|
||||
else if (name == "Teapot") { "Teapot" to Items.TEAPOT_7726 }
|
||||
else { name to itemId }
|
||||
when (name) {
|
||||
"Porcelain cup" -> { "Porcelain cup" to Items.PORCELAIN_CUP_7735 }
|
||||
"Teapot" -> { "Teapot" to Items.TEAPOT_7726 }
|
||||
else -> { name to itemId }
|
||||
}
|
||||
} + listOf( "Chef's Hat" to Items.CHEFS_HAT_1949 )
|
||||
|
||||
val shelves = mapOf(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue