cleanup: use for-each loop where applicable
This commit is contained in:
@@ -120,8 +120,8 @@ public class ThreadTracker {
|
||||
|
||||
private static String printThreadStack(StackTraceElement[] list, String dateFormat) {
|
||||
String s = "----------------------------\r\n" + dateFormat + "\r\n";
|
||||
for(int i = 0; i < list.length; i++) {
|
||||
s += (" " + list[i].toString() + "\r\n");
|
||||
for (StackTraceElement stackTraceElement : list) {
|
||||
s += (" " + stackTraceElement.toString() + "\r\n");
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
@@ -136,8 +136,8 @@ public class TrackerReadLock extends ReentrantReadWriteLock.ReadLock implements
|
||||
|
||||
private static String printStackTrace(StackTraceElement[] list) {
|
||||
String s = "";
|
||||
for(int i = 0; i < list.length; i++) {
|
||||
s += (" " + list[i].toString() + "\r\n");
|
||||
for (StackTraceElement stackTraceElement : list) {
|
||||
s += (" " + stackTraceElement.toString() + "\r\n");
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
@@ -140,8 +140,8 @@ public class TrackerReentrantLock extends ReentrantLock implements MonitoredReen
|
||||
|
||||
private static String printStackTrace(StackTraceElement[] list) {
|
||||
String s = "";
|
||||
for(int i = 0; i < list.length; i++) {
|
||||
s += (" " + list[i].toString() + "\r\n");
|
||||
for (StackTraceElement stackTraceElement : list) {
|
||||
s += (" " + stackTraceElement.toString() + "\r\n");
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
@@ -136,8 +136,8 @@ public class TrackerWriteLock extends ReentrantReadWriteLock.WriteLock implement
|
||||
|
||||
private static String printStackTrace(StackTraceElement[] list) {
|
||||
String s = "";
|
||||
for(int i = 0; i < list.length; i++) {
|
||||
s += (" " + list[i].toString() + "\r\n");
|
||||
for (StackTraceElement stackTraceElement : list) {
|
||||
s += (" " + stackTraceElement.toString() + "\r\n");
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
@@ -13,8 +13,8 @@ public abstract class AbstractEmptyLock {
|
||||
String df = dateFormat.format(new Date());
|
||||
|
||||
String s = "\r\n" + df + "\r\n";
|
||||
for(int i = 0; i < list.length; i++) {
|
||||
s += (" " + list[i].toString() + "\r\n");
|
||||
for (StackTraceElement stackTraceElement : list) {
|
||||
s += (" " + stackTraceElement.toString() + "\r\n");
|
||||
}
|
||||
s += "----------------------------\r\n\r\n";
|
||||
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
*/
|
||||
package net.server.channel.handlers;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.life.MapleLifeFactory;
|
||||
@@ -34,11 +36,9 @@ import server.quest.MapleQuest;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Randomizer;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public final class AdminCommandHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@@ -53,8 +53,7 @@ public final class AdminCommandHandler extends AbstractMaplePacketHandler {
|
||||
switch (mode) {
|
||||
case 0x00: // Level1~Level8 & Package1~Package2
|
||||
int[][] toSpawn = MapleItemInformationProvider.getInstance().getSummonMobs(slea.readInt());
|
||||
for (int z = 0; z < toSpawn.length; z++) {
|
||||
int[] toSpawnChild = toSpawn[z];
|
||||
for (int[] toSpawnChild : toSpawn) {
|
||||
if (Randomizer.nextInt(100) < toSpawnChild[1]) {
|
||||
c.getPlayer().getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ package net.server.channel.handlers;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import tools.Randomizer;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.life.MapleLifeFactory;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Randomizer;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
/**
|
||||
@@ -52,8 +52,7 @@ public final class UseSummonBagHandler extends AbstractMaplePacketHandler {
|
||||
if (toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemId) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
|
||||
int[][] toSpawn = MapleItemInformationProvider.getInstance().getSummonMobs(itemId);
|
||||
for (int z = 0; z < toSpawn.length; z++) {
|
||||
int[] toSpawnChild = toSpawn[z];
|
||||
for (int[] toSpawnChild : toSpawn) {
|
||||
if (Randomizer.nextInt(100) < toSpawnChild[1]) {
|
||||
c.getPlayer().getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
|
||||
}
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
package net.server.handlers.login;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.creator.novice.*;
|
||||
import client.creator.novice.BeginnerCreator;
|
||||
import client.creator.novice.LegendCreator;
|
||||
import client.creator.novice.NoblesseCreator;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import tools.FilePrinter;
|
||||
import tools.MaplePacketCreator;
|
||||
@@ -66,8 +68,8 @@ public final class CreateCharHandler extends AbstractMaplePacketHandler {
|
||||
int gender = slea.readByte();
|
||||
|
||||
int [] items = new int [] {weapon, top, bottom, shoes, hair, face};
|
||||
for (int i = 0; i < items.length; i++){
|
||||
if (!isLegal(items[i])) {
|
||||
for (int item : items) {
|
||||
if (!isLegal(item)) {
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + name + ".txt", "Owner from account '" + c.getAccountName() + "' tried to packet edit in char creation.");
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
|
||||
@@ -41,8 +41,8 @@ public class ServicesManager {
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
for (int i = 0; i < services.length; i++) {
|
||||
services[i].dispose();
|
||||
for (Service service : services) {
|
||||
service.dispose();
|
||||
}
|
||||
services = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user