mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-06-22 21:04:52 +02:00
Added test case for getSafeHomeLocationNoIsland() for player with no
island. https://github.com/BentoBoxWorld/BentoBox/pull/1651
This commit is contained in:
parent
737ad16ff6
commit
1eee225def
|
@ -625,8 +625,8 @@ public class IslandsManager {
|
|||
}
|
||||
// Home location either isn't safe, or does not exist so try the island
|
||||
// location
|
||||
if (plugin.getIslands().inTeam(world, user.getUniqueId())) {
|
||||
l = plugin.getIslands().getIslandLocation(world, user.getUniqueId());
|
||||
if (inTeam(world, user.getUniqueId())) {
|
||||
l = getIslandLocation(world, user.getUniqueId());
|
||||
if (l != null && isSafeLocation(l)) {
|
||||
plugin.getPlayers().setHomeLocation(user, l, number);
|
||||
return l;
|
||||
|
@ -639,7 +639,7 @@ public class IslandsManager {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
l = plugin.getIslands().getIslandLocation(world, user.getUniqueId());
|
||||
l = getIslandLocation(world, user.getUniqueId());
|
||||
if (l != null && isSafeLocation(l)) {
|
||||
plugin.getPlayers().setHomeLocation(user, l, number);
|
||||
return l.clone().add(new Vector(0.5D,0,0.5D));
|
||||
|
|
|
@ -721,6 +721,17 @@ public class IslandsManagerTest {
|
|||
when(iwm.inWorld(world)).thenReturn(false);
|
||||
assertNull(im.getSafeHomeLocation(world, user, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.managers.IslandsManager#getSafeHomeLocation(World, User, int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetSafeHomeLocationNoIsland() {
|
||||
IslandsManager im = new IslandsManager(plugin);
|
||||
when(pm.getHomeLocation(eq(world), eq(user), eq(0))).thenReturn(null);
|
||||
assertNull(im.getSafeHomeLocation(world, user, 0));
|
||||
verify(plugin).logWarning(eq("null player has no island in world world!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.managers.IslandsManager#getSpawnPoint(World)}.
|
||||
|
|
Loading…
Reference in New Issue
Block a user