diff --git a/Changelog.txt b/Changelog.txt index 0a6e85d4e..08417ade1 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ Version 2.2.027 + Fixed concurrency issue with Folia regarding locale strings Version 2.2.026 Fixed NullPointerException on ChunkUnloadEvent diff --git a/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java b/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java index 81ab06625..d65cf6404 100644 --- a/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java +++ b/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java @@ -15,6 +15,7 @@ import java.text.MessageFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -22,7 +23,8 @@ import java.util.regex.Pattern; public final class LocaleLoader { private static final String BUNDLE_ROOT = "com.gmail.nossr50.locale.locale"; private static final String OVERRIDE_FILE_NAME = "locale_override.properties"; - private static Map bundleCache = new HashMap<>(); + // Must be concurrent to accomodate Folia + private static Map bundleCache = new ConcurrentHashMap<>(); private static ResourceBundle bundle = null; private static ResourceBundle filesystemBundle = null; private static ResourceBundle enBundle = null;