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; DRAIN;
public static DamageType getDamageType(String modName) { public static DamageType getDamageType(String modName) {
if (modName.isEmpty())
return DamageType.NONE;
if(modName.toLowerCase().equals("blind")) if(modName.toLowerCase().equals("blind"))
modName = "BLINDNESS"; modName = "BLINDNESS";
if(modName.toLowerCase().equals("powerblock")) if(modName.toLowerCase().equals("powerblock"))
modName = "POWERINHIBITOR"; modName = "POWERINHIBITOR";
DamageType damageType; //validity check for not looking up damage type that doesn't exist
if (modName.isEmpty()) boolean valid = false;
for(DamageType type : DamageType.values()){
if(type.name().equals(modName))
valid = true;
}
if(!valid)
return DamageType.NONE; return DamageType.NONE;
DamageType damageType;
try { try {
damageType = DamageType.valueOf(modName.replace(",", "").toUpperCase()); damageType = DamageType.valueOf(modName.replace(",", "").toUpperCase());
} catch (Exception e) { } catch (Exception e) {