validity check for not looking up damage type that doesn't exist
This commit is contained in:
+14
-2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user