mirror of
https://github.com/CCBlueX/LiquidBounce.git
synced 2025-09-06 09:46:38 +00:00
fix: bind command unbind and key not found (#4247)
These cases were not really handled before, now it works as expected with formatted messages.
This commit is contained in:
@@ -56,8 +56,20 @@ object CommandBind {
|
||||
val module = ModuleManager.find { it.name.equals(name, true) }
|
||||
?: throw CommandException(command.result("moduleNotFound", name))
|
||||
|
||||
module.bind.bind(keyName)
|
||||
chat(regular(command.result("moduleBound", variable(module.name), variable(module.bind.keyName))))
|
||||
if (keyName.equals("none", true)) {
|
||||
module.bind.unbind()
|
||||
chat(regular(command.result("moduleUnbound", variable(module.name))))
|
||||
return@handler
|
||||
}
|
||||
|
||||
runCatching {
|
||||
module.bind.bind(keyName)
|
||||
}.onSuccess {
|
||||
chat(regular(command.result("moduleBound", variable(module.name), variable(module.bind.keyName))))
|
||||
}.onFailure {
|
||||
chat(markAsError(command.result("keyNotFound", variable(keyName))))
|
||||
}
|
||||
|
||||
}
|
||||
.build()
|
||||
}
|
||||
|
@@ -4,7 +4,9 @@
|
||||
"liquidbounce.command.bind.parameter.key.description": "Key to which the module should be bound.",
|
||||
"liquidbounce.command.bind.parameter.name.description": "Name of the module.",
|
||||
"liquidbounce.command.bind.result.moduleBound": "Bound module \"%s\" to key \"%s\".",
|
||||
"liquidbounce.command.bind.result.moduleUnbound": "Unbound module \"%s\".",
|
||||
"liquidbounce.command.bind.result.moduleNotFound": "Module \"%s\" was not found.",
|
||||
"liquidbounce.command.bind.result.keyNotFound": "Key \"%s\" was not found.",
|
||||
"liquidbounce.command.binds.description": "Binds a module to a key.",
|
||||
"liquidbounce.command.binds.subcommand.add.description": "Adds a new bind.",
|
||||
"liquidbounce.command.binds.subcommand.add.parameter.key.description": "Key to which the module should be bound.",
|
||||
|
Reference in New Issue
Block a user