Skip to content

Commit

Permalink
Merge pull request #999 from P3pp3rF1y/1.20.x-dev
Browse files Browse the repository at this point in the history
fix: 🐛 Fix maxUpgradesPerStorage config to properly reset to default …
  • Loading branch information
P3pp3rF1y authored Mar 13, 2024
2 parents 95ebcff + 4c192ec commit 30d5def
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.daemon=false

mod_id=sophisticatedbackpacks
mod_group_id=sophisticatedbackpacks
mod_version=3.20.2
mod_version=3.20.3
sonar_project_key=sophisticatedbackpacks:SophisticatedBackpacks
github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedBackpacks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
public class Config {

private static final String REGISTRY_NAME_MATCHER = "([a-z0-9_.-]+:[a-z0-9_/.-]+)";
private static final String MAX_UPGRADES_MATCHER = "([a-z0-9_/.-]+\\|\\d+)";

private Config() {
}
Expand Down Expand Up @@ -445,13 +446,14 @@ private void loadDisallowedSet() {
}

public static class MaxUgradesPerStorageConfig implements IUpgradeCountLimitConfig {
private final ForgeConfigSpec.ConfigValue<List<String>> maxUpgradesPerStorageList;
private final ForgeConfigSpec.ConfigValue<List<? extends String>> maxUpgradesPerStorageList;

@Nullable
private Map<String, Integer> maxUpgradesPerStorage = null;

protected MaxUgradesPerStorageConfig(ForgeConfigSpec.Builder builder, Map<String, Integer> defaultUpgradesPerStorage) {
maxUpgradesPerStorageList = builder.comment("Maximum number of upgrades of type per backpack in format of \"UpgradeRegistryName[or UpgradeGroup]|MaxNumber\"").define("maxUpgradesPerStorage", convertToList(defaultUpgradesPerStorage));
maxUpgradesPerStorageList = builder.comment("Maximum number of upgrades of type per backpack in format of \"UpgradeRegistryName[or UpgradeGroup]|MaxNumber\"")
.defineList("maxUpgradesPerStorage", convertToList(defaultUpgradesPerStorage), mapping -> ((String) mapping).matches(MAX_UPGRADES_MATCHER));
}

private List<String> convertToList(Map<String, Integer> defaultUpgradesPerStorage) {
Expand Down

0 comments on commit 30d5def

Please sign in to comment.