This commit is contained in:
Kristian Knarvik 2022-10-03 15:41:00 +02:00
parent 505d6bfb2b
commit 3d333c6406
2 changed files with 6 additions and 2 deletions

View File

@ -62,7 +62,9 @@ public class BlacksmithPlugin extends JavaPlugin {
//Copy default config to disk
FileConfiguration fileConfiguration = this.getConfig();
this.saveDefaultConfig();
this.reloadConfig();
fileConfiguration.options().copyDefaults(true);
this.saveConfig();
//Load settings
config = new GlobalSettings(this);

View File

@ -63,7 +63,6 @@ public class NPCSettings {
*/
public void changeSetting(NPCSetting setting, Object newValue) {
if (setting == NPCSetting.REFORGE_ABLE_ITEMS) {
newValue = replaceReforgeAblePlaceholders(newValue);
currentValues.put(setting, newValue);
updateReforgeAbleItems();
} else {
@ -334,7 +333,7 @@ public class NPCSettings {
* @param value <p>The value specified by a user</p>
* @return <p>The value with placeholders replaced</p>
*/
private Object replaceReforgeAblePlaceholders(Object value) {
private Object replaceReforgeAblePresets(Object value) {
if (value instanceof String string) {
String[] list = string.split(",");
List<String> replaced = new ArrayList<>(list.length);
@ -363,6 +362,9 @@ public class NPCSettings {
return;
}
//Convert any presets with a list of materials
newReforgeAbleItems = (String) replaceReforgeAblePresets(newReforgeAbleItems);
for (String item : newReforgeAbleItems.split(",")) {
if (item == null || item.equalsIgnoreCase("null")) {
continue;