Skip to content

Commit

Permalink
fix key to use for max command level Fix #25
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume-Lebegue committed Nov 12, 2020
1 parent 26af9e1 commit dd014dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/main/java/world/bentobox/upgrades/UpgradesManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ public Settings.UpgradeTier getBlockLimitsUpgradeTier(Material mat, int limitsLe
if (limitsLevel <= tierList.get(i).getMaxLevel())
return tierList.get(i);
}

return null;
}

Expand Down
11 changes: 6 additions & 5 deletions src/main/java/world/bentobox/upgrades/config/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,17 @@ private Map<String, Map<String, CommandUpgradeTier>> loadCommand(ConfigurationSe
CommandUpgradeTier newUpgrade = addCommandUpgradeSection(cmdSection, key);

if (gamemode == null) {
if (this.maxCommandUpgrade.get(key) == null || this.maxCommandUpgrade.get(key) < newUpgrade.getMaxLevel())
this.maxCommandUpgrade.put(key, newUpgrade.getMaxLevel());
if (this.maxCommandUpgrade.get(name) == null || this.maxCommandUpgrade.get(name) < newUpgrade.getMaxLevel()) {
this.maxCommandUpgrade.put(name, newUpgrade.getMaxLevel());
}
} else {
if (this.customMaxCommandUpgrade.get(gamemode) == null) {
Map<String, Integer> newMap = new HashMap<>();
newMap.put(key, newUpgrade.getMaxLevel());
newMap.put(name, newUpgrade.getMaxLevel());
this.customMaxCommandUpgrade.put(gamemode, newMap);
} else {
if (this.customMaxCommandUpgrade.get(gamemode).get(key) == null || this.customMaxCommandUpgrade.get(gamemode).get(key) < newUpgrade.getMaxLevel())
this.customMaxCommandUpgrade.get(gamemode).put(key, newUpgrade.getMaxLevel());
if (this.customMaxCommandUpgrade.get(gamemode).get(name) == null || this.customMaxCommandUpgrade.get(gamemode).get(name) < newUpgrade.getMaxLevel())
this.customMaxCommandUpgrade.get(gamemode).put(name, newUpgrade.getMaxLevel());
}
}

Expand Down

0 comments on commit dd014dd

Please sign in to comment.