Skip to content

Conversation

@1robie
Copy link
Collaborator

@1robie 1robie commented Jan 8, 2026

This pull request focuses on improving type safety, documentation, and code clarity across the Button API 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 in Button, 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 ButtonManager to include overloads that accept default actions and behavioral flags, with nullability annotations for improved flexibility and clarity. [1] [2]

Documentation and Readability

  • Added and improved Javadoc comments throughout the Button class, especially for event handler methods, to clarify their purpose and usage. [1] [2] [3]

Consistency and Code Quality

  • Standardized field and method access by using this. consistently, improving code readability and maintainability. [1] [2]
  • Improved method naming and parameter usage for clarity, such as updating setter and getter methods to match their annotated types and expected nullability. [1] [2] [3] [4] [5]

These changes collectively enhance the reliability and maintainability of the API, making it easier for developers to use and extend safely.

Copy link
Contributor

Copilot AI left a 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 Config class to Configuration throughout 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();
}

Copy link

Copilot AI Jan 9, 2026

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.

Suggested change
@Override

Copilot uses AI. Check for mistakes.
public void openConfig(@NonNull Plugin plugin, @NonNull Player player) {
openConfig(plugin.getName(), player);
}

Copy link

Copilot AI Jan 9, 2026

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.

Suggested change
@Override

Copilot uses AI. Check for mistakes.
@Maxlego08 Maxlego08 merged commit e5d836c into Maxlego08:develop Jan 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants