mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2025-02-07 23:51:29 +01:00
Fixes bug where new boxes had their protection size reduced to 0
This commit is contained in:
parent
19356d6e68
commit
c404c9a1ae
@ -151,6 +151,10 @@ public class AdvancementsManager {
|
||||
*/
|
||||
public int checkIslandSize(Island island) {
|
||||
int shouldSize = getIsland(island).getAdvancements().stream().mapToInt(this::getScore).sum();
|
||||
if (shouldSize < 1) {
|
||||
// Boxes can never be less than 1 in protection size
|
||||
return 0;
|
||||
}
|
||||
int diff = shouldSize - island.getProtectionRange();
|
||||
if (diff != 0) {
|
||||
this.setProtectionSize(island, shouldSize, null);
|
||||
@ -187,6 +191,12 @@ public class AdvancementsManager {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the island protection size and fires an event for it
|
||||
* @param island - island
|
||||
* @param newSize - new size of protected area
|
||||
* @param uuid - UUID of player making the change. null if the change is system-driven.
|
||||
*/
|
||||
private void setProtectionSize(@NonNull Island island, int newSize, @Nullable UUID uuid) {
|
||||
island.setProtectionRange(newSize);
|
||||
// Call Protection Range Change event. Does not support canceling.
|
||||
|
Loading…
Reference in New Issue
Block a user