mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-30 22:53:39 +01:00
Replace code referencing "teamleader" to "owner"
This will improve the consistency of the code, as well as the Javadocs. Locales (and some other files) still need to be updated to remove these references to team leader.
This commit is contained in:
parent
f50f7dd48d
commit
a04a0cb3d0
@ -27,9 +27,9 @@ public class AdminTeamAddCommand extends CompositeCommand {
|
||||
showHelp(this, user);
|
||||
return false;
|
||||
}
|
||||
// Get leader and target
|
||||
UUID leaderUUID = getPlayers().getUUID(args.get(0));
|
||||
if (leaderUUID == null) {
|
||||
// Get owner and target
|
||||
UUID ownerUUID = getPlayers().getUUID(args.get(0));
|
||||
if (ownerUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
@ -38,13 +38,13 @@ public class AdminTeamAddCommand extends CompositeCommand {
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(1));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), leaderUUID)) {
|
||||
if (!getIslands().hasIsland(getWorld(), ownerUUID)) {
|
||||
user.sendMessage("general.errors.player-has-no-island");
|
||||
return false;
|
||||
}
|
||||
if (getIslands().inTeam(getWorld(), leaderUUID) && !getIslands().getOwner(getWorld(), leaderUUID).equals(leaderUUID)) {
|
||||
if (getIslands().inTeam(getWorld(), ownerUUID) && !getIslands().getOwner(getWorld(), ownerUUID).equals(ownerUUID)) {
|
||||
user.sendMessage("commands.admin.team.add.name-not-leader", TextVariables.NAME, args.get(0));
|
||||
getIslands().getIsland(getWorld(), leaderUUID).showMembers(getPlugin(), user, getWorld());
|
||||
getIslands().getIsland(getWorld(), ownerUUID).showMembers(getPlugin(), user, getWorld());
|
||||
return false;
|
||||
}
|
||||
if (getIslands().inTeam(getWorld(), targetUUID)) {
|
||||
@ -57,10 +57,10 @@ public class AdminTeamAddCommand extends CompositeCommand {
|
||||
}
|
||||
// Success
|
||||
User target = User.getInstance(targetUUID);
|
||||
User leader = User.getInstance(leaderUUID);
|
||||
leader.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, getPlugin().getPlayers().getName(targetUUID));
|
||||
User owner = User.getInstance(ownerUUID);
|
||||
owner.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, getPlugin().getPlayers().getName(targetUUID));
|
||||
target.sendMessage("commands.island.team.invite.accept.you-joined-island", TextVariables.LABEL, getTopLabel());
|
||||
getIslands().getIsland(getWorld(), leaderUUID).addMember(targetUUID);
|
||||
getIslands().getIsland(getWorld(), ownerUUID).addMember(targetUUID);
|
||||
user.sendMessage("general.success");
|
||||
return true;
|
||||
|
||||
|
@ -36,14 +36,13 @@ public class IslandTeamCommand extends CompositeCommand {
|
||||
new IslandTeamUntrustCommand(this);
|
||||
new IslandTeamPromoteCommand(this, "promote");
|
||||
new IslandTeamPromoteCommand(this, "demote");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(User user, String label, List<String> args) {
|
||||
// Player issuing the command must have an island
|
||||
UUID teamLeaderUUID = getOwner(getWorld(), user);
|
||||
if (teamLeaderUUID == null) {
|
||||
UUID ownerUUID = getOwner(getWorld(), user);
|
||||
if (ownerUUID == null) {
|
||||
user.sendMessage("general.errors.no-island");
|
||||
return false;
|
||||
}
|
||||
@ -55,7 +54,7 @@ public class IslandTeamCommand extends CompositeCommand {
|
||||
return false;
|
||||
}
|
||||
Set<UUID> teamMembers = getMembers(getWorld(), user);
|
||||
if (teamLeaderUUID.equals(playerUUID)) {
|
||||
if (ownerUUID.equals(playerUUID)) {
|
||||
int maxSize = inviteCommand.getMaxTeamSize(user);
|
||||
if (teamMembers.size() < maxSize) {
|
||||
user.sendMessage("commands.island.team.invite.you-can-invite", TextVariables.NUMBER, String.valueOf(maxSize - teamMembers.size()));
|
||||
@ -68,7 +67,6 @@ public class IslandTeamCommand extends CompositeCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private boolean fireEvent(User user) {
|
||||
IslandBaseEvent event = TeamEvent.builder()
|
||||
.island(getIslands()
|
||||
|
@ -43,9 +43,9 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
|
||||
user.sendMessage("commands.island.team.invite.errors.you-already-are-in-team");
|
||||
return false;
|
||||
}
|
||||
// Get the team leader
|
||||
UUID prospectiveTeamLeaderUUID = itc.getInviteCommand().getInviteList().get(playerUUID);
|
||||
if (!getIslands().hasIsland(getWorld(), prospectiveTeamLeaderUUID)) {
|
||||
// Get the island owner
|
||||
UUID prospectiveOwnerUUID = itc.getInviteCommand().getInviteList().get(playerUUID);
|
||||
if (!getIslands().hasIsland(getWorld(), prospectiveOwnerUUID)) {
|
||||
user.sendMessage("commands.island.team.invite.errors.invalid-invite");
|
||||
itc.getInviteCommand().getInviteList().remove(playerUUID);
|
||||
return false;
|
||||
@ -53,7 +53,7 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
|
||||
// Fire event so add-ons can run commands, etc.
|
||||
IslandBaseEvent event = TeamEvent.builder()
|
||||
.island(getIslands()
|
||||
.getIsland(getWorld(), prospectiveTeamLeaderUUID))
|
||||
.getIsland(getWorld(), prospectiveOwnerUUID))
|
||||
.reason(TeamEvent.Reason.JOIN)
|
||||
.involvedPlayer(playerUUID)
|
||||
.build();
|
||||
@ -68,12 +68,12 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
|
||||
// Get the player's island - may be null if the player has no island
|
||||
Island island = getIslands().getIsland(getWorld(), playerUUID);
|
||||
// Get the team's island
|
||||
Island teamIsland = getIslands().getIsland(getWorld(), prospectiveTeamLeaderUUID);
|
||||
Island teamIsland = getIslands().getIsland(getWorld(), prospectiveOwnerUUID);
|
||||
// Clear the player's inventory
|
||||
user.getInventory().clear();
|
||||
// Move player to team's island
|
||||
User prospectiveTeamLeader = User.getInstance(prospectiveTeamLeaderUUID);
|
||||
Location newHome = getIslands().getSafeHomeLocation(getWorld(), prospectiveTeamLeader, 1);
|
||||
User prospectiveOwner = User.getInstance(prospectiveOwnerUUID);
|
||||
Location newHome = getIslands().getSafeHomeLocation(getWorld(), prospectiveOwner, 1);
|
||||
user.teleport(newHome);
|
||||
// Remove player as owner of the old island
|
||||
getIslands().removePlayer(getWorld(), playerUUID);
|
||||
|
@ -41,9 +41,9 @@ public class IslandTeamLeaveCommand extends ConfirmableCommand {
|
||||
}
|
||||
|
||||
private void leave(User user) {
|
||||
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());
|
||||
UUID ownerUUID = getIslands().getOwner(getWorld(), user.getUniqueId());
|
||||
if (ownerUUID != null) {
|
||||
User.getInstance(ownerUUID).sendMessage("commands.island.team.leave.left-your-island", TextVariables.NAME, user.getName());
|
||||
}
|
||||
getIslands().setLeaveTeam(getWorld(), user.getUniqueId());
|
||||
// Remove money inventory etc.
|
||||
|
@ -31,8 +31,8 @@ public class IslandTeamSetownerCommand extends CompositeCommand {
|
||||
UUID playerUUID = user.getUniqueId();
|
||||
// Can use if in a team
|
||||
boolean inTeam = getPlugin().getIslands().inTeam(getWorld(), playerUUID);
|
||||
UUID teamLeaderUUID = getOwner(getWorld(), user);
|
||||
if (!(inTeam && teamLeaderUUID.equals(playerUUID))) {
|
||||
UUID ownerUUID = getOwner(getWorld(), user);
|
||||
if (!(inTeam && ownerUUID.equals(playerUUID))) {
|
||||
user.sendMessage("general.errors.not-leader");
|
||||
return false;
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ public class Island implements DataObject {
|
||||
|
||||
/**
|
||||
* Sets the owner of the island.
|
||||
* @param owner - the island owner - the owner/team leader to set
|
||||
* @param owner the island owner - the owner to set
|
||||
*/
|
||||
public void setOwner(UUID owner){
|
||||
this.owner = owner;
|
||||
|
@ -54,13 +54,13 @@ public class JoinLeaveListener implements Listener {
|
||||
.forEach(world -> {
|
||||
Island island = plugin.getIslands().getIsland(world, user);
|
||||
|
||||
// Check if new leader has a different range permission than the island size
|
||||
// Check if new owner has a different range permission than the island size
|
||||
int range = user.getPermissionValue(plugin.getIWM().getAddon(island.getWorld()).get().getPermissionPrefix() + "island.range", plugin.getIWM().getIslandProtectionRange(Util.getWorld(island.getWorld())));
|
||||
|
||||
// Range can go up or down
|
||||
if (range != island.getProtectionRange()) {
|
||||
user.sendMessage("commands.admin.setrange.range-updated", TextVariables.NUMBER, String.valueOf(range));
|
||||
plugin.log("Makeleader: Island protection range changed from " + island.getProtectionRange() + " to "
|
||||
plugin.log("Setowner: Island protection range changed from " + island.getProtectionRange() + " to "
|
||||
+ range + " for " + user.getName() + " due to permission.");
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ public class IslandsManager {
|
||||
plugin.getPlayers().setHomeLocation(user, l, number);
|
||||
return l;
|
||||
} else {
|
||||
// try team leader's home
|
||||
// try owner's home
|
||||
Location tlh = plugin.getPlayers().getHomeLocation(world, plugin.getIslands().getOwner(world, user.getUniqueId()));
|
||||
if (tlh != null && isSafeLocation(tlh)) {
|
||||
plugin.getPlayers().setHomeLocation(user, tlh, number);
|
||||
@ -776,20 +776,20 @@ public class IslandsManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a new leader for an island
|
||||
* @param world - world
|
||||
* @param user - the user who is issuing the command
|
||||
* @param targetUUID - the current island member who is going to become the new owner
|
||||
* Sets this target as the owner for this island
|
||||
* @param world world
|
||||
* @param user the user who is issuing the command
|
||||
* @param targetUUID the current island member who is going to become the new owner
|
||||
*/
|
||||
public void setOwner(World world, User user, UUID targetUUID) {
|
||||
setOwner(user, targetUUID, getIsland(world, targetUUID));
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a new leader for an island
|
||||
* @param user - requester
|
||||
* @param targetUUID - new owner
|
||||
* @param island - island to register
|
||||
* Sets this target as the owner for this island
|
||||
* @param user requester
|
||||
* @param targetUUID new owner
|
||||
* @param island island to register
|
||||
*/
|
||||
public void setOwner(User user, UUID targetUUID, Island island) {
|
||||
islandCache.setOwner(island, targetUUID);
|
||||
@ -800,7 +800,7 @@ public class IslandsManager {
|
||||
User target = User.getInstance(targetUUID);
|
||||
target.sendMessage("commands.island.team.setowner.you-are-the-owner");
|
||||
if (target.isOnline() && plugin.getIWM().getAddon(island.getWorld()).isPresent()) {
|
||||
// Check if new leader has a different range permission than the island size
|
||||
// Check if new owner has a different range permission than the island size
|
||||
int range = target.getPermissionValue(
|
||||
plugin.getIWM().getAddon(island.getWorld()).get().getPermissionPrefix() + "island.range",
|
||||
plugin.getIWM().getIslandProtectionRange(Util.getWorld(island.getWorld())));
|
||||
@ -808,7 +808,7 @@ public class IslandsManager {
|
||||
if (range != island.getProtectionRange()) {
|
||||
user.sendMessage("commands.admin.setrange.range-updated", TextVariables.NUMBER, String.valueOf(range));
|
||||
target.sendMessage("commands.admin.setrange.range-updated", TextVariables.NUMBER, String.valueOf(range));
|
||||
plugin.log("Makeleader: Island protection range changed from " + island.getProtectionRange() + " to "
|
||||
plugin.log("Setowner: Island protection range changed from " + island.getProtectionRange() + " to "
|
||||
+ range + " for " + user.getName() + " due to permission.");
|
||||
}
|
||||
island.setProtectionRange(range);
|
||||
|
@ -36,7 +36,6 @@ import world.bentobox.bentobox.managers.IslandsManager;
|
||||
import world.bentobox.bentobox.managers.LocalesManager;
|
||||
import world.bentobox.bentobox.managers.PlayersManager;
|
||||
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
*
|
||||
@ -162,7 +161,7 @@ public class AdminDeleteCommandTest {
|
||||
* Test method for {@link AdminDeleteCommand#execute(User, String, java.util.List)
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteTeamLeader() {
|
||||
public void testExecuteOwner() {
|
||||
when(im.inTeam(Mockito.any(),Mockito.any())).thenReturn(true);
|
||||
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(notUUID);
|
||||
String[] name = {"tastybento"};
|
||||
|
@ -139,7 +139,7 @@ public class AdminTeamAddCommandTest {
|
||||
AdminTeamAddCommand itl = new AdminTeamAddCommand(ac);
|
||||
String[] name = {"tastybento", "poslovich"};
|
||||
|
||||
// Unknown leader
|
||||
// Unknown owner
|
||||
when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(null);
|
||||
when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID);
|
||||
assertFalse(itl.execute(user, ac.getLabel(), Arrays.asList(name)));
|
||||
@ -193,14 +193,14 @@ public class AdminTeamAddCommandTest {
|
||||
* Test method for {@link AdminTeamAddCommand#execute(User, String, List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteAddNotLeader() {
|
||||
public void testExecuteAddNotOwner() {
|
||||
AdminTeamAddCommand itl = new AdminTeamAddCommand(ac);
|
||||
String[] name = {"tastybento", "poslovich"};
|
||||
|
||||
when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid);
|
||||
when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID);
|
||||
|
||||
// Has island, has team, but not a leader
|
||||
// Has island, has team, but not an owner
|
||||
when(im.hasIsland(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
|
||||
when(im.inTeam(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
|
||||
when(im.getOwner(Mockito.any(),Mockito.eq(uuid))).thenReturn(notUUID);
|
||||
@ -225,7 +225,7 @@ public class AdminTeamAddCommandTest {
|
||||
when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid);
|
||||
when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID);
|
||||
|
||||
// Has island, has team, is leader
|
||||
// Has island, has team, is owner
|
||||
when(im.hasIsland(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
|
||||
when(im.inTeam(Mockito.any(),Mockito.eq(uuid))).thenReturn(true);
|
||||
when(im.getOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(uuid);
|
||||
|
@ -151,7 +151,7 @@ public class AdminTeamDisbandCommandTest {
|
||||
* Test method for {@link AdminTeamDisbandCommand#execute(User, String, List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteDisbandNotLeader() {
|
||||
public void testExecuteDisbandNotOwner() {
|
||||
when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(true);
|
||||
Island is = mock(Island.class);
|
||||
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
|
||||
@ -159,11 +159,11 @@ public class AdminTeamDisbandCommandTest {
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
|
||||
|
||||
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
|
||||
when(pm.getName(Mockito.any())).thenReturn("leader");
|
||||
when(pm.getName(Mockito.any())).thenReturn("owner");
|
||||
|
||||
AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage("commands.admin.team.disband.use-disband-leader", "[leader]", "leader");
|
||||
Mockito.verify(user).sendMessage("commands.admin.team.disband.use-disband-leader", "[leader]", "owner");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -176,7 +176,7 @@ public class AdminTeamDisbandCommandTest {
|
||||
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
|
||||
// Leader
|
||||
// Owner
|
||||
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID);
|
||||
// Members
|
||||
Set<UUID> members = new HashSet<>();
|
||||
|
@ -154,7 +154,7 @@ public class AdminTeamKickCommandTest {
|
||||
* Test method for {@link AdminTeamKickCommand#execute(User, String, List)} .
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteKickLeader() {
|
||||
public void testExecuteKickOwner() {
|
||||
when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(true);
|
||||
Island is = mock(Island.class);
|
||||
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
|
||||
|
@ -152,7 +152,7 @@ public class AdminTeamSetownerCommandTest {
|
||||
* Test method for {@link AdminTeamSetownerCommand#execute(User, String, List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteMakeLeaderAlreadyLeader() {
|
||||
public void testExecuteMakeOwnerAlreadyOwner() {
|
||||
when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(true);
|
||||
Island is = mock(Island.class);
|
||||
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
|
||||
@ -176,7 +176,7 @@ public class AdminTeamSetownerCommandTest {
|
||||
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is);
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(notUUID);
|
||||
// Leader
|
||||
// Owner
|
||||
when(im.getOwner(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid);
|
||||
when(pm.getName(Mockito.eq(uuid))).thenReturn("owner");
|
||||
// Members
|
||||
|
@ -131,7 +131,7 @@ public class IslandBanCommandTest {
|
||||
|
||||
// *** Error conditions ***
|
||||
// Ban without an island
|
||||
// Ban as not a team leader
|
||||
// Ban as not an owner
|
||||
// Ban unknown user
|
||||
// Ban self
|
||||
// Ban team mate
|
||||
|
@ -134,9 +134,9 @@ public class IslandResetCommandTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotLeader() throws IOException {
|
||||
public void testNotOwner() throws IOException {
|
||||
IslandResetCommand irc = new IslandResetCommand(ic);
|
||||
// Now has island, but is not the leader
|
||||
// Now has island, but is not the owner
|
||||
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
assertFalse(irc.execute(user, irc.getLabel(), new ArrayList<>()));
|
||||
Mockito.verify(user).sendMessage("general.errors.not-leader");
|
||||
@ -145,7 +145,7 @@ public class IslandResetCommandTest {
|
||||
@Test
|
||||
public void testHasTeam() throws IOException {
|
||||
IslandResetCommand irc = new IslandResetCommand(ic);
|
||||
// Now has island, but is not the leader
|
||||
// Now has island, but is not the owner
|
||||
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
// Now is owner, but still has team
|
||||
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
@ -156,7 +156,7 @@ public class IslandResetCommandTest {
|
||||
@Test
|
||||
public void testNoResetsLeft() throws IOException {
|
||||
IslandResetCommand irc = new IslandResetCommand(ic);
|
||||
// Now has island, but is not the leader
|
||||
// Now has island, but is not the owner
|
||||
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
// Now is owner, but still has team
|
||||
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
@ -173,7 +173,7 @@ public class IslandResetCommandTest {
|
||||
@Test
|
||||
public void testNoConfirmationRequired() throws IOException {
|
||||
IslandResetCommand irc = new IslandResetCommand(ic);
|
||||
// Now has island, but is not the leader
|
||||
// Now has island, but is not the owner
|
||||
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
// Now is owner, but still has team
|
||||
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
@ -207,7 +207,7 @@ public class IslandResetCommandTest {
|
||||
@Test
|
||||
public void testUnlimitedResets() throws IOException {
|
||||
IslandResetCommand irc = new IslandResetCommand(ic);
|
||||
// Now has island, but is not the leader
|
||||
// Now has island, but is not the owner
|
||||
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
// Now is owner, but still has team
|
||||
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
@ -244,7 +244,7 @@ public class IslandResetCommandTest {
|
||||
@Test
|
||||
public void testConfirmationRequired() throws IOException {
|
||||
IslandResetCommand irc = new IslandResetCommand(ic);
|
||||
// Now has island, but is not the leader
|
||||
// Now has island, but is not the owner
|
||||
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
// Now is owner, but still has team
|
||||
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
@ -285,7 +285,7 @@ public class IslandResetCommandTest {
|
||||
@Test
|
||||
public void testNewIslandError() throws IOException {
|
||||
IslandResetCommand irc = new IslandResetCommand(ic);
|
||||
// Now has island, but is not the leader
|
||||
// Now has island, but is not the owner
|
||||
when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
// Now is owner, but still has team
|
||||
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
|
@ -128,7 +128,7 @@ public class IslandUnbanCommandTest {
|
||||
|
||||
// *** Error conditions ***
|
||||
// Unban without an island
|
||||
// Unban as not a team leader
|
||||
// Unban as not an owner
|
||||
// Unban unknown user
|
||||
// Unban self
|
||||
// Unban someone not banned
|
||||
|
@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package world.bentobox.bentobox.api.commands.island.team;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@ -42,7 +39,6 @@ import world.bentobox.bentobox.managers.PlayersManager;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({Bukkit.class, BentoBox.class, User.class })
|
||||
@ -142,7 +138,7 @@ public class IslandTeamKickCommandTest {
|
||||
* Test method for .
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteNotTeamLeader() {
|
||||
public void testExecuteNotTeamOwner() {
|
||||
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(notUUID);
|
||||
IslandTeamKickCommand itl = new IslandTeamKickCommand(ic);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>()));
|
||||
|
@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package world.bentobox.bentobox.api.commands.island.team;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@ -119,7 +116,7 @@ public class IslandTeamLeaveCommandTest {
|
||||
* Test method for .
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteInTeamLeader() {
|
||||
public void testExecuteInOwner() {
|
||||
IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>()));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("commands.island.team.leave.cannot-leave"));
|
||||
@ -133,7 +130,7 @@ public class IslandTeamLeaveCommandTest {
|
||||
when(s.isLeaveConfirmation()).thenReturn(false);
|
||||
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
|
||||
// Add a team owner - null
|
||||
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(null);
|
||||
|
||||
IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic);
|
||||
@ -152,7 +149,7 @@ public class IslandTeamLeaveCommandTest {
|
||||
when(s.getConfirmationTime()).thenReturn(3);
|
||||
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
|
||||
// Add a team owner - null
|
||||
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(null);
|
||||
|
||||
IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic);
|
||||
@ -169,7 +166,7 @@ public class IslandTeamLeaveCommandTest {
|
||||
when(s.isLeaveConfirmation()).thenReturn(false);
|
||||
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
|
||||
// Add a team owner - null
|
||||
when(im.getOwner(Mockito.any(), Mockito.any())).thenReturn(null);
|
||||
|
||||
// Require resets
|
||||
|
@ -42,7 +42,6 @@ public class IslandCacheTest {
|
||||
UUID owner = UUID.randomUUID();
|
||||
Location location;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
plugin = mock(BentoBox.class);
|
||||
@ -205,7 +204,7 @@ public class IslandCacheTest {
|
||||
}
|
||||
*/
|
||||
@Test
|
||||
public void testgetMembers() {
|
||||
public void testGetMembers() {
|
||||
// New cache
|
||||
IslandCache ic = new IslandCache();
|
||||
ic.addIsland(island);
|
||||
@ -217,7 +216,7 @@ public class IslandCacheTest {
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testGetTeamLeader() {
|
||||
public void testGetOwner() {
|
||||
// New cache
|
||||
IslandCache ic = new IslandCache();
|
||||
ic.addIsland(island);
|
||||
@ -225,8 +224,6 @@ public class IslandCacheTest {
|
||||
assertEquals(owner, ic.getOwner(world, owner));
|
||||
assertNull(ic.getOwner(world, null));
|
||||
assertNull(ic.getOwner(world, UUID.randomUUID()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user