diff --git a/pom.xml b/pom.xml
index e49d241f5..88aac5660 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
-LOCAL
- 2.6.0
+ 2.7.0
bentobox-world
https://sonarcloud.io
${project.basedir}/lib
diff --git a/src/main/java/world/bentobox/bentobox/managers/IslandsManager.java b/src/main/java/world/bentobox/bentobox/managers/IslandsManager.java
index 464ad9602..b85781153 100644
--- a/src/main/java/world/bentobox/bentobox/managers/IslandsManager.java
+++ b/src/main/java/world/bentobox/bentobox/managers/IslandsManager.java
@@ -442,7 +442,7 @@ public class IslandsManager {
: Optional.empty();
}
- public boolean isIslandAd(@NonNull Location location) {
+ public boolean isIslandAt(@NonNull Location location) {
return plugin.getIWM().inWorld(location) ? islandCache.isIslandAt(location) : false;
}
diff --git a/src/main/java/world/bentobox/bentobox/managers/island/DefaultNewIslandLocationStrategy.java b/src/main/java/world/bentobox/bentobox/managers/island/DefaultNewIslandLocationStrategy.java
index 46994fac7..fc5ecab3b 100644
--- a/src/main/java/world/bentobox/bentobox/managers/island/DefaultNewIslandLocationStrategy.java
+++ b/src/main/java/world/bentobox/bentobox/managers/island/DefaultNewIslandLocationStrategy.java
@@ -74,7 +74,9 @@ public class DefaultNewIslandLocationStrategy implements NewIslandLocationStrate
*/
protected Result isIsland(Location location) {
// Quick check
- if (plugin.getIslands().getIslandAt(location).isPresent()) return Result.ISLAND_FOUND;
+ if (plugin.getIslands().isIslandAt(location)) {
+ return Result.ISLAND_FOUND;
+ }
World world = location.getWorld();
diff --git a/src/main/java/world/bentobox/bentobox/managers/island/IslandGrid.java b/src/main/java/world/bentobox/bentobox/managers/island/IslandGrid.java
index 82120a986..8afed14a2 100644
--- a/src/main/java/world/bentobox/bentobox/managers/island/IslandGrid.java
+++ b/src/main/java/world/bentobox/bentobox/managers/island/IslandGrid.java
@@ -37,7 +37,7 @@ class IslandGrid {
// Check if we know about this island already
int minX = island.getMinX();
int minZ = island.getMinZ();
- IslandData islandData = new IslandData(island.getUniqueId(), minZ, minZ, island.getRange());
+ IslandData islandData = new IslandData(island.getUniqueId(), minX, minZ, island.getRange());
if (grid.containsKey(minX)) {
TreeMap zEntry = grid.get(minX);
if (zEntry.containsKey(minZ)) {
@@ -99,7 +99,7 @@ class IslandGrid {
* Checks if an island is at this coordinate or not
* @param x coord
* @param z coord
- * @return true if there is an island registered in the grid
+ * @return true if there is an island registered here in the grid
*/
public boolean isIslandAt(int x, int z) {
return getIslandStringAt(x, z) != null;
@@ -124,8 +124,8 @@ class IslandGrid {
return null; // No z-coordinate entry found, return null
}
// Check if the specified coordinates are within the island space
- if (x >= zEntry.getValue().minX() && x < zEntry.getValue().minX() + zEntry.getValue().range() * 2
- && z >= zEntry.getValue().minZ() && z < zEntry.getValue().minZ() + zEntry.getValue().range() * 2) {
+ if (x >= zEntry.getValue().minX() && x < (zEntry.getValue().minX() + zEntry.getValue().range() * 2)
+ && z >= zEntry.getValue().minZ() && z < (zEntry.getValue().minZ() + zEntry.getValue().range() * 2)) {
return zEntry.getValue().id();
}
return null;
diff --git a/src/test/java/world/bentobox/bentobox/managers/island/IslandCacheTest.java b/src/test/java/world/bentobox/bentobox/managers/island/IslandCacheTest.java
index 787459983..b9a1c283f 100644
--- a/src/test/java/world/bentobox/bentobox/managers/island/IslandCacheTest.java
+++ b/src/test/java/world/bentobox/bentobox/managers/island/IslandCacheTest.java
@@ -137,6 +137,7 @@ public class IslandCacheTest extends AbstractCommonSetup {
when(island.getMemberSet()).thenReturn(members.build());
when(island.getMinX()).thenReturn(-200);
when(island.getMinZ()).thenReturn(-200);
+ when(island.getRange()).thenReturn(400);
// database must be mocked here
db = mock(Database.class);
@@ -234,12 +235,10 @@ public class IslandCacheTest extends AbstractCommonSetup {
Location location2 = mock(Location.class);
when(location2.getWorld()).thenReturn(world);
- when(location2.getBlockX()).thenReturn(10);
- when(location2.getBlockY()).thenReturn(10);
- when(location2.getBlockZ()).thenReturn(10);
+ when(location2.getBlockX()).thenReturn(10000);
+ when(location2.getBlockY()).thenReturn(100);
+ when(location2.getBlockZ()).thenReturn(10000);
- assertEquals(island, ic.getIslandAt(location2));
- when(island.inIslandSpace(any(Integer.class), any(Integer.class))).thenReturn(false);
assertNull(ic.getIslandAt(location2));
}