mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-05 16:08:46 +01:00
Fixed probable NPEs in IslandsManager and IslandCache
This commit is contained in:
parent
e5170fc4b5
commit
1c3ccba3ae
@ -489,7 +489,8 @@ public class IslandsManager {
|
||||
* @param playerUUID the player's UUID
|
||||
* @return island owner's UUID or null if player has no island
|
||||
*/
|
||||
public UUID getOwner(World world, UUID playerUUID) {
|
||||
@Nullable
|
||||
public UUID getOwner(@NonNull World world, @NonNull UUID playerUUID) {
|
||||
return islandCache.getOwner(world, playerUUID);
|
||||
}
|
||||
|
||||
@ -686,8 +687,8 @@ public class IslandsManager {
|
||||
* @param uniqueId - unique ID
|
||||
* @return true if the player is the owner of their island.
|
||||
*/
|
||||
public boolean isOwner(World world, UUID uniqueId) {
|
||||
return hasIsland(world, uniqueId) && getIsland(world, uniqueId).getOwner().equals(uniqueId);
|
||||
public boolean isOwner(@NonNull World world, @NonNull UUID uniqueId) {
|
||||
return hasIsland(world, uniqueId) && uniqueId.equals(getIsland(world, uniqueId).getOwner());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,7 +179,7 @@ public class IslandCache {
|
||||
public boolean hasIsland(@NonNull World world, @NonNull UUID uuid) {
|
||||
islandsByUUID.putIfAbsent(Util.getWorld(world), new HashMap<>());
|
||||
Island island = islandsByUUID.get(Util.getWorld(world)).get(uuid);
|
||||
return island != null && island.getOwner().equals(uuid);
|
||||
return island != null && uuid.equals(island.getOwner());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user