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.
Introduction
This PR removes/deprecates number of API calls because they are ambiguous when the player can have more than one island in the world. Instead, developers will need to either get the current primary island, or whichever one they required to check specifically.
Deprecated Methods
IslandCache:
public Set<UUID> getMembers(@NonNull World world, @NonNull UUID uuid, int minimumRank)
public UUID getOwner(@NonNull World world, @NonNull UUID uuid)
IslandsManager:
public Set<UUID> getMembers(@NonNull World world, @NonNull UUID playerUUID, int minimumRank)
public Set<UUID> getMembers(@NonNull World world, @NonNull UUID playerUUID)
public Location getSafeHomeLocation(@NonNull World world, @NonNull User user, String name)
public UUID getOwner(@NonNull World world, @NonNull UUID playerUUID)
public boolean isOwner(@NonNull World world, @NonNull UUID uniqueId)
The methods have been marked as Deprecated, but I recommend they are removed before we release 2.0.0, so they are really just left there so that if any Addons use them they can be sure to change their code. This usually involves getting the primary active island of the player, and checking the member set of the island directly.
As a result, a number of commands had to be rewritten to consider the context of the player making the call. For example,
setOwner
should run for the island the player is on currently.Admin Team Commands Will Need Rewriting
Where it gets tricky is with the admin team commands. These were all written with the assumption that the player has just one island. These command enable admins to add to/ remove from /disband teams. For now, they have been adjusted to apply to the user's current island. So, an admin will need to have to player on the island they want to edit. This is not great, and indeed makes it difficult to edit teams if the owner is not online. So, we need to come up with a way to handle admin team editing when there are multiple islands. For now, it's probably going to be "okay" and I'm not sure how often this commands are used anyway.
There was some code I removed around the concept of automatic transfer of island ownership to a player if the owner has not logged on for a long time. This was not actually ever finished and didn't do anything. With multi-islands, this is even more difficult to do, so for now, I removed it.