From 56920fe833e03b04f5f7d96f18aff9b18740bc99 Mon Sep 17 00:00:00 2001 From: SirYwell Date: Mon, 21 Jun 2021 16:38:40 +0200 Subject: [PATCH] Load configs before accessing them (fixes #3099) --- .../java/com/plotsquared/core/PlotSquared.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 3a44ca23b..9cea726d9 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -134,8 +134,8 @@ public class PlotSquared { private final UUIDPipeline backgroundUUIDPipeline = new UUIDPipeline(Executors.newSingleThreadExecutor()); // Localization - private final CaptionLoader captionLoader; private final Map captionMaps = new HashMap<>(); + private CaptionLoader captionLoader; public HashMap> 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