Repository navigation
Add API for operator permission levels and bypassesPlayerLimit - #14193
Open
Mickey42302 wants to merge 10 commits into
Open
Mickey42302 wants to merge 10 commits into
Mickey42302 wants to merge 10 commits into
Conversation
Warriorrrr
requested changes
Oct 5, 2026
Warriorrrr
left a comment
Member
There was a problem hiding this comment.
Your branch is currently also failing to build due to missing imports
| * | ||
| * @return the permission level, or 0 if the player is not an operator or entry is missing | ||
| */ | ||
| int getOpLevel(); |
Member
There was a problem hiding this comment.
The @Range annotation can be used here to further indicate it only returning 0 through 4
| * @param level the level to set (must be between 0 and 4) | ||
| * @throws IllegalArgumentException if level is outside the 0–4 range | ||
| */ | ||
| void setOpLevel(int level); |
Member
There was a problem hiding this comment.
Same here regarding the range annotation
| @Override | ||
| public boolean bypassesPlayerLimit() { | ||
| ServerOpList opList = MinecraftServer.getServer().getPlayerList().getOps(); | ||
| NameAndId nameAndId = new NameAndId(this.getUniqueId(), this.getName() != null ? this.getName() : ""); |
Member
There was a problem hiding this comment.
All spots in this PR that create a new NameAndId can be by the nameAndId field (see isOp, setOp). Sometimes the nameAndId in the field does get created with an empty name, but that doesn't seem like a problem here.
Comment on lines
+643
to
+655
| PermissionLevel permLevel = PermissionLevel.byId(level); | ||
| ServerOpListEntry newEntry = new ServerOpListEntry( | ||
| nameAndId, | ||
| LevelBasedPermissionSet.forLevel(permLevel), | ||
| bypassesLimit | ||
| ); | ||
|
|
||
| opList.add(newEntry); | ||
|
|
||
| ServerPlayer serverPlayer = server.getPlayerList().getPlayer(this.getUniqueId()); | ||
| if (serverPlayer != null) { | ||
| server.getPlayerList().sendPlayerPermissionLevel(serverPlayer); | ||
| } |
Member
There was a problem hiding this comment.
Can be replaced by PlayerList#op
…Player.java Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
Contributor
Author
|
Is this better? |
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.
In light of the response I received to my pull request which adds the more advanced operator management commands, I've been working on converting the code to the plugin API.
This is what I have so far. Is this version of the code what Paper is looking for, or are more changes needed?
I apologise in advance if there are any errors/oversights. I am very new at contributing to the API instead of the server. I've also been having seizures again.