Fixes some savage fail problems
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

Fixes item not being returned when salvage fails
Removes some redundancy when giving back items
Makes extended salvage return 50% of the salvage (no items if only one item would be returned)
Adds a better message when failing to salvage extended salvage items
Fixes a bug in the caching of smith presets
This commit is contained in:
2024-05-07 01:45:48 +02:00
parent 1d7e8a0732
commit 33ef557771
11 changed files with 170 additions and 132 deletions

View File

@@ -46,7 +46,7 @@ public enum SmithPreset {
private final SmithPresetFilter[] filters;
private static final Map<SmithPreset, Set<String>> presetMaterialNames = new HashMap<>();
private static final Map<SmithPresetFilter, Set<String>> filterMaterialNames = new HashMap<>();
private static final Map<SmithPreset, Map<SmithPresetFilter, Set<String>>> filterMaterialNames = new HashMap<>();
private static Set<Material> armor = null;
private static Set<Material> ranged = null;
private static Set<Material> weapons = null;
@@ -145,8 +145,8 @@ public enum SmithPreset {
materialNames = presetMaterialNames.get(preset);
}
} else {
if (filterMaterialNames.containsKey(filter)) {
materialNames = filterMaterialNames.get(filter);
if (filterMaterialNames.containsKey(preset) && filterMaterialNames.get(preset).containsKey(filter)) {
materialNames = filterMaterialNames.get(preset).get(filter);
}
}
@@ -154,7 +154,8 @@ public enum SmithPreset {
if (materialNames == null) {
if (filter != null) {
materialNames = preset.getMaterialNames(filter);
filterMaterialNames.put(filter, materialNames);
filterMaterialNames.putIfAbsent(preset, new HashMap<>());
filterMaterialNames.get(preset).put(filter, materialNames);
} else {
materialNames = preset.getMaterialNames();
presetMaterialNames.put(preset, materialNames);