mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-04 22:41:27 +01:00
Fixed code smell
This commit is contained in:
parent
9c9490908e
commit
d266deb790
@ -797,16 +797,16 @@ public class IslandsManager {
|
||||
*/
|
||||
public void setOwner(User user, UUID targetUUID, Island island) {
|
||||
islandCache.setOwner(island, targetUUID);
|
||||
|
||||
user.sendMessage("commands.island.team.setowner.name-is-the-owner", "[name]", plugin.getPlayers().getName(targetUUID));
|
||||
|
||||
// Check if online
|
||||
plugin.getIWM().getAddon(island.getWorld()).ifPresent(addon -> {
|
||||
User target = User.getInstance(targetUUID);
|
||||
// Tell target. If they are offline, then they may receive a message when they login
|
||||
target.sendMessage("commands.island.team.setowner.you-are-the-owner");
|
||||
if (target.isOnline() && plugin.getIWM().getAddon(island.getWorld()).isPresent()) {
|
||||
// Permission checks for range changes only work when the target is online
|
||||
if (target.isOnline()) {
|
||||
// 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",
|
||||
addon.getPermissionPrefix() + "island.range",
|
||||
plugin.getIWM().getIslandProtectionRange(Util.getWorld(island.getWorld())));
|
||||
// Range can go up or down
|
||||
if (range != island.getProtectionRange()) {
|
||||
@ -817,6 +817,7 @@ public class IslandsManager {
|
||||
}
|
||||
island.setProtectionRange(range);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user