MidnightLib

MidnightLib

22M Downloads

Bug Report and Feature Enhancement Request for `@Condition` in MidnightConfig (1.7.0)

Jaffe2718 opened this issue ยท 0 comments

commented

Bug Report

Description:
The @Condition functionality is not working as expected for enum type fields. When modifying the value of an enum field in the settings, the @Condition does not trigger in real - time to update the menu UI. Instead, the user has to save the settings and reopen the settings menu UI for the @Condition functionality to take effect.

Steps to Reproduce:

  1. Open the settings menu with an enum type field annotated with @Condition.
  2. Change the value of the enum field.
  3. Observe that the UI elements affected by the @Condition do not update immediately.
  4. Save the settings and reopen the settings menu. The UI elements then update according to the @Condition.

Suspected Location:
Please check the function in eu.midnightdust.lib.config.MidnightConfig#initClient where the button controls are generated for enum type fields. It seems that the implementation is inconsistent with that of boolean type fields, as the @Condition trigger mechanism works correctly for boolean type fields. Additionally, please verify the @Condition functionality for other field types as well.

Feature Enhancement Request

Description:
We propose enhancing the @Condition annotation by making it @Repeatable. This would allow users to set multiple conditions for a single field, providing more flexibility in configuring the settings menu.

Use Case:
In some scenarios, a field may need to meet multiple conditions simultaneously or under different circumstances. For example, a setting might be enabled only when a certain mod is loaded and a specific option is set to a particular value. By making @Condition @Repeatable, we can easily implement such complex conditions.

Suggested Implementation:
Modify the @Condition annotation to be @Repeatable and update the relevant code in eu.midnightdust.lib.config.MidnightConfig to handle multiple @Condition annotations on a single field.

Thank you for your attention to these issues. We look forward to seeing improvements in the @Condition functionality.