-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getMembers() inconsistency #627
Comments
@tastybento We'll need to discuss about that. In my opinion, we should get rid of the "convenience" methods in the IslandsManager and just keep the If we take a closer look at what's happening here: BentoBox/src/main/java/world/bentobox/bentobox/managers/IslandsManager.java Lines 393 to 403 in 4d8bb71
And the Island Cache is returning... the #getMemberSet() method! BentoBox/src/main/java/world/bentobox/bentobox/managers/island/IslandCache.java Lines 161 to 174 in 4d8bb71
This can be error-prone (and it's likely already). That's why I'm putting this ticket to a High priority. |
In response to @DDuart's original post, let's look at why this is happening:
The issues here are as follows:
These issues can all be fixed easily. @Poslovitch's in regards to your recommendation, getMembers in IslandManager is used by many, many classes (36 times in BentoBox itself) and is very useful to have. If it was removed, those classes would have to add code to obtain the island object first, make sure it existed and then get the member set. That's a lot of duplicated code that could also be done incorrectly and cause bugs. If you can find a way to shrink the code burden or minimize duplication, I'm all for it, but let's not remove the methods To fix this bug I recommend we fix the JavaDoc and add an optional parameter to the IslandManager getMembers() method to stipulate the minimum rank requested. e.g., IslandManager.getMembers(world, user, RanksManager.TRUSTED) would provide all island members of TRUSTED and above. |
Okay, I get the point here. And it seems that the current implementation suffers from the fact that the island "members" are not only those who are actually members of it. How could we rename that field to better reflect what's going on in it? |
* Improves API and JavaDocs for getMembers #627 * Fixed indentation in Island
@Poslovitch In theory, the Island object could use the name rankedPlayers instead of members, but then all the existing games out there would end up not working. I think we're stuck with members for now. |
We can always use some deprecation. |
Create new method and current one deprecate... till next release. |
Yes, but the island members are stored in the database, so additional code would be required to transition from the older storage to the newer one. I'm afraid we're stuck with the current object layout and field names unless that's done, and that's a messy thing to do just to rename a method. |
Description
Describe the bug
getMembers()
from theIslandsManager
doesn't return TRUSTED players.Steps to reproduce the behavior
doesn't return TRUSTED players, but...
works fine.
The text was updated successfully, but these errors were encountered: