1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

use local variable to avoid accessing array multiple times

This commit is contained in:
iTwins 2023-08-25 18:39:31 +02:00
parent 27f4ecbacf
commit 98cb08556b

View File

@ -33,8 +33,9 @@ public class JoinListener implements Listener {
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);
}
}
});