Load configs before accessing them (fixes #3099)

This commit is contained in:
SirYwell 2021-06-21 16:38:40 +02:00
parent f2e6fd9692
commit 56920fe833

View File

@ -134,8 +134,8 @@ public class PlotSquared {
private final UUIDPipeline backgroundUUIDPipeline =
new UUIDPipeline(Executors.newSingleThreadExecutor());
// Localization
private final CaptionLoader captionLoader;
private final Map<String, CaptionMap> captionMaps = new HashMap<>();
private CaptionLoader captionLoader;
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
// WorldEdit instance
private WorldEdit worldedit;
@ -180,15 +180,20 @@ public class PlotSquared {
//
ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket");
// load configs before reading from settings
if (!setupConfigs()) {
return;
}
this.captionLoader = CaptionLoader.of(
Locale.ENGLISH,
CaptionLoader.patternExtractor(Pattern.compile("messages_(.*)\\.json")),
DefaultCaptionProvider.forClassLoaderFormatString(
this.getClass().getClassLoader(),
"lang/messages_%s.json"
"lang/messages_%s.json" // the path in our jar file
),
TranslatableCaption.DEFAULT_NAMESPACE
); // the path in our jar file
);
// Load caption map
try {
this.loadCaptionMap();
@ -217,10 +222,6 @@ public class PlotSquared {
}
}
if (!setupConfigs()) {
return;
}
this.worldedit = WorldEdit.getInstance();
// Create Event utility class