Change to island range perm check on ownership change.

If owner has no perms, then this check will not be done and the range
will not change. Previously, it was always reseting to the default
range.

https://github.com/BentoBoxWorld/BentoBox/issues/1145
This commit is contained in:
tastybento 2020-01-18 22:36:38 -08:00
parent ea08bab01d
commit a5503851c3

View File

@ -1094,7 +1094,10 @@ public class IslandsManager {
// 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");
// Permission checks for range changes only work when the target is online
if (target.isOnline()) {
if (target.isOnline() &&
target.getEffectivePermissions().parallelStream()
.map(p -> p.getPermission())
.anyMatch(p -> p.startsWith(addon.getPermissionPrefix() + "island.range"))) {
// Check if new owner has a different range permission than the island size
int range = target.getPermissionValue(
addon.getPermissionPrefix() + "island.range",