Adds a missing null check
This commit is contained in:
parent
89cebb85c3
commit
92585c4dee
@ -58,7 +58,7 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
public void reload() {
|
||||
this.reloadConfig();
|
||||
config.load();
|
||||
translator.loadLanguages(this.getDataFolder(), this.getConfig().getString("language", "en"));
|
||||
translator.loadLanguages(this.getDataFolder(), "en", this.getConfig().getString("language", "en"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,9 +90,9 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
|
||||
//Copy default config to disk
|
||||
FileConfiguration fileConfiguration = this.getConfig();
|
||||
fileConfiguration.options().copyDefaults(true);
|
||||
this.saveDefaultConfig();
|
||||
this.reloadConfig();
|
||||
fileConfiguration.options().copyDefaults(true);
|
||||
this.saveConfig();
|
||||
|
||||
//Load settings
|
||||
@ -103,7 +103,7 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
translator = new Translator();
|
||||
translator.registerMessageCategory(TranslatableTimeUnit.UNIT_SECOND);
|
||||
translator.registerMessageCategory(BlacksmithTranslatableMessage.ITEM_TYPE_ENCHANTMENT);
|
||||
translator.loadLanguages(this.getDataFolder(), fileConfiguration.getString("language", "en"));
|
||||
translator.loadLanguages(this.getDataFolder(), "en", fileConfiguration.getString("language", "en"));
|
||||
BlacksmithPlugin.stringFormatter = new StringFormatter(this.getDescription().getPrefix(), translator);
|
||||
|
||||
//Set up Vault integration
|
||||
|
@ -19,6 +19,9 @@ public final class ConfigHelper {
|
||||
* @return <p>The value as a string list</p>
|
||||
*/
|
||||
public static List<String> asStringList(Object value) {
|
||||
if (value == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return List.of(((String) value).split(","));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user