mirror of https://github.com/kami-blue/client
[enhancement] Disable AutoMine on Baritone cancel command
This commit is contained in:
parent
2cfb55f495
commit
0ead2f23eb
|
@ -1,6 +1,7 @@
|
||||||
package me.zeroeightsix.kami.module.modules.misc
|
package me.zeroeightsix.kami.module.modules.misc
|
||||||
|
|
||||||
import me.zeroeightsix.kami.command.Command
|
import me.zeroeightsix.kami.command.Command
|
||||||
|
import me.zeroeightsix.kami.event.events.BaritoneCommandEvent
|
||||||
import me.zeroeightsix.kami.event.events.ConnectionEvent
|
import me.zeroeightsix.kami.event.events.ConnectionEvent
|
||||||
import me.zeroeightsix.kami.event.events.SafeTickEvent
|
import me.zeroeightsix.kami.event.events.SafeTickEvent
|
||||||
import me.zeroeightsix.kami.mixin.extension.sendClickBlockToController
|
import me.zeroeightsix.kami.mixin.extension.sendClickBlockToController
|
||||||
|
@ -33,6 +34,10 @@ object AutoMine : Module() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDisable() {
|
||||||
|
BaritoneUtils.cancelEverything()
|
||||||
|
}
|
||||||
|
|
||||||
private fun run() {
|
private fun run() {
|
||||||
if (mc.player == null || isDisabled || manual.value) return
|
if (mc.player == null || isDisabled || manual.value) return
|
||||||
|
|
||||||
|
@ -56,19 +61,7 @@ object AutoMine : Module() {
|
||||||
MessageSendHelper.sendBaritoneCommand("mine", *blocks.toTypedArray())
|
MessageSendHelper.sendBaritoneCommand("mine", *blocks.toTypedArray())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDisable() {
|
|
||||||
BaritoneUtils.cancelEverything()
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
with(Setting.SettingListeners { run() }) {
|
|
||||||
iron.settingListener = this
|
|
||||||
diamond.settingListener = this
|
|
||||||
gold.settingListener = this
|
|
||||||
coal.settingListener = this
|
|
||||||
log.settingListener = this
|
|
||||||
}
|
|
||||||
|
|
||||||
listener<SafeTickEvent> {
|
listener<SafeTickEvent> {
|
||||||
if (manual.value) {
|
if (manual.value) {
|
||||||
mc.sendClickBlockToController(true)
|
mc.sendClickBlockToController(true)
|
||||||
|
@ -78,5 +71,19 @@ object AutoMine : Module() {
|
||||||
listener<ConnectionEvent.Disconnect> {
|
listener<ConnectionEvent.Disconnect> {
|
||||||
disable()
|
disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listener<BaritoneCommandEvent> { event ->
|
||||||
|
if (event.command.names.any { it.contains("cancel") }) {
|
||||||
|
disable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(Setting.SettingListeners { run() }) {
|
||||||
|
iron.settingListener = this
|
||||||
|
diamond.settingListener = this
|
||||||
|
gold.settingListener = this
|
||||||
|
coal.settingListener = this
|
||||||
|
log.settingListener = this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue