Added nullability annotations in IslandCache, IslandsManager and Util

This commit is contained in:
Florian CUNY 2019-08-28 14:19:42 +02:00
parent d41f35e58d
commit 4e86441f6f
3 changed files with 5 additions and 1 deletions

View File

@ -338,6 +338,7 @@ public class IslandsManager {
* @param uuid user's uuid
* @return Island or null
*/
@Nullable
public Island getIsland(World world, UUID uuid){
return islandCache.get(world, uuid);
}
@ -369,6 +370,7 @@ public class IslandsManager {
* @return the islandCache
* @since 1.5.0
*/
@NonNull
public IslandCache getIslandCache() {
return islandCache;
}
@ -389,6 +391,7 @@ public class IslandsManager {
* @param uuid - the player's UUID
* @return Location of player's island or null if one does not exist
*/
@Nullable
public Location getIslandLocation(World world, UUID uuid) {
Island island = getIsland(world, uuid);
return island != null ? island.getCenter() : null;

View File

@ -165,7 +165,7 @@ public class IslandCache {
* @return set of UUID's of island members. If there is no island, this set will be empty
*/
@NonNull
public Set<UUID> getMembers(@NonNull World world, @NonNull UUID uuid, @NonNull int minimumRank) {
public Set<UUID> getMembers(@NonNull World world, @NonNull UUID uuid, int minimumRank) {
islandsByUUID.putIfAbsent(Util.getWorld(world), new HashMap<>());
Island island = islandsByUUID.get(Util.getWorld(world)).get(uuid);
if (island != null) {

View File

@ -219,6 +219,7 @@ public class Util {
* @param world - world
* @return over world
*/
@Nullable
public static World getWorld(@Nullable World world) {
return world == null ? null : world.getEnvironment().equals(Environment.NORMAL) ? world : Bukkit.getWorld(world.getName().replaceAll(NETHER, "").replaceAll(THE_END, ""));
}