Skip to content

Commit

Permalink
Fixed the ability to have border sizes larger than the max-island-size
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Oct 14, 2022
1 parent 48293f1 commit 47611be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -1443,6 +1443,8 @@ public int getIslandSize() {
public void setIslandSize(int islandSize) {
islandSize = Math.max(1, islandSize);

Preconditions.checkArgument(islandSize <= plugin.getSettings().getMaxIslandSize(), "Border size " + islandSize + " cannot be larger than max island size: " + plugin.getSettings().getMaxIslandSize());

Log.debug(Debug.SET_SIZE, "SIsland", "setIslandSize", owner.getName(), islandSize);

boolean cropGrowthEnabled = BuiltinModules.UPGRADES.isUpgradeTypeEnabled(UpgradeTypeCropGrowth.class);
Expand Down
Expand Up @@ -204,6 +204,12 @@ private void loadUpgradeLevelFromSection(SuperiorSkyblockPlugin plugin, SUpgrade
Value<Integer> warpsLimit = Value.syncedFixed(levelSection.getInt("warps-limit", -1));
Value<Integer> coopLimit = Value.syncedFixed(levelSection.getInt("coop-limit", -1));
Value<Integer> borderSize = Value.syncedFixed(levelSection.getInt("border-size", -1));

if (borderSize.get() > plugin.getSettings().getMaxIslandSize()) {
Log.warn("Upgrade by name ", upgrade.getName(), " (level ", level, ") has illegal border-size, skipping...");
return;
}

Value<BigDecimal> bankLimit = Value.syncedFixed(new BigDecimal(levelSection.getString("bank-limit", "-1")));
KeyMap<Integer> blockLimits = KeyMapImpl.createHashMap();
if (levelSection.contains("block-limits")) {
Expand Down

0 comments on commit 47611be

Please sign in to comment.