Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a size limit for the town_block_ratio option. #5326

Merged
merged 2 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/com/palmergames/bukkit/config/ConfigNodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ public enum ConfigNodes {
"",
"# The maximum townblocks available to a town is (numResidents * ratio).",
"# Setting this value to 0 will instead use the level based jump values determined in the town level config."),
TOWN_TOWN_BLOCK_LIMIT(
"town.town_block_limit",
"0",
"",
"# The maximimum amount of townblocks a town can have, if town_block_ratio is 0 the max size will be decided by the town_levels.",
"# Set to 0 to have no size limit."),
TOWN_TOWN_BLOCK_SIZE(
"town.town_block_size",
"16",
Expand Down
4 changes: 4 additions & 0 deletions src/com/palmergames/bukkit/towny/TownySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,10 @@ public static int getMaxTownBlocks(Town town) {
n += town.getNumResidents() * ratio;

n += getNationBonusBlocks(town);

int ratioSizeLimit = getInt(ConfigNodes.TOWN_TOWN_BLOCK_LIMIT);
if (ratio != 0 && ratioSizeLimit > 0)
n = Math.min(ratioSizeLimit, n);

return n;
}
Expand Down