-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBedwarsOverlay$Command.kt
70 lines (63 loc) · 2.26 KB
/
BedwarsOverlay$Command.kt
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package me.monmcgt.code.commands.impl.overlay
import me.monmcgt.code.commands.CommandAbstract
import me.monmcgt.code.commands.CommandInfo
import me.monmcgt.code.commands.addPrefix
import me.monmcgt.code.commands.impl.overlay.impl.autoqueue.`BedwarsOverlay$Command$AutoQueue`
import me.monmcgt.code.commands.impl.overlay.impl.party.`BedwarsOverlay$Command$Party`
import me.monmcgt.code.commands.impl.overlay.impl.player.`BedwarsOverlay$Command$Player`
import me.monmcgt.code.commands.impl.overlay.impl.who.`BedwarsOverlay$Command$Who`
import me.monmcgt.code.commands.printChat
import me.monmcgt.code.helpers.red
import me.monmcgt.code.util.checkModuleCommandArgs
import me.monmcgt.code.util.isHypixel
import me.monmcgt.code.util.toChatMessage
@CommandInfo(
["bedwars", "bw"],
)
class `BedwarsOverlay$Command` : CommandAbstract() {
companion object {
@JvmStatic
var isApiKeyValid = false
/*get() {
println("Getting isApikeyValid = $field")
return field
}
set(value) {
println("Setting isApikeyValid = $value")
field = value
}*/
}
override val subCommands: MutableList<CommandAbstract>
get() = arrayListOf(
`BedwarsOverlay$Command$Player`(),
`BedwarsOverlay$Command$Who`(),
`BedwarsOverlay$Command$Party`(),
`BedwarsOverlay$Command$AutoQueue`,
)
override fun execute() {
if (!isApiKeyValid) {
val message = "${red}Your API key is invalid."
printChatPrefix(message)
return
}
if (checkModuleCommandArgs(this)) {
runSubCommand = true
runPreSubCommand = true
}
}
override fun preRunSubCommand(subCommands: MutableList<CommandAbstract>) {
if (isHypixel()) {
return
}
val allowedClasses = arrayListOf(
`BedwarsOverlay$Command$Player`::class.java,
)
subCommands.forEach {
val contains = !allowedClasses.contains(it::class.java)
if (contains) {
"${red}You must be on Hypixel to use this command.".toChatMessage().addPrefix().printChat()
subCommands.remove(it)
}
}
}
}