cleanup: use for-each loop where applicable

This commit is contained in:
P0nk
2021-04-08 07:36:38 +02:00
parent 0ff8a80ef2
commit 5c6f515d18
16 changed files with 103 additions and 105 deletions

View File

@@ -2187,13 +2187,13 @@ public class MapleMap {
final Point dropPos = new Point(pos);
dropPos.x -= (12 * list.size());
for(int i = 0; i < list.size(); i++) {
if(list.get(i) == 0) {
for (Integer integer : list) {
if (integer == 0) {
spawnMesoDrop(owner != null ? 10 * owner.getMesoRate() : 10, calcDropPos(dropPos, pos), dropper, owner, playerDrop, (byte) (ffaDrop ? 2 : 0));
} else {
final Item drop;
int randomedId = list.get(i);
int randomedId = integer;
if (ItemConstants.getInventoryType(randomedId) != MapleInventoryType.EQUIP) {
drop = new Item(randomedId, (short) 0, (short) (rnd.nextInt(copies) + minCopies));
@@ -2203,7 +2203,7 @@ public class MapleMap {
spawnItemDrop(dropper, owner, drop, calcDropPos(dropPos, pos), ffaDrop, playerDrop);
}
dropPos.x += 25;
}
}
@@ -2459,10 +2459,10 @@ public class MapleMap {
}
MaplePet[] pets = chr.getPets();
for (int i = 0; i < pets.length; i++) {
if (pets[i] != null) {
pets[i].setPos(getGroundBelow(chr.getPosition()));
chr.announce(MaplePacketCreator.showPet(chr, pets[i], false, false));
for (MaplePet pet : pets) {
if (pet != null) {
pet.setPos(getGroundBelow(chr.getPosition()));
chr.announce(MaplePacketCreator.showPet(chr, pet, false, false));
} else {
break;
}