Skip to content

Commit

Permalink
Fixes max team size checks.
Browse files Browse the repository at this point in the history
Fixes #2034
  • Loading branch information
tastybento committed Feb 12, 2023
1 parent 8276406 commit 45f2dca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void acceptTeamInvite(User user, Invite invite) {
user.sendMessage(INVALID_INVITE);
return;
}
if (teamIsland.getMemberSet(RanksManager.MEMBER_RANK, true).size() > getIslands().getMaxMembers(teamIsland, RanksManager.MEMBER_RANK)) {
if (teamIsland.getMemberSet(RanksManager.MEMBER_RANK, true).size() >= getIslands().getMaxMembers(teamIsland, RanksManager.MEMBER_RANK)) {
user.sendMessage("commands.island.team.invite.errors.island-is-full");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public boolean canExecute(User user, String label, List<String> args) {
Invite invite = itc.getInvite(playerUUID);
String name = getPlayers().getName(playerUUID);
switch (invite.getType()) {
case COOP -> user.sendMessage("commands.island.team.invite.name-has-invited-you.coop", TextVariables.NAME, name);
case TRUST -> user.sendMessage("commands.island.team.invite.name-has-invited-you.trust", TextVariables.NAME, name);
default -> user.sendMessage("commands.island.team.invite.name-has-invited-you", TextVariables.NAME, name);
case COOP -> user.sendMessage("commands.island.team.invite.name-has-invited-you.coop", TextVariables.NAME, name);
case TRUST -> user.sendMessage("commands.island.team.invite.name-has-invited-you.trust", TextVariables.NAME, name);
default -> user.sendMessage("commands.island.team.invite.name-has-invited-you", TextVariables.NAME, name);
}
return true;
}
Expand All @@ -69,7 +69,7 @@ public boolean canExecute(User user, String label, List<String> args) {
return false;
}
// Check for space on team
if (island.getMemberSet().size() > getIslands().getMaxMembers(island, RanksManager.MEMBER_RANK)) {
if (island.getMemberSet().size() >= getIslands().getMaxMembers(island, RanksManager.MEMBER_RANK)) {
user.sendMessage("commands.island.team.invite.errors.island-is-full");
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ public Set<UUID> getMembers(@NonNull World world, @NonNull UUID playerUUID) {
* Gets the maximum number of island members allowed on this island.
* Will update the value based on world settings or island owner permissions (if online).
* If the island is unowned, then this value will be 0.
* The number given for MEMBER_RANK is meant to include this rank and higher, e.g. {@link RanksManager#SUB_OWNER_RANK}
* and {@link RanksManager#OWNER_RANK}
* @param island - island
* @param rank {@link RanksManager#MEMBER_RANK}, {@link RanksManager#COOP_RANK}, or {@link RanksManager#TRUSTED_RANK}
* @return max number of members. If negative, then this means unlimited.
Expand Down

0 comments on commit 45f2dca

Please sign in to comment.