-
-
Notifications
You must be signed in to change notification settings - Fork 20
GH-990 Add custom command feature #1064
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
Conversation
Signed-off-by: vLuckyyy <[email protected]>
WalkthroughThis update adds a complete system for custom commands. It introduces a Estimated code review effort3 (~45 minutes) ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
📦 Development Build ReadyWarning Do not use this build in production. It is for testing purposes only and may be unstable. |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandRegistry.java (1)
35-45: Add null safety checks for command properties.Consider adding validation to ensure command properties aren't null before creating the wrapper, which could prevent runtime issues.
private void registerCustomCommand(CustomCommand customCommand) { + if (customCommand.getCommandName() == null || customCommand.getCommandName().isEmpty()) { + return; // Skip invalid commands + } + CustomCommandBukkitWrapper customCommandBukkitWrapper = new CustomCommandBukkitWrapper(
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommand.java(1 hunks)eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandBukkitWrapper.java(1 hunks)eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandConfig.java(1 hunks)eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandRegistry.java(1 hunks)eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandSetup.java(1 hunks)
🧠 Learnings (1)
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandConfig.java (1)
Learnt from: vLuckyyy
PR: #856
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/data/WarpDataConfig.java:19-20
Timestamp: 2025-01-12T13:03:07.239Z
Learning: Configuration classes in EternalCore (those implementing ReloadableConfig and annotated with @ConfigurationFile) don't need thread-safe collections as they are managed by the configuration system which handles synchronization.
🧰 Additional context used
🧠 Learnings (1)
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandConfig.java (1)
Learnt from: vLuckyyy
PR: #856
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/data/WarpDataConfig.java:19-20
Timestamp: 2025-01-12T13:03:07.239Z
Learning: Configuration classes in EternalCore (those implementing ReloadableConfig and annotated with @ConfigurationFile) don't need thread-safe collections as they are managed by the configuration system which handles synchronization.
🔇 Additional comments (4)
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandSetup.java (1)
8-22: Clean setup implementation!This class follows the single responsibility principle well. The event-driven initialization approach is a good pattern for plugin startup.
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommand.java (1)
7-33: Good data model design!This class serves as a clean data model for custom commands. The public fields work well for configuration classes, and having both constructors gives flexibility.
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandBukkitWrapper.java (1)
11-40: Solid command wrapper implementation!The wrapper correctly extends Bukkit's Command and handles execution by sending the configured notice. Returning
trueis appropriate for these notification-style commands.eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandConfig.java (1)
16-142: Excellent configuration design with great examples!This config class provides comprehensive documentation and showcases different notification types beautifully. The example commands demonstrate the flexibility of the Notice system well.
...ore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandRegistry.java
Show resolved
Hide resolved
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.
Actionable comments posted: 4
🧹 Nitpick comments (1)
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommand.java (1)
21-23: Remove unnecessary static factory method.The static factory method
ofdoesn't add any value over the existing constructor and creates code duplication.-public static CustomCommand of(String commandName, List<String> aliases, Notice message) { - return new CustomCommand(commandName, aliases, message); -}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommand.java(1 hunks)eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandConfig.java(1 hunks)eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandRegistry.java(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandConfig.java
- eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandRegistry.java
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommand.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommand.java
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommand.java
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommand.java
Show resolved
Hide resolved
Jakubk15
left a comment
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.
Looks good to me, but I wonder whether it is possible to do through the LiteCommands library instead of using the Bukkit methods
...ore/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandBukkitWrapper.java
Outdated
Show resolved
Hide resolved
...ore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandRegistry.java
Outdated
Show resolved
Hide resolved
...lcore-core/src/main/java/com/eternalcode/core/feature/customcommand/CustomCommandConfig.java
Show resolved
Hide resolved
|
/gemini review |
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.
Code Review
This pull request introduces a new feature for creating custom commands via configuration. The implementation is solid and follows the project's structure. I've identified a few areas for improvement, mainly concerning data redundancy in the configuration that could lead to user errors, and some minor code style/readability enhancements. The most significant suggestion is to refactor how command names are handled to use the configuration map key as the single source of truth, which will make the feature more robust and intuitive for server administrators.
Fixes: #990 #480
Default Commands:





