Browse Source

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

magicbox-1.5.2.1
FatBoy-DOTC 2 days ago
parent
commit
cb561c3b6b
  1. 16
      src/engine/mbEnums.java

16
src/engine/mbEnums.java

@ -841,16 +841,28 @@ public class mbEnums { @@ -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) {

Loading…
Cancel
Save