Command God Rework#184
Merged
Merged
Conversation
.getOrThrow causing problems in different versions, causing null
Quite a few various changes, - Added God Other permission node. - Tab completion - Streamlined code down should function correctly and allow adaptability. - Fixed syntax error when enabling God Mode.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the God command implementation to improve compatibility and functionality. The changes focus on replacing deprecated API usage and adding enhanced permission controls for managing god mode on other players.
Key changes:
- Replaced
.getOrThrow()with.get()in AttributeUtils to improve version compatibility - Enhanced God command with permission-based access control for targeting other players
- Added comprehensive error handling and improved user messaging
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| AttributeUtils.java | Refactored attribute retrieval to use .get() instead of .getOrThrow() for better compatibility |
| CommandGod.java | Added "god other" permission, tab completion, improved error handling, and enhanced messaging |
| Permission.java | Added new ESSENTIALS_GOD_OTHER permission enum value |
Two constants added at class level One line changed to use the constant instead of magic number One line added to set food level using the constant
✅ Reverts god mode state - user.setOption(Option.GOD, wasGodEnabled) ✅ Updates local variable - isGodEnabled = wasGodEnabled ✅ Maintains consistency - Player's god mode option matches their actual state ✅ Correct messaging - User gets the right message about the final state
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.
Had no idea how to edit previous PR so decided to create new one.
Changes:
AttributeUtilsfunction to avoid.getOrThrow, improving compatibility across versions.