mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-10-01 16:17:30 +02:00
parent
d926873992
commit
82ebc8b018
@ -67,14 +67,11 @@ public class IslandGrid {
|
||||
* @return Island or null
|
||||
*/
|
||||
public Island getIslandAt(int x, int z) {
|
||||
Table.Cell<Integer, Integer, Cell> tableCell = grid.cellSet()
|
||||
.stream()
|
||||
.filter(cell -> (cell.getValue().getState().equals(CellState.OCCUPIED)))
|
||||
.filter(cell -> ((Island) cell.getValue().getObject()).inIslandSpace(x, z))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
if (tableCell != null) {
|
||||
return (Island) tableCell.getValue().getObject();
|
||||
if (grid.contains(x, z)) {
|
||||
Cell cell = grid.get(x, z);
|
||||
if (cell.getState().equals(CellState.OCCUPIED)) {
|
||||
return (Island) cell.getObject();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -104,7 +101,7 @@ public class IslandGrid {
|
||||
* @author Poslovitch
|
||||
*/
|
||||
private enum CellState {
|
||||
//RESERVED,
|
||||
RESERVED,
|
||||
OCCUPIED
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,8 @@ public class IslandCacheTest {
|
||||
IslandsManager im = mock(IslandsManager.class);
|
||||
when(plugin.getIslands()).thenReturn(im);
|
||||
|
||||
|
||||
|
||||
island = mock(Island.class);
|
||||
when(island.getWorld()).thenReturn(world);
|
||||
location = mock(Location.class);
|
||||
@ -195,8 +197,14 @@ public class IslandCacheTest {
|
||||
assertNull(ic.getIslandAt(location2));
|
||||
}
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testGetMembers() {
|
||||
public void testGetIslands() {
|
||||
fail("Not yet implemented"); // TODO
|
||||
}
|
||||
*/
|
||||
@Test
|
||||
public void testgetMembers() {
|
||||
// New cache
|
||||
IslandCache ic = new IslandCache();
|
||||
ic.addIsland(island);
|
||||
|
Loading…
Reference in New Issue
Block a user