feat: migrate commands to Paper Brigadier and update to 1.21.5#4
Open
RhythmicSys wants to merge 1 commit intomasterfrom
Open
feat: migrate commands to Paper Brigadier and update to 1.21.5#4RhythmicSys wants to merge 1 commit intomasterfrom
RhythmicSys wants to merge 1 commit intomasterfrom
Conversation
- bump Java to 21 and paper-api to 1.21.5 - switch `/back` and `/backreload` from CommandExecutor to lifecycle Brigadier registration - add command exception types for localized error/cooldown feedback - rename `Message` -> `LocaleMessage` and `Permissions` -> `BackPermission` - register permissions in code and remove command/permission blocks from plugin.yml - add new locale keys for invalid/missing player arguments
Peashooter101
approved these changes
Mar 7, 2026
Member
Peashooter101
left a comment
There was a problem hiding this comment.
Small changes requested. Otherwise, LGTM.
Comment on lines
+16
to
+21
| .requires(css -> css.getSender().hasPermission(BackPermission.BACK_RELOAD.getPermission())) | ||
| .executes(css -> { | ||
| ConfigHandler.getInstance().loadConfigValues(); | ||
| css.getSource().getSender().sendRichMessage(LocaleMessage.PLUGIN_RELOADED.getMessage()); | ||
| return Command.SINGLE_SUCCESS; | ||
| }); |
Member
There was a problem hiding this comment.
Do you want to create a separate method for readability and consistency with Back?
Comment on lines
+32
to
+36
| public static final DynamicCommandExceptionType COOLDOWN_NOT_FINISHED = new DynamicCommandExceptionType(time -> { | ||
| return MessageComponentSerializer.message().serialize( | ||
| MessageHandler.getParsedTimeMessage(LocaleMessage.ERROR_COOLDOWN, (long) time) | ||
| ); | ||
| }); |
Member
There was a problem hiding this comment.
This lambda function does not need to be bracketed with a return.
A -> B already implies A -> { return B; }
Suggested change
| public static final DynamicCommandExceptionType COOLDOWN_NOT_FINISHED = new DynamicCommandExceptionType(time -> { | |
| return MessageComponentSerializer.message().serialize( | |
| MessageHandler.getParsedTimeMessage(LocaleMessage.ERROR_COOLDOWN, (long) time) | |
| ); | |
| }); | |
| public static final DynamicCommandExceptionType COOLDOWN_NOT_FINISHED = new DynamicCommandExceptionType( | |
| time -> MessageComponentSerializer.message().serialize( | |
| MessageHandler.getParsedTimeMessage(LocaleMessage.ERROR_COOLDOWN, (long) time) | |
| ) | |
| ); |
Since this can be pretty hard to read, you can use the brackets with return, but you may want to break your single statement into multiple lines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR updates the plugin for current Paper versions and migrates command handling to the Brigadier/lifecycle API.
What's Changed
Upgraded platform targets:
17->211.20.4->1.21.51.20->1.21.5Replaced legacy CommandExecutor usage with Paper lifecycle command registration:
/backcommand now built with Brigadier/backreloadcommand now built with BrigadierAdded centralized Brigadier command exception definitions in commands/Exceptions for user-facing errors:
Refactored naming for clarity and as to not overlap with other names in Brig:
Message->LocaleMessagePermissions->BackPermissionMoved permission registration into runtime startup:
back.force- only for non-player-sendersSimplified
plugin.yml, changed topaper-plugin.yml:Added new locale message keys:
error.must-provide-playererror.player-invalidBehavior Notes
/back <player>which is specific to non-player senders with force-back permission.