cleanup: use Java-style array declaration

This commit is contained in:
P0nk
2021-04-08 07:17:03 +02:00
parent ed5a444753
commit 5e3b346053
41 changed files with 163 additions and 182 deletions

View File

@@ -21,20 +21,16 @@
*/
package client;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Map;
import net.server.PlayerStorage;
import tools.DatabaseConnection;
import tools.MaplePacketCreator;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
public class BuddyList {
public enum BuddyOperation {
ADDED, DELETED
@@ -121,7 +117,7 @@ public class BuddyList {
public int[] getBuddyIds() {
synchronized(buddies) {
int buddyIds[] = new int[buddies.size()];
int[] buddyIds = new int[buddies.size()];
int i = 0;
for (BuddylistEntry ble : buddies.values()) {
buddyIds[i++] = ble.getCharacterId();

View File

@@ -7,11 +7,12 @@ package client.autoban;
import client.MapleCharacter;
import config.YamlConfig;
import java.util.HashMap;
import java.util.Map;
import net.server.Server;
import tools.FilePrinter;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author kevintjuh93
@@ -23,9 +24,9 @@ public class AutobanManager {
private int misses = 0;
private int lastmisses = 0;
private int samemisscount = 0;
private long spam[] = new long[20];
private int timestamp[] = new int[20];
private byte timestampcounter[] = new byte[20];
private long[] spam = new long[20];
private int[] timestamp = new int[20];
private byte[] timestampcounter = new byte[20];
public AutobanManager(MapleCharacter chr) {

View File

@@ -48,7 +48,7 @@ public abstract class Command {
this.rank = rank;
}
protected String joinStringFrom(String arr[], int start) {
protected String joinStringFrom(String[] arr, int start) {
StringBuilder builder = new StringBuilder();
for (int i = start; i < arr.length; i++) {
builder.append(arr[i]);

View File

@@ -42,8 +42,8 @@ public class SeedCommand extends Command {
player.yellowMessage("This command can only be used in HPQ.");
return;
}
Point pos[] = {new Point(7, -207), new Point(179, -447), new Point(-3, -687), new Point(-357, -687), new Point(-538, -447), new Point(-359, -207)};
int seed[] = {4001097, 4001096, 4001095, 4001100, 4001099, 4001098};
Point[] pos = {new Point(7, -207), new Point(179, -447), new Point(-3, -687), new Point(-357, -687), new Point(-538, -447), new Point(-359, -207)};
int[] seed = {4001097, 4001096, 4001095, 4001100, 4001099, 4001098};
for (int i = 0; i < pos.length; i++) {
Item item = new Item(seed[i], (byte) 0, (short) 1);
player.getMap().spawnItemDrop(player, player, item, pos[i], false, true);

View File

@@ -40,7 +40,7 @@ import java.util.Arrays;
import java.util.List;
public class DebugCommand extends Command {
private final static String debugTypes[] = {"monster", "packet", "portal", "spawnpoint", "pos", "map", "mobsp", "event", "areas", "reactors", "servercoupons", "playercoupons", "timer", "marriage", "buff", ""};
private final static String[] debugTypes = {"monster", "packet", "portal", "spawnpoint", "pos", "map", "mobsp", "event", "areas", "reactors", "servercoupons", "playercoupons", "timer", "marriage", "buff", ""};
{
setDescription("Show a debug message.");

View File

@@ -49,7 +49,7 @@ public enum ItemFactory {
private final boolean account;
private static final int lockCount = 400;
private static final Lock locks[] = new Lock[lockCount]; // thanks Masterrulax for pointing out a bottleneck issue here
private static final Lock[] locks = new Lock[lockCount]; // thanks Masterrulax for pointing out a bottleneck issue here
static {
for (int i = 0; i < lockCount; i++) {

View File

@@ -23,31 +23,21 @@
*/
package client.processor.stat;
import client.MapleCharacter;
import client.MapleClient;
import client.MapleJob;
import client.MapleStat;
import client.Skill;
import client.SkillFactory;
import client.*;
import client.autoban.AutobanFactory;
import client.inventory.Equip;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import config.YamlConfig;
import constants.skills.BlazeWizard;
import constants.skills.Brawler;
import constants.skills.DawnWarrior;
import constants.skills.Magician;
import constants.skills.ThunderBreaker;
import constants.skills.Warrior;
import constants.skills.*;
import tools.MaplePacketCreator;
import tools.Randomizer;
import tools.data.input.SeekableLittleEndianAccessor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import server.ThreadManager;
import tools.MaplePacketCreator;
import tools.Randomizer;
import tools.data.input.SeekableLittleEndianAccessor;
/**
*
@@ -374,7 +364,7 @@ public class AssignAPProcessor {
return(statList.size() <= rank ? 0 : statList.get(rank));
}
private static int gainStatByType(MapleStat type, int[] statGain, int gain, int statUpdate[]) {
private static int gainStatByType(MapleStat type, int[] statGain, int gain, int[] statUpdate) {
if(gain <= 0) return 0;
int newVal = 0;