Skip to content

Commit

Permalink
use local variable to avoid accessing array multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
iTwins committed Aug 25, 2023
1 parent 27f4ecb commit 98cb085
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ public void onJoin(@Nonnull PlayerJoinEvent e) {
final ItemStack[] armorContents = e.getPlayer().getInventory().getArmorContents();
final HashedArmorpiece[] hashedArmorpieces = playerProfile.getArmor();
for (int i = 0; i < 4; i++) {
if (armorContents[i] != null && armorContents[i].getType() != Material.AIR && SlimefunItem.getByItem(armorContents[i]) instanceof SlimefunArmorPiece sfArmorPiece) {
hashedArmorpieces[i].update(armorContents[i], sfArmorPiece);
final ItemStack armorPiece = armorContents[i];
if (armorPiece != null && armorPiece.getType() != Material.AIR && SlimefunItem.getByItem(armorPiece) instanceof SlimefunArmorPiece sfArmorPiece) {
hashedArmorpieces[i].update(armorPiece, sfArmorPiece);
}
}
});
Expand Down

0 comments on commit 98cb085

Please sign in to comment.