Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a bug that removed old owner from island #2218

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public boolean execute(User user, String label, List<String> args) {
.involvedPlayer(user.getUniqueId())
.admin(false)
.reason(IslandEvent.Reason.RANK_CHANGE)
.rankChange(RanksManager.OWNER_RANK, RanksManager.VISITOR_RANK)
.rankChange(RanksManager.OWNER_RANK, RanksManager.SUB_OWNER_RANK)
.build();
getIslands().save(island);
return true;
Expand All @@ -107,4 +107,4 @@ public Optional<List<String>> tabComplete(User user, String alias, List<String>
return Optional.of(Util.tabLimit(getIslands().getMembers(getWorld(), user.getUniqueId()).stream().map(getPlayers()::getName).toList(), lastArg));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1520,8 +1520,8 @@ public void setOwner(World world, User user, UUID targetUUID) {
*/
public void setOwner(User user, UUID targetUUID, Island island) {
islandCache.setOwner(island, targetUUID);
// Remove the old owner from the island
plugin.getIslands().removePlayer(island, user.getUniqueId());
// Set old owner as sub-owner on island.
island.setRank(user, RanksManager.SUB_OWNER_RANK);

user.sendMessage("commands.island.team.setowner.name-is-the-owner", "[name]", plugin.getPlayers().getName(targetUUID));
plugin.getIWM().getAddon(island.getWorld()).ifPresent(addon -> {
Expand Down