The config key pattern is cached now.
parent
a2bcd14aaa
commit
d5a7c304b9
|
@ -23,6 +23,9 @@ Date format: (YYYY-MM-DD)
|
|||
API:
|
||||
* PlayerCreatePlayerShopkeeperEvent and PlayerShopkeeperHireEvent: The meaning of the max shops limit has changed. A value of 0 or less no longer indicates 'no limit'.
|
||||
|
||||
Internal:
|
||||
* The config key pattern is cached now.
|
||||
|
||||
Migration notes:
|
||||
* The folder structure has changed:
|
||||
* The save file and trading logs (if enabled) are stored inside a new 'data' folder now.
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
@ -18,11 +19,13 @@ import com.nisovin.shopkeepers.util.TextUtils;
|
|||
|
||||
public class ConfigHelper {
|
||||
|
||||
private static final Pattern CONFIG_KEY_PATTERN = Pattern.compile("([A-Z][a-z]+)");
|
||||
|
||||
private ConfigHelper() {
|
||||
}
|
||||
|
||||
public static String toConfigKey(String fieldName) {
|
||||
return fieldName.replaceAll("([A-Z][a-z]+)", "-$1").toLowerCase(Locale.ROOT);
|
||||
return CONFIG_KEY_PATTERN.matcher(fieldName).replaceAll("-$1").toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public static Object loadConfigValue(Configuration config, String configKey, Set<String> noColorConversionKeys, Class<?> typeClass, Class<?> genericType) {
|
||||
|
|
Loading…
Reference in New Issue