diff --git a/gradle.properties b/gradle.properties index 726293bd..cbb322b2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/Config.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/Config.java index bd280980..79f19100 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/Config.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/Config.java @@ -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() { } @@ -445,13 +446,14 @@ private void loadDisallowedSet() { } public static class MaxUgradesPerStorageConfig implements IUpgradeCountLimitConfig { - private final ForgeConfigSpec.ConfigValue> maxUpgradesPerStorageList; + private final ForgeConfigSpec.ConfigValue> maxUpgradesPerStorageList; @Nullable private Map maxUpgradesPerStorage = null; protected MaxUgradesPerStorageConfig(ForgeConfigSpec.Builder builder, Map 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 convertToList(Map defaultUpgradesPerStorage) {