blob: a797fd42e8c6608284add4e1ac4fa1792ea2dfe6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.utils.ChatUtils
object SkyBlockIslandTest {
var testIsland: IslandType? = null
fun onCommand(args: Array<String>) {
if (args.isEmpty()) {
ChatUtils.userError("Usage: /shtestisland <island name>/reset")
return
}
val search = args.joinToString(" ").lowercase()
if (search == "reset") {
testIsland?.let {
ChatUtils.chat("Disabled test island (was ${it.displayName})")
testIsland = null
return
}
ChatUtils.chat("Test island was not set.")
return
}
val found = find(search)
if (found == null) {
ChatUtils.userError("Unknown island type! ($search)")
return
}
testIsland = found
ChatUtils.chat("Set test island to ${found.displayName}")
}
private fun find(search: String): IslandType? {
for (type in IslandType.values()) {
if (type.name.equals(search, ignoreCase = true)) return type
if (type.displayName.equals(search, ignoreCase = true)) return type
}
return null
}
}
|