Fix for #6
This commit is contained in:
parent
505d6bfb2b
commit
3d333c6406
@ -62,7 +62,9 @@ public class BlacksmithPlugin extends JavaPlugin {
|
|||||||
//Copy default config to disk
|
//Copy default config to disk
|
||||||
FileConfiguration fileConfiguration = this.getConfig();
|
FileConfiguration fileConfiguration = this.getConfig();
|
||||||
this.saveDefaultConfig();
|
this.saveDefaultConfig();
|
||||||
|
this.reloadConfig();
|
||||||
fileConfiguration.options().copyDefaults(true);
|
fileConfiguration.options().copyDefaults(true);
|
||||||
|
this.saveConfig();
|
||||||
|
|
||||||
//Load settings
|
//Load settings
|
||||||
config = new GlobalSettings(this);
|
config = new GlobalSettings(this);
|
||||||
|
@ -63,7 +63,6 @@ public class NPCSettings {
|
|||||||
*/
|
*/
|
||||||
public void changeSetting(NPCSetting setting, Object newValue) {
|
public void changeSetting(NPCSetting setting, Object newValue) {
|
||||||
if (setting == NPCSetting.REFORGE_ABLE_ITEMS) {
|
if (setting == NPCSetting.REFORGE_ABLE_ITEMS) {
|
||||||
newValue = replaceReforgeAblePlaceholders(newValue);
|
|
||||||
currentValues.put(setting, newValue);
|
currentValues.put(setting, newValue);
|
||||||
updateReforgeAbleItems();
|
updateReforgeAbleItems();
|
||||||
} else {
|
} else {
|
||||||
@ -334,7 +333,7 @@ public class NPCSettings {
|
|||||||
* @param value <p>The value specified by a user</p>
|
* @param value <p>The value specified by a user</p>
|
||||||
* @return <p>The value with placeholders replaced</p>
|
* @return <p>The value with placeholders replaced</p>
|
||||||
*/
|
*/
|
||||||
private Object replaceReforgeAblePlaceholders(Object value) {
|
private Object replaceReforgeAblePresets(Object value) {
|
||||||
if (value instanceof String string) {
|
if (value instanceof String string) {
|
||||||
String[] list = string.split(",");
|
String[] list = string.split(",");
|
||||||
List<String> replaced = new ArrayList<>(list.length);
|
List<String> replaced = new ArrayList<>(list.length);
|
||||||
@ -363,6 +362,9 @@ public class NPCSettings {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Convert any presets with a list of materials
|
||||||
|
newReforgeAbleItems = (String) replaceReforgeAblePresets(newReforgeAbleItems);
|
||||||
|
|
||||||
for (String item : newReforgeAbleItems.split(",")) {
|
for (String item : newReforgeAbleItems.split(",")) {
|
||||||
if (item == null || item.equalsIgnoreCase("null")) {
|
if (item == null || item.equalsIgnoreCase("null")) {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user