Closed lokka30 closed 1 year ago
Would rather do that like the following.
CompletableFuture<Response<Map<UUID, PermissionHolder>>> retrievePermissionMap()
Would rather do that like the following.
CompletableFuture<Response<Map<UUID, PermissionHolder>>> retrievePermissionMap()
I see the merit in keeping a UUID map present, if we go for the permission holder solution then I would also prefer this option over eliminating both maps.
Thank you for your response by the way. :)
PermissionHolder has the potential of creating much bigger overhead rather than what is currently implemented. I don't understand what's your problem with the return type?
PermissionHolder has the potential of creating much bigger overhead rather than what is currently implemented. I don't understand what's your problem with the return type?
I can live with the unusual and verbose return type remaining (nesting a set of map entries inside a different map), though I'd like to see if it can be improved in any form before we make the choice final.
You're right about the overhead concern. What do you think about nesting the map instead of taking the weird side-road solution of using the set of map entries?
the current solution allows for caching entries. each time you call map#entrySet (afaik) the set of entries is always generated, hence greater overload. the current solution is good in many ways, as it is much easier to loop through it rather looping through a nested map.
I greatly appreciate you providing your opinion on this matter, I'm still unsure myself which way to go, though as you insist that the current solution is adequate, I'll close this issue and we'll leave it as-is 🙂
Issue
The return type of
Account#retrievePermissionsMap
is annoying, and in my opinion, unwarranted:Potential Solutions
I'll update this post over time with some potential solutions:
Nested Map Not only is this method easier to implement, it is more importantly easier for plugins to use, since they can quickly
get(...)
the account member's permission state map and then just as quicklyget(...)
the account permission they want to find the state of.PermissionHolder Object
Instead of returning a nested map (or any Map for that matter), a set of permission holder objects is returned.
The permission holder object would contain the UUID of its associated account member, and an internal map of permission states.
This is the easiest solution for users, and it's likely easier to implement than the current return type on the economy provider side of things.
Current Opinions
@lokka30
@MrIvanPlays
@yannicklamprecht
I would appreciate to hear the opinions of @MrIvanPlays, @yannicklamprecht, and anyone else who is interested in partaking in this discussion.