Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for config option update listener #87
Add support for config option update listener #87
Changes from 11 commits
9f15606
e058f0a
ca6d548
82e26fb
c5e40d7
d840c05
404b4bb
d9f7c7b
ba9177b
f0fd8d1
de08908
3af8235
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you need to check if the current option is the enabled one?
Either that or I don't get something about this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will run every time an update happens, yes, but
tryEnable
andtryDisable
don't do anything if the feature is already in the correct state. I can add a check for the field's name thoughThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we try to enable a feature by changing an unrelated setting?
Also, if it is not user enabled, why do we try to disable it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if it's not user enabled, the feature is supposed to be disabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't respect the condition system in place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the super calls will absolutely be forgotten when actually writing code, although I can't think of something better atm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The javax library contains the annotation
@OverridingMethodMustInvokeSuper
, which raises an error if the super method isn't called. We should be able to use this for peace of mindThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, looks like the annotation isn't fully implemented - although it will still cause a warning in intellij
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning should be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once again, I'm not convinced the "turn feature on or off" thing really should be a config like the others. It could just as well be seen as configurations on the FeatureRegistry. It has a bit of an odd ring to it, that a feature is configured to turn itself on or off. I can very much imagine a GUI where the "on/off" functionality of a feature is shown by a switch or checkbox next to the feature name in a list, but the configuration variables for that feature is shown on a config pane to the right of the list. Like the common model for how you enable/disable mods/plugins etc in one place, but configure them elsewhere.
Especially if this switch is making the "real" configuration options more complicated, by forcing the use of a super() call. I think this is a sign that feature-enabled is a property that should have special treatment, and not be considered a general config option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about making categories string constant in some files? What if we would want to change
Item Tooltips
towhatever new name
and you would need to do that manually (or using IDE's find and replace). I think something likeCategories.ITEM_TOOLTIPS
would fit here better.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this won't be a problem if we use translations for config stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further tracked in #94.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we use translations, I think it makes sense to have this an enum or a const defined in a class. It just makes it easier to make sure a typo don't ruin things, or do quickly go to all members of the category from the IDE. In general, using "raw" strings like this is not a good idea.