mirror of
https://github.com/tomasff/BeesPlus.git
synced 2024-11-25 19:45:54 +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();
|
||||
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()) &&
|
||||
playerInventory.getChestplate().isSimilar(chestplate.getResult()) &&
|
||||
playerInventory.getLeggings().isSimilar(leggings.getResult()) &&
|
||||
@ -51,6 +54,5 @@ public class DamageHandler implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user