Adds possibility for message customization and translation #5
This commit is contained in:
@ -62,11 +62,9 @@ public class NPCSettings {
|
||||
* @param newValue <p>The new value of the setting</p>
|
||||
*/
|
||||
public void changeSetting(NPCSetting setting, Object newValue) {
|
||||
currentValues.put(setting, newValue);
|
||||
if (setting == NPCSetting.REFORGE_ABLE_ITEMS) {
|
||||
currentValues.put(setting, newValue);
|
||||
updateReforgeAbleItems();
|
||||
} else {
|
||||
currentValues.put(setting, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,13 +336,13 @@ public class NPCSettings {
|
||||
String[] list = string.split(",");
|
||||
List<String> replaced = new ArrayList<>(list.length);
|
||||
for (String item : list) {
|
||||
replaced.add(SmithPreset.replacePlaceholder(item));
|
||||
replaced.add(SmithPreset.replacePreset(item));
|
||||
}
|
||||
return String.join(",", replaced);
|
||||
} else if (value instanceof String[] stringList) {
|
||||
List<String> replaced = new ArrayList<>(stringList.length);
|
||||
for (String item : stringList) {
|
||||
replaced.add(SmithPreset.replacePlaceholder(item));
|
||||
replaced.add(SmithPreset.replacePreset(item));
|
||||
}
|
||||
return replaced.toArray();
|
||||
} else {
|
||||
|
@ -36,19 +36,19 @@ public enum SmithPreset {
|
||||
RANGED_SMITH;
|
||||
|
||||
/**
|
||||
* Replaces the given string if it's a smith type placeholder
|
||||
* Replaces the given string if it's a smith type preset
|
||||
*
|
||||
* @param possiblePlaceholder <p>The string that might be a placeholder</p>
|
||||
* @return <p>The string, possibly with the placeholder replaced</p>
|
||||
* @param possiblePreset <p>The string that might be a preset</p>
|
||||
* @return <p>The string, possibly with the preset replaced</p>
|
||||
*/
|
||||
public static String replacePlaceholder(String possiblePlaceholder) {
|
||||
public static String replacePreset(String possiblePreset) {
|
||||
for (SmithPreset smithPreset : SmithPreset.values()) {
|
||||
if (possiblePlaceholder.replace('-', '_').equalsIgnoreCase("preset:" +
|
||||
if (possiblePreset.replace('-', '_').equalsIgnoreCase("preset:" +
|
||||
smithPreset.name())) {
|
||||
return String.join(",", smithPreset.getMaterialNames());
|
||||
}
|
||||
}
|
||||
return possiblePlaceholder;
|
||||
return possiblePreset;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user