make keybinds on booleans not silent

This commit is contained in:
Daniella / Tove 2024-05-30 21:43:44 +02:00
parent 520638a9f0
commit 6e094bd55a
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 9 additions and 4 deletions

View file

@ -120,11 +120,16 @@ public abstract class Feature extends ToggleButton implements SetCommand {
Component btn = new ToggleButton(config.value(), settings, config.value()).gate(gate).hover(description);
subComponents.add(btn);
if(keyBound != null) {
String keyBindString = config.value();
String keyBindString = "Toggle ";
if(!keyBound.value().isEmpty())
keyBindString = keyBound.value() + " " + keyBindString;
keyBindString += keyBound.value();
else
keyBindString += config.value();
String keyBindConfig = keyBindString + " Key";
KeyBind keyBind = new KeyBind(null, () -> btn.click(0, 0, 0), gate);
KeyBind keyBind = new KeyBind(null, () -> {
btn.click(0, 0, 0);
BaseBand.notify("Toggled " + config.value() + " in " + this + " " + (btn.green ? "§aon" : "§coff"));
}, gate);
subComponents.add(new KeyButton(keyBindString, settings, keyBindConfig).gate(AnyGate.get(f, this, null, keyBound.allowChangeGate())).hover(description));
BaseBand.registerUpdater(settings.linkWith(keyBind, KeyBind.KEY_FIELD).name(keyBindConfig));
BaseBand.registerKeyBind(keyBind);

View file

@ -41,7 +41,7 @@ public class ChatCrypt extends Feature {
@Config("Send")
@Description("Encrypt sent messages")
@KeyBound("Toggle")
@KeyBound
public boolean send;
@Config("Channel")