Skip to content

Commit

Permalink
Fixed downgrading level of an island causing some custom values to re…
Browse files Browse the repository at this point in the history
…set (#1331)
  • Loading branch information
OmerBenGera committed Sep 2, 2022
1 parent 3da549c commit 30eceae
Showing 1 changed file with 1 addition and 6 deletions.
Expand Up @@ -2090,7 +2090,6 @@ public void setUpgradeLevel(Upgrade upgrade, int level) {

// Level was downgraded, we need to clear the values of that level and sync all upgrades again
if (currentLevel > level) {
clearUpgrades(false);
syncUpgrades(false);
} else {
syncUpgrade((SUpgradeLevel) upgradeLevel, false);
Expand Down Expand Up @@ -3385,15 +3384,11 @@ private void saveBlockCounts(BigDecimal oldWorth, BigDecimal oldLevel) {
}

public void syncUpgrades(boolean overrideCustom) {
for (World.Environment environment : World.Environment.values())
clearGeneratorAmounts(environment);
clearEffects();
clearBlockLimits();
clearEntitiesLimits();
clearUpgrades(overrideCustom);

// We want to sync the default upgrade first, then the actual upgrades
syncUpgrade(DefaultUpgradeLevel.getInstance(), overrideCustom);

// Syncing all real upgrades
plugin.getUpgrades().getUpgrades().forEach(upgrade -> syncUpgrade((SUpgradeLevel) getUpgradeLevel(upgrade), overrideCustom));

Expand Down

0 comments on commit 30eceae

Please sign in to comment.