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;
|
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user