From 52b3f184db9422faac19d6d6255d44c48ed8ab9e Mon Sep 17 00:00:00 2001 From: Tastybento Date: Sun, 11 Feb 2018 11:39:07 -0800 Subject: [PATCH] Fixed bug when creating new islands when there are islands in the world. If there are unowned and unknown islands in the island spaces then duplicate islands were being made when the search was done for new islands. --- .../database/managers/island/IslandCache.java | 19 +------------------ .../managers/island/IslandsManager.java | 2 +- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/main/java/us/tastybento/bskyblock/database/managers/island/IslandCache.java b/src/main/java/us/tastybento/bskyblock/database/managers/island/IslandCache.java index 76e44029c..2e6130c15 100644 --- a/src/main/java/us/tastybento/bskyblock/database/managers/island/IslandCache.java +++ b/src/main/java/us/tastybento/bskyblock/database/managers/island/IslandCache.java @@ -388,22 +388,5 @@ public class IslandCache { public int size() { return islandsByLocation.size(); } - - /** - * Get if the cache contains this island - * @param island or uuid of owner - * @return true if it is in the cache - */ - public boolean contains(Object o) { - if (o instanceof UUID) { - return islandsByUUID.containsKey(o); - } - if (o instanceof Island) { - Island is = (Island)o; - if (is.getOwner() != null && islandsByUUID.containsKey(is.getOwner())) { - return true; - } - } - return false; - } + } diff --git a/src/main/java/us/tastybento/bskyblock/database/managers/island/IslandsManager.java b/src/main/java/us/tastybento/bskyblock/database/managers/island/IslandsManager.java index d13f573fc..6fe9e561b 100644 --- a/src/main/java/us/tastybento/bskyblock/database/managers/island/IslandsManager.java +++ b/src/main/java/us/tastybento/bskyblock/database/managers/island/IslandsManager.java @@ -671,7 +671,7 @@ public class IslandsManager { return true; } location = getClosestIsland(location); - if (islandCache.contains(location)) { + if (islandCache.getIslandAt(location) != null) { return true; }