Fixes island creation on reservation.

New island panel was not being shown to reserved island players when
using /island or /island go.

https://github.com/BentoBoxWorld/BentoBox/issues/875
This commit is contained in:
tastybento 2019-08-02 10:29:41 -07:00
parent 91077ef895
commit d622c12425
2 changed files with 4 additions and 3 deletions

View File

@ -37,8 +37,9 @@ public class IslandGoCommand extends DelayedTeleportCommand {
return false;
}
if (island.isReserved()) {
// Send player to create and island
return getParent().getSubCommand("create").map(createCmd -> createCmd.call(user, createCmd.getLabel(), Collections.emptyList())).orElse(false);
// Send player to create an island
getParent().getSubCommand("create").ifPresent(createCmd -> createCmd.call(user, createCmd.getLabel(), Collections.emptyList()));
return false;
}
if ((getIWM().inWorld(user.getWorld()) && Flags.PREVENT_TELEPORT_WHEN_FALLING.isSetForWorld(user.getWorld()))
&& user.getPlayer().getFallDistance() > 0) {

View File

@ -208,7 +208,7 @@ public class IslandGoCommandTest {
when(im.getIsland(any(), any(UUID.class))).thenReturn(island);
when(ic.call(any(), any(), any())).thenReturn(true);
when(island.isReserved()).thenReturn(true);
assertTrue(igc.canExecute(user, igc.getLabel(), Collections.emptyList()));
assertFalse(igc.canExecute(user, igc.getLabel(), Collections.emptyList()));
verify(ic).call(any(), any(), any());
}