Add back deprecated methods so developers can be wartned not to use them

This commit is contained in:
tastybento 2023-11-11 17:12:41 -08:00
parent 557c357d8a
commit b19b86435c
2 changed files with 38 additions and 35 deletions

View File

@ -448,14 +448,15 @@ public class IslandsManager {
* @param playerUUID - the player's UUID
* @param minimumRank - the minimum rank to be included in the set.
* @return Set of team UUIDs
* @deprecated This will be removed in 2.0 because it is ambiguous when a user
* has more than one island in the world.
*/
/*
* @Deprecated
*
* @NonNull public Set<UUID> getMembers(@NonNull World world, @NonNull UUID
* playerUUID, int minimumRank) { return islandCache.getMembers(world,
* playerUUID, minimumRank); }
*/
@Deprecated(since = "2.0", forRemoval = true)
@NonNull
public Set<UUID> getMembers(@NonNull World world, @NonNull UUID playerUUID, int minimumRank) {
return islandCache.getMembers(world, playerUUID, minimumRank);
}
/**
* Returns a set of island member UUID's for the island of playerUUID. Only
@ -466,14 +467,15 @@ public class IslandsManager {
* @param world - world to check
* @param playerUUID - the player's UUID
* @return Set of team UUIDs
* @deprecated This will be removed in 2.0 because it is ambiguous when a user
* has more than one island in the world.
*/
/*
* @Deprecated
*
* @NonNull public Set<UUID> getMembers(@NonNull World world, @NonNull UUID
* playerUUID) { return islandCache.getMembers(world, playerUUID,
* RanksManager.MEMBER_RANK); }
*/
@Deprecated(since = "2.0", forRemoval = true)
@NonNull
public Set<UUID> getMembers(@NonNull World world, @NonNull UUID playerUUID) {
return islandCache.getMembers(world, playerUUID, RanksManager.MEMBER_RANK);
}
/**
* Gets the maximum number of island members allowed on this island. Will update

View File

@ -267,17 +267,17 @@ public class IslandCache {
* @param minimumRank minimum rank requested
* @return set of UUID's of island members. If there are no islands, this set
* will be empty
* @deprecated Players can have more than one island
*/
/*
* @Deprecated
*
* @NonNull public Set<UUID> getMembers(@NonNull World world, @NonNull UUID
* uuid, int minimumRank) { return getIslands(world,
* uuid).stream().flatMap(island -> island.getMemberSet(minimumRank).stream())
* .collect(Collectors.toSet()); }
* @deprecated This will be removed in 2.0 because it is ambiguous when a user
* has more than one island in the world.
*/
@Deprecated(since = "2.0", forRemoval = true)
@NonNull
public Set<UUID> getMembers(@NonNull World world, @NonNull UUID uuid, int minimumRank) {
return getIslands(world, uuid).stream().flatMap(island -> island.getMemberSet(minimumRank).stream())
.collect(Collectors.toSet());
}
/**
* Get the UUID of the owner of the island of the player, which may be their
* UUID
@ -286,20 +286,21 @@ public class IslandCache {
* @param uuid the player's UUID
* @return island owner's UUID or null if there is no island owned by the player
* in this world
* @deprecated players can have multiple islands in the world, so this has no
* meaning any more
*/
/*
* @Deprecated
*
* @Nullable public UUID getOwner(@NonNull World world, @NonNull UUID uuid) {
* World w = Util.getWorld(world); Set<Island> islands =
* islandsByUUID.get(uuid); if (w == null || islands == null ||
* islands.isEmpty()) { return null; } // Find the island for this world return
* islands.stream().filter(i ->
* w.equals(i.getWorld())).findFirst().map(Island::getOwner).orElse(null); }
* @deprecated This will be removed in 2.0 because it is ambiguous when a user
* has more than one island in the world.
*/
@Deprecated(since = "2.0", forRemoval = true)
@Nullable
public UUID getOwner(@NonNull World world, @NonNull UUID uuid) {
World w = Util.getWorld(world);
Set<Island> islands = islandsByUUID.get(uuid);
if (w == null || islands == null || islands.isEmpty()) {
return null;
} // Find the island for this world return
return islands.stream().filter(i -> w.equals(i.getWorld())).findFirst().map(Island::getOwner).orElse(null);
}
/**
* Checks is a player has an island and owns it in this world. Note that players
* may have multiple islands so this means the player is an owner of ANY island.