mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-25 20:25:16 +01:00
Remove island number check for owner transfer.
This is not needed anymore (we think).
This commit is contained in:
parent
af3b0bba2d
commit
e4836b9cef
@ -6,7 +6,6 @@ import java.util.UUID;
|
||||
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.api.events.island.IslandEvent;
|
||||
@ -64,14 +63,6 @@ public class IslandTeamSetownerCommand extends CompositeCommand {
|
||||
user.sendMessage("commands.island.team.setowner.errors.target-is-not-member");
|
||||
return false;
|
||||
}
|
||||
// Check how many islands target has
|
||||
int num = getIslands().getNumberOfConcurrentIslands(targetUUID, getWorld());
|
||||
int max = user.getPermissionValue(this.getIWM().getAddon(getWorld()).map(GameModeAddon::getPermissionPrefix).orElse("") + "island.number", this.getIWM().getWorldSettings(getWorld()).getConcurrentIslands());
|
||||
if (num >= max) {
|
||||
// Too many
|
||||
user.sendMessage("commands.island.team.setowner.errors.at-max");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -230,23 +230,23 @@ public class IslandTeamSetownerCommandTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.island.team.IslandTeamSetownerCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
* test method for {@link world.bentobox.bentobox.api.commands.island.team.islandteamsetownercommand#canexecute(world.bentobox.bentobox.api.user.user, java.lang.string, java.util.list)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCanExecuteUserStringListOfStringTargetAtMaxIslands() {
|
||||
when(im.inTeam(any(), any())).thenReturn(true);
|
||||
when(im.getOwner(any(), any())).thenReturn(uuid);
|
||||
UUID target = UUID.randomUUID();
|
||||
when(pm.getUUID(anyString())).thenReturn(target);
|
||||
when(im.getMembers(any(), any())).thenReturn(Set.of(target));
|
||||
@Nullable
|
||||
Island island = mock(Island.class);
|
||||
when(im.getIsland(any(), any(User.class))).thenReturn(island);
|
||||
@test
|
||||
public void testcanexecuteuserstringlistofstringtargetatmaxislands() {
|
||||
when(im.inteam(any(), any())).thenreturn(true);
|
||||
when(im.getowner(any(), any())).thenreturn(uuid);
|
||||
uuid target = uuid.randomuuid();
|
||||
when(pm.getuuid(anystring())).thenreturn(target);
|
||||
when(im.getmembers(any(), any())).thenreturn(set.of(target));
|
||||
@nullable
|
||||
island island = mock(island.class);
|
||||
when(im.getisland(any(), any(user.class))).thenreturn(island);
|
||||
|
||||
when(im.getNumberOfConcurrentIslands(target, world)).thenReturn(3);
|
||||
when(im.getnumberofconcurrentislands(target, world)).thenreturn(3);
|
||||
|
||||
assertFalse(its.canExecute(user, "", List.of("tastybento")));
|
||||
verify(user).sendMessage("commands.island.team.setowner.errors.at-max");
|
||||
assertfalse(its.canexecute(user, "", list.of("tastybento")));
|
||||
verify(user).sendmessage("commands.island.team.setowner.errors.at-max");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -262,24 +262,6 @@ public class IslandTeamSetownerCommandTest {
|
||||
verify(user).sendMessage("commands.island.team.setowner.errors.target-is-not-member");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.island.team.IslandTeamSetownerCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringTooManyConcurrent() {
|
||||
when(im.getNumberOfConcurrentIslands(any(), eq(world))).thenReturn(20);
|
||||
when(im.inTeam(any(), any())).thenReturn(true);
|
||||
when(im.getOwner(any(), any())).thenReturn(uuid);
|
||||
UUID target = UUID.randomUUID();
|
||||
when(pm.getUUID(anyString())).thenReturn(target);
|
||||
when(im.getMembers(any(), any())).thenReturn(Set.of(target));
|
||||
@Nullable
|
||||
Island island = mock(Island.class);
|
||||
when(im.getIsland(any(), any(User.class))).thenReturn(island);
|
||||
assertFalse(its.canExecute(user, "", List.of("tastybento")));
|
||||
verify(user).sendMessage("commands.island.team.setowner.errors.at-max");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.island.team.IslandTeamSetownerCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user