Skip to content

Allow PredicatePermissions to return a PermissionResult#545

Merged
jpenilla merged 28 commits intoIncendo:2.0.0-devfrom
Konicai:feature/permission-result
Jan 14, 2024
Merged

Allow PredicatePermissions to return a PermissionResult#545
jpenilla merged 28 commits intoIncendo:2.0.0-devfrom
Konicai:feature/permission-result

Conversation

@Konicai
Copy link
Copy Markdown
Contributor

@Konicai Konicai commented Dec 5, 2023

A few things:

  • Will add a better PR description tomorrow, probably
  • Will javadoc and fix checkstyle issues tomorrow, probably
  • It seems like AndPermission and OrPermission had loose definitions of what to do when empty. OrPermission already resulted in false, but I added a check for AndPermission so that it now also results in false. I was thinking of requiring a non-empty Set in their constructors, and also moving the iteration to the respective classes. Can't move much more up without introducing a generic to CommandPermission, which seems yucky.
  • I was originally going to make PermissionLevelResult with a private constructor and a static factory method. But then I figured that it wouldn't hurt to allow the class to be extended. So then I was looking at a protected constructor and a static factory method, and I figured to just have a public constructor. It feels like I'm getting bureaucratic. Maybe a middle ground?

@jpenilla jpenilla added enhancement New feature or request 2.0.0 labels Dec 6, 2023
@Konicai Konicai force-pushed the feature/permission-result branch from da24f3b to bc3ef11 Compare December 6, 2023 09:15
Copy link
Copy Markdown
Member

@Citymonstret Citymonstret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is good stuff :)

I've left some nit-picky comments about code style and I'm sorry about that, but as they're all suggestions we can just batch them up before merging 😅

@jpenilla
Copy link
Copy Markdown
Member

jpenilla commented Dec 6, 2023

as mentioned on discord, the result for an empty and permission shouldn't be changed. but requiring a non empty set also sounds reasonable.

@Konicai
Copy link
Copy Markdown
Contributor Author

Konicai commented Dec 10, 2023

thank you - got busy the last couple days. I'll be able to finish this today or tomorrow

@Citymonstret
Copy link
Copy Markdown
Member

thank you - got busy the last couple days. I'll be able to finish this today or tomorrow

absolutely no rush, I just figured I'd help keep it up to date with 2.0.0-dev as it's still moving quite fast 😅

@Konicai
Copy link
Copy Markdown
Contributor Author

Konicai commented Dec 17, 2023

@jpenilla can i get some guidance/clarification on the direction i should take with AndPermission/OrPermission :)

# Conflicts:
#	cloud-core/src/main/java/cloud/commandframework/CommandManager.java
#	cloud-core/src/main/java/cloud/commandframework/CommandTree.java
#	cloud-core/src/main/java/cloud/commandframework/exceptions/NoPermissionException.java
#	cloud-core/src/main/java/cloud/commandframework/permission/AndPermission.java
#	cloud-core/src/main/java/cloud/commandframework/permission/CommandPermission.java
#	cloud-core/src/main/java/cloud/commandframework/permission/OrPermission.java
#	cloud-core/src/main/java/cloud/commandframework/permission/PredicatePermission.java
#	cloud-core/src/test/java/cloud/commandframework/CommandPermissionTest.java
@Citymonstret
Copy link
Copy Markdown
Member

I merged in the changes from #578, hopefully I didn't butcher it too badly.

# Conflicts:
#	cloud-core/src/main/java/cloud/commandframework/CommandTree.java
#	cloud-core/src/main/java/cloud/commandframework/exceptions/NoPermissionException.java
#	cloud-minecraft/cloud-fabric/src/main/java/cloud/commandframework/fabric/FabricClientCommandManager.java
#	cloud-minecraft/cloud-fabric/src/main/java/cloud/commandframework/fabric/FabricCommandManager.java
Citymonstret
Citymonstret previously approved these changes Jan 13, 2024
Citymonstret
Citymonstret previously approved these changes Jan 13, 2024
@Konicai
Copy link
Copy Markdown
Contributor Author

Konicai commented Jan 13, 2024

thank you for finishing it up... a bit taken by life right now 😆

@jpenilla jpenilla merged commit 539f336 into Incendo:2.0.0-dev Jan 14, 2024
@Konicai Konicai deleted the feature/permission-result branch January 14, 2024 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants