Fixes a bug caused by "-" being consumed
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2023-01-09 15:13:55 +01:00
parent 7d940ee334
commit a5ae3cb295
3 changed files with 16 additions and 10 deletions

View File

@@ -88,16 +88,21 @@ public enum SmithPreset {
*/
public static String replacePreset(String possiblePreset) {
boolean negated = false;
if (possiblePreset.startsWith("-")) {
negated = true;
possiblePreset = possiblePreset.substring(1);
}
String upperCasedPreset = possiblePreset.replace('-', '_').toUpperCase();
if (!upperCasedPreset.startsWith("PRESET:")) {
if (possiblePreset.startsWith("-")) {
negated = true;
}
if ((negated && !upperCasedPreset.startsWith("_PRESET:")) && !upperCasedPreset.startsWith("PRESET:")) {
return possiblePreset;
}
//Strip the "-" here to prevent stripping for material names
if (negated) {
upperCasedPreset = upperCasedPreset.substring(1);
}
//Parse the input
SmithPresetFilter filter = null;
SmithPreset preset;