Skip to content

Commit

Permalink
Merge if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Oct 11, 2020
1 parent bba5338 commit d72cc11
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions src/main/java/world/bentobox/acidisland/listeners/AcidEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,35 +291,24 @@ public static double getDamageReduced(LivingEntity le) {
ItemStack helmet = inv.getHelmet();
ItemStack chest = inv.getChestplate();
ItemStack pants = inv.getLeggings();
if (helmet != null) {
// Damage if helmet
if (helmet.getType().name().contains("HELMET") && damage(helmet)) {
le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
inv.setHelmet(null);
}
// Damage if helmet
if (helmet != null&& helmet.getType().name().contains("HELMET") && damage(helmet)) {
le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
inv.setHelmet(null);
}
if (boots != null) {
// Damage
if (damage(boots)) {
le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
inv.setBoots(null);
}
if (boots != null && damage(boots)) {
le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
inv.setBoots(null);
}
// Pants
if (pants != null) {
// Damage
if (damage(pants)) {
le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
inv.setLeggings(null);
}
if (pants != null && damage(pants)) {
le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
inv.setLeggings(null);
}
// Chest plate
if (chest != null) {
// Damage
if (damage(chest)) {
le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
inv.setChestplate(null);
}
if (chest != null && damage(chest)) {
le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
inv.setChestplate(null);
}
return red;
}
Expand Down

0 comments on commit d72cc11

Please sign in to comment.