mirror of
https://github.com/tomasff/BeesPlus.git
synced 2024-11-29 05:26:20 +01:00
Use guard clause instead of nested if statememt
This commit is contained in:
parent
1f079051fa
commit
c73fcba252
@ -41,7 +41,10 @@ public class DamageHandler implements Listener {
|
|||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
PlayerInventory playerInventory = player.getInventory();
|
PlayerInventory playerInventory = player.getInventory();
|
||||||
|
|
||||||
if (Stream.of(playerInventory.getArmorContents()).allMatch(Objects::nonNull)) {
|
if (!Stream.of(playerInventory.getArmorContents()).allMatch(Objects::nonNull)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (playerInventory.getHelmet().isSimilar(helmet.getResult()) &&
|
if (playerInventory.getHelmet().isSimilar(helmet.getResult()) &&
|
||||||
playerInventory.getChestplate().isSimilar(chestplate.getResult()) &&
|
playerInventory.getChestplate().isSimilar(chestplate.getResult()) &&
|
||||||
playerInventory.getLeggings().isSimilar(leggings.getResult()) &&
|
playerInventory.getLeggings().isSimilar(leggings.getResult()) &&
|
||||||
@ -51,6 +54,5 @@ public class DamageHandler implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user