mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-05 10:30:17 +01:00
Island range perms could be 2x island distance
This could allow protection ranges to be much greater than the island range and therefore overflow into adjacent islands. https://github.com/BentoBoxWorld/BentoBox/issues/1851
This commit is contained in:
parent
2b452cddbd
commit
3dd9e973fb
@ -220,8 +220,8 @@ public class JoinLeaveListener implements Listener {
|
||||
if (island != null) {
|
||||
// Check if new owner has a different range permission than the island size
|
||||
int range = user.getPermissionValue(plugin.getIWM().getAddon(island.getWorld()).map(GameModeAddon::getPermissionPrefix).orElse("") + "island.range", island.getProtectionRange());
|
||||
// Range cannot be greater than the island distance * 2
|
||||
range = Math.min(range, 2 * plugin.getIWM().getIslandDistance(island.getWorld()));
|
||||
// Range cannot be greater than the island distance
|
||||
range = Math.min(range, plugin.getIWM().getIslandDistance(island.getWorld()));
|
||||
// Range can go up or down
|
||||
if (range != island.getProtectionRange()) {
|
||||
user.sendMessage("commands.admin.setrange.range-updated", TextVariables.NUMBER, String.valueOf(range));
|
||||
|
@ -246,9 +246,9 @@ public class JoinLeaveListenerTest {
|
||||
// Verify
|
||||
verify(player).sendMessage(eq("commands.admin.setrange.range-updated"));
|
||||
// Verify island setting
|
||||
verify(island).setProtectionRange(eq(200));
|
||||
verify(island).setProtectionRange(eq(100));
|
||||
// Verify log
|
||||
verify(plugin).log("Island protection range changed from 50 to 200 for tastybento due to permission.");
|
||||
verify(plugin).log("Island protection range changed from 50 to 100 for tastybento due to permission.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user