public static void setToggle(int joyIndex, String bindingKey, boolean b) {

    ControllerBinding binding = joyBindingsMap.get(bindingKey);
    boolean changed = false;
    if (b) {
      changed = binding.bindingOptions.add(BindingOptions.IS_TOGGLE);
    } else {
      changed = binding.bindingOptions.remove(BindingOptions.IS_TOGGLE);
    }

    if (changed) {
      setControllerBinding(joyIndex, bindingKey, binding);
    }
  }
  // call this when there is a possibility of a key change
  public static void checkIfBindingsNeedUpdating() {
    if (joyNo < 0) return;

    for (Map.Entry<String, ControllerBinding> entry : joyBindingsMap.entrySet()) {
      if (entry.getValue().inputEvent.isValid()
          && entry.getValue().keyCodes != null
          && entry.getValue().keyCodes.length >= 1
          && !entry.getKey().contains("user.")) {
        KeyBinding kb = McKeyBindHelper.getMinecraftKeyBind(entry.getKey());
        if (kb == null && entry.getKey().contains("joy."))
          kb = McKeyBindHelper.getMinecraftKeyBind(entry.getKey().replace("joy.", "key."));
        if (kb != null) {
          int keyCode = McObfuscationHelper.keyCode(kb);
          if (entry.getValue().keyCodes[0] != keyCode) {
            entry.getValue().keyCodes = new int[] {keyCode};
            setControllerBinding(joyNo, entry.getKey(), entry.getValue());
          }
        }
      }
    }
  }