Deprecated #getTeamLeader(...) methods

These have been deprecated in CompositeCommand, IslandCache and IslandsManager and they got replaced by #getOwner(...).
This commit is contained in:
Florian CUNY 2018-11-18 11:12:54 +01:00
parent f0218d9f2a
commit 0322ffe0ce
34 changed files with 91 additions and 54 deletions

View File

@ -386,9 +386,21 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* @param world - world to check
* @param user - the User
* @return UUID of player's team leader or null if user has no island
* @deprecated Renamed to {@link #getOwner(World, User)} for consistency.
*/
@Deprecated
protected UUID getTeamLeader(World world, User user) {
return plugin.getIslands().getTeamLeader(world, user.getUniqueId());
return getOwner(world, user);
}
/**
* Convenience method to obtain the user's island owner
* @param world world to check
* @param user -the User
* @return UUID of player's island owner or null if user has no island
*/
protected UUID getOwner(World world, User user) {
return plugin.getIslands().getOwner(world, user.getUniqueId());
}
@Override

View File

@ -43,7 +43,7 @@ public class AdminDeleteCommand extends ConfirmableCommand {
return false;
}
// Team leaders should be kicked before deleting otherwise the whole team will become weird
if (getIslands().inTeam(getWorld(), targetUUID) && getIslands().getTeamLeader(getWorld(), targetUUID).equals(targetUUID)) {
if (getIslands().inTeam(getWorld(), targetUUID) && getIslands().getOwner(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.delete.cannot-delete-team-leader");
return false;
}

View File

@ -42,7 +42,7 @@ public class AdminTeamAddCommand extends CompositeCommand {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
if (getIslands().inTeam(getWorld(), leaderUUID) && !getIslands().getTeamLeader(getWorld(), leaderUUID).equals(leaderUUID)) {
if (getIslands().inTeam(getWorld(), leaderUUID) && !getIslands().getOwner(getWorld(), leaderUUID).equals(leaderUUID)) {
user.sendMessage("commands.admin.team.add.name-not-leader", TextVariables.NAME, args.get(0));
getIslands().getIsland(getWorld(), leaderUUID).showMembers(getPlugin(), user, getWorld());
return false;

View File

@ -41,8 +41,8 @@ public class AdminTeamDisbandCommand extends CompositeCommand {
user.sendMessage("general.errors.not-in-team");
return false;
}
if (!getIslands().getTeamLeader(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.team.disband.use-disband-leader", "[leader]", getPlayers().getName(getIslands().getTeamLeader(getWorld(), targetUUID)));
if (!getIslands().getOwner(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.team.disband.use-disband-leader", "[leader]", getPlayers().getName(getIslands().getOwner(getWorld(), targetUUID)));
return false;
}
// Disband team

View File

@ -42,7 +42,7 @@ public class AdminTeamKickCommand extends CompositeCommand {
user.sendMessage("general.errors.not-in-team");
return false;
}
if (getIslands().getTeamLeader(getWorld(), targetUUID).equals(targetUUID)) {
if (getIslands().getOwner(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.team.kick.cannot-kick-leader");
getIslands().getIsland(getWorld(), targetUUID).showMembers(getPlugin(), user, getWorld());
return false;

View File

@ -41,7 +41,7 @@ public class AdminTeamSetownerCommand extends CompositeCommand {
user.sendMessage("general.errors.not-in-team");
return false;
}
if (getIslands().getTeamLeader(getWorld(), targetUUID).equals(targetUUID)) {
if (getIslands().getOwner(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.team.setowner.already-owner");
return false;
}

View File

@ -41,7 +41,7 @@ public class IslandTeamLeaveCommand extends ConfirmableCommand {
}
private void leave(User user) {
UUID leaderUUID = getIslands().getTeamLeader(getWorld(), user.getUniqueId());
UUID leaderUUID = getIslands().getOwner(getWorld(), user.getUniqueId());
if (leaderUUID != null) {
User.getInstance(leaderUUID).sendMessage("commands.island.team.leave.left-your-island", TextVariables.NAME, user.getName());
}

View File

@ -394,7 +394,7 @@ public class IslandsManager {
return l;
} else {
// try team leader's home
Location tlh = plugin.getPlayers().getHomeLocation(world, plugin.getIslands().getTeamLeader(world, user.getUniqueId()));
Location tlh = plugin.getPlayers().getHomeLocation(world, plugin.getIslands().getOwner(world, user.getUniqueId()));
if (tlh != null && isSafeLocation(tlh)) {
plugin.getPlayers().setHomeLocation(user, tlh, number);
return tlh;
@ -455,13 +455,26 @@ public class IslandsManager {
}
/**
* Provides UUID of this player's team leader or null if it does not exist
* Provides UUID of this player's island owner or null if it does not exist
* @param world - world to check
* @param leaderUUID - the leader's UUID
* @return UUID of leader or null if player has no island
* @param playerUUID - the player's UUID
* @return island owner's UUID or null if player has no island
*
* @deprecated Renamed to {@link #getOwner(World, UUID)} for consistency.
*/
public UUID getTeamLeader(World world, UUID leaderUUID) {
return islandCache.getTeamLeader(world, leaderUUID);
@Deprecated
public UUID getTeamLeader(World world, UUID playerUUID) {
return getOwner(world, playerUUID);
}
/**
* Provides UUID of this player's island owner or null if it does not exist
* @param world world to check
* @param playerUUID the player's UUID
* @return island owner's UUID or null if player has no island
*/
public UUID getOwner(World world, UUID playerUUID) {
return islandCache.getOwner(world, playerUUID);
}
/**

View File

@ -143,8 +143,20 @@ public class IslandCache {
* @param world - the world to check
* @param uuid - player's uuid
* @return team leader's UUID, the player UUID if they are not in a team, or null if there is no island
*
* @deprecated Renamed to {@link #getOwner(World, UUID)} for consistency.
*/
@Deprecated
public UUID getTeamLeader(World world, UUID uuid) {
return getOwner(world, uuid);
}
/**
* @param world the world to check
* @param uuid the player's UUID
* @return island owner's UUID, the player UUID if they are not in a team, or null if there is no island
*/
public UUID getOwner(World world, UUID uuid) {
islandsByUUID.putIfAbsent(Util.getWorld(world), new HashMap<>());
Island island = islandsByUUID.get(Util.getWorld(world)).get(uuid);
if (island != null) {

View File

@ -94,7 +94,7 @@ public class AdminClearresetsCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team

View File

@ -85,7 +85,7 @@ public class AdminClearresetsallCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team

View File

@ -100,7 +100,7 @@ public class AdminDeleteCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team
@ -164,7 +164,7 @@ public class AdminDeleteCommandTest {
@Test
public void testExecuteTeamLeader() {
when(im.inTeam(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(notUUID);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(notUUID);
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
AdminDeleteCommand itl = new AdminDeleteCommand(ac);
@ -178,7 +178,7 @@ public class AdminDeleteCommandTest {
@Test
public void testExecuteSuccess() {
when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(false);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
Island is = mock(Island.class);
Location loc = mock(Location.class);
when(loc.toVector()).thenReturn(new Vector(123,123,432));

View File

@ -95,7 +95,7 @@ public class AdminInfoCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team

View File

@ -93,7 +93,7 @@ public class AdminRegisterCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team

View File

@ -93,7 +93,7 @@ public class AdminTeleportCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team

View File

@ -91,7 +91,7 @@ public class AdminUnregisterCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team

View File

@ -84,7 +84,7 @@ public class AdminRangeCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team

View File

@ -87,7 +87,7 @@ public class AdminRangeDisplayCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team

View File

@ -94,7 +94,7 @@ public class AdminRangeResetCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
Island island = mock(Island.class);
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island);
when(plugin.getIslands()).thenReturn(im);

View File

@ -94,7 +94,7 @@ public class AdminRangeSetCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
Island island = mock(Island.class);
when(island.getRange()).thenReturn(50);
when(island.getProtectionRange()).thenReturn(50);

View File

@ -87,7 +87,7 @@ public class AdminTeamAddCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team
@ -203,7 +203,7 @@ public class AdminTeamAddCommandTest {
// Has island, has team, but not a leader
when(im.hasIsland(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
when(im.inTeam(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.eq(uuid))).thenReturn(notUUID);
when(im.getOwner(Mockito.any(),Mockito.eq(uuid))).thenReturn(notUUID);
// Island
Island island = mock(Island.class);
@ -228,7 +228,7 @@ public class AdminTeamAddCommandTest {
// Has island, has team, is leader
when(im.hasIsland(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
when(im.inTeam(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.eq(uuid))).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(uuid);
// Target has island
when(im.hasIsland(Mockito.any(), Mockito.eq(notUUID))).thenReturn(true);

View File

@ -92,7 +92,7 @@ public class AdminTeamDisbandCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team
@ -158,7 +158,7 @@ public class AdminTeamDisbandCommandTest {
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
when(pm.getName(Mockito.any())).thenReturn("leader");
AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac);
@ -177,7 +177,7 @@ public class AdminTeamDisbandCommandTest {
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
// Leader
when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID);
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID);
// Members
Set<UUID> members = new HashSet<>();
members.add(uuid);

View File

@ -94,7 +94,7 @@ public class AdminTeamKickCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team
@ -161,7 +161,7 @@ public class AdminTeamKickCommandTest {
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID);
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID);
AdminTeamKickCommand itl = new AdminTeamKickCommand(ac);
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
@ -180,7 +180,7 @@ public class AdminTeamKickCommandTest {
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
AdminTeamKickCommand itl = new AdminTeamKickCommand(ac);
assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name)));

View File

@ -92,7 +92,7 @@ public class AdminTeamSetownerCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
when(im.isOwner(Mockito.any(),Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(),Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team
@ -159,7 +159,7 @@ public class AdminTeamSetownerCommandTest {
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID);
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID);
AdminTeamSetownerCommand itl = new AdminTeamSetownerCommand(ac);
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
@ -177,7 +177,7 @@ public class AdminTeamSetownerCommandTest {
String[] name = {"tastybento"};
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
// Leader
when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
when(pm.getName(Mockito.eq(uuid))).thenReturn("owner");
// Members
Set<UUID> members = new HashSet<>();

View File

@ -97,7 +97,7 @@ public class IslandTeamCoopCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.inTeam(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
island = mock(Island.class);
when(island.getRank(Mockito.any())).thenReturn(RanksManager.OWNER_RANK);
when(im.getIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(island);

View File

@ -95,7 +95,7 @@ public class IslandTeamInviteCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.inTeam(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
island = mock(Island.class);
when(island.getRank(Mockito.any())).thenReturn(RanksManager.OWNER_RANK);
when(im.getIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(island);

View File

@ -102,7 +102,7 @@ public class IslandTeamKickCommandTest {
im = mock(IslandsManager.class);
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);
// Has team
@ -143,7 +143,7 @@ public class IslandTeamKickCommandTest {
*/
@Test
public void testExecuteNotTeamLeader() {
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(notUUID);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(notUUID);
IslandTeamKickCommand itl = new IslandTeamKickCommand(ic);
assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>()));
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-leader"));

View File

@ -134,7 +134,7 @@ public class IslandTeamLeaveCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
// Add a team leader - null
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(null);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(null);
IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic);
assertTrue(itl.execute(user, itl.getLabel(), new ArrayList<>()));
@ -153,7 +153,7 @@ public class IslandTeamLeaveCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
// Add a team leader - null
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(null);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(null);
IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic);
assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>()));
@ -170,7 +170,7 @@ public class IslandTeamLeaveCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
// Add a team leader - null
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(null);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(null);
// Require resets
when(iwm.isOnLeaveResetEnderChest(Mockito.any())).thenReturn(true);

View File

@ -97,7 +97,7 @@ public class IslandTeamTrustCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.inTeam(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
island = mock(Island.class);
when(island.getRank(Mockito.any())).thenReturn(RanksManager.OWNER_RANK);
when(im.getIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(island);

View File

@ -97,7 +97,7 @@ public class IslandTeamUncoopCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.inTeam(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
island = mock(Island.class);
when(island.getRank(Mockito.any())).thenReturn(RanksManager.OWNER_RANK);
when(im.getIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(island);

View File

@ -97,7 +97,7 @@ public class IslandTeamUntrustCommandTest {
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.inTeam(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
island = mock(Island.class);
when(island.getRank(Mockito.any())).thenReturn(RanksManager.OWNER_RANK);
when(im.getIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(island);

View File

@ -127,7 +127,7 @@ public class NetherPortalsTest {
im = mock(IslandsManager.class);
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
Optional<Island> optionalIsland = Optional.empty();
when(im.getIslandAt(Mockito.any())).thenReturn(optionalIsland);
when(plugin.getIslands()).thenReturn(im);

View File

@ -124,7 +124,7 @@ public class PlayersManagerTest {
IslandsManager im = mock(IslandsManager.class);
when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true);
when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true);
when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(uuid);
when(plugin.getIslands()).thenReturn(im);

View File

@ -222,9 +222,9 @@ public class IslandCacheTest {
IslandCache ic = new IslandCache();
ic.addIsland(island);
assertEquals(owner, ic.getTeamLeader(world, owner));
assertNull(ic.getTeamLeader(world, null));
assertNull(ic.getTeamLeader(world, UUID.randomUUID()));
assertEquals(owner, ic.getOwner(world, owner));
assertNull(ic.getOwner(world, null));
assertNull(ic.getOwner(world, UUID.randomUUID()));
}