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