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