-
Notifications
You must be signed in to change notification settings - Fork 30
Improvement #211
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
Improvement #211
Conversation
chore: generate JavaDoc only for API module
…es across multiple classes
…igManager methods
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.
Pull request overview
This pull request focuses on improving type safety, code quality, and functionality across the zMenu plugin. The key changes include renaming the Config class to Configuration, introducing an action patterns system for applying default actions to buttons, adding comprehensive nullability and contract annotations for better IDE support and type safety, and enhancing MiniMessage support for toast messages.
Key Changes:
- Renamed
Configclass toConfigurationthroughout the entire codebase - Introduced action patterns system allowing default actions to be applied to buttons automatically
- Added extensive JetBrains and jspecify annotations (
@NotNull,@Nullable,@Contract,@NonNull) to API methods
Reviewed changes
Copilot reviewed 87 out of 88 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| API/src/main/java/fr/maxlego08/menu/api/configuration/Configuration.java | Renamed from Config.java, added annotations to methods and parameters |
| API/src/main/java/fr/maxlego08/menu/api/pattern/ActionPattern.java | New interface for action patterns feature |
| src/main/java/fr/maxlego08/menu/pattern/ZActionsPattern.java | Implementation of ActionPattern as a record |
| src/main/java/fr/maxlego08/menu/loader/ActionPatternLoader.java | Loader for action patterns from YAML configuration |
| API/src/main/java/fr/maxlego08/menu/api/requirement/Action.java | Added type field and getter/setter for action tracking |
| src/main/java/fr/maxlego08/menu/ZButtonManager.java | Updated to support action patterns with default action merging logic |
| build.gradle.kts | Updated Java toolchain to 21 and conditionally generate javadoc only for API module |
| Multiple button classes | Added @nonnull annotations to onClick method parameters |
| Multiple utility/manager classes | Updated Config references to Configuration |
| src/main/resources/actions_patterns/default-actions.yml | New example action pattern configuration file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public boolean hasPermission() { | ||
| return this.viewRequirement != null || super.hasPermission(); | ||
| } | ||
|
|
Copilot
AI
Jan 9, 2026
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 method overrides PlaceholderButton.checkPermission; it is advisable to add an Override annotation.
| @Override |
| public void openConfig(@NonNull Plugin plugin, @NonNull Player player) { | ||
| openConfig(plugin.getName(), player); | ||
| } | ||
|
|
Copilot
AI
Jan 9, 2026
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 method overrides ConfigManagerInt.openConfig; it is advisable to add an Override annotation.
| @Override |
…pes for improved null safety
This pull request focuses on improving type safety, documentation, and code clarity across the
ButtonAPI and related interfaces. The most significant changes are the addition of nullability annotations, contract annotations, and enhanced Javadoc comments, which help clarify method behaviors and expected parameters. These improvements make the codebase easier to understand, safer to use, and more robust for future development.API Improvements and Type Safety
Added extensive use of JetBrains annotations (
@NotNull,@Nullable,@Contract) to method parameters, return types, and classes inButton,DefaultButtonValue, and related classes to clarify nullability and method contracts. This improves code safety and helps IDEs catch potential bugs. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]Updated method signatures in
ButtonManagerto include overloads that accept default actions and behavioral flags, with nullability annotations for improved flexibility and clarity. [1] [2]Documentation and Readability
Buttonclass, especially for event handler methods, to clarify their purpose and usage. [1] [2] [3]Consistency and Code Quality
this.consistently, improving code readability and maintainability. [1] [2]These changes collectively enhance the reliability and maintainability of the API, making it easier for developers to use and extend safely.