validity check for not looking up damage type that doesn't exist

This commit is contained in:
2026-02-03 11:15:24 -06:00
parent cf0f0cf022
commit cb561c3b6b
+14 -2
View File
@@ -841,16 +841,28 @@ public class mbEnums {
DRAIN;
public static DamageType getDamageType(String modName) {
if (modName.isEmpty())
return DamageType.NONE;
if(modName.toLowerCase().equals("blind"))
modName = "BLINDNESS";
if(modName.toLowerCase().equals("powerblock"))
modName = "POWERINHIBITOR";
DamageType damageType;
if (modName.isEmpty())
//validity check for not looking up damage type that doesn't exist
boolean valid = false;
for(DamageType type : DamageType.values()){
if(type.name().equals(modName))
valid = true;
}
if(!valid)
return DamageType.NONE;
DamageType damageType;
try {
damageType = DamageType.valueOf(modName.replace(",", "").toUpperCase());
} catch (Exception e) {