cleanup: use Java-style array declaration
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.");
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -9,7 +9,7 @@ public class ServerConstants {
|
||||
public static final boolean JAVA_8 = getJavaVersion() >= 8; //Max amount of times a party leader is allowed to persist on the Party Search before entry expiration (thus needing to manually restart the Party Search to be able to search for members).
|
||||
|
||||
//Debug Variables
|
||||
public static int DEBUG_VALUES[] = new int[10]; // Field designed for packet testing purposes
|
||||
public static int[] DEBUG_VALUES = new int[10]; // Field designed for packet testing purposes
|
||||
|
||||
// https://github.com/openstreetmap/josm/blob/a3a6e8a6b657cf4c5b4c64ea14d6e87be6280d65/src/org/openstreetmap/josm/tools/Utils.java#L1566-L1585
|
||||
// Added by kolakcc (Familiar)
|
||||
|
||||
@@ -25,19 +25,19 @@ public class LanguageConstants {
|
||||
|
||||
}
|
||||
|
||||
public static String CPQBlue[] = new String[3];
|
||||
public static String CPQError[] = new String[3];
|
||||
public static String CPQEntry[] = new String[3];
|
||||
public static String CPQFindError[] = new String[3];
|
||||
public static String CPQRed[] = new String[3];
|
||||
public static String CPQPlayerExit[] = new String[3];
|
||||
public static String CPQEntryLobby[] = new String[3];
|
||||
public static String CPQPickRoom[] = new String[3];
|
||||
public static String CPQExtendTime[] = new String[3];
|
||||
public static String CPQLeaderNotFound[] = new String[3];
|
||||
public static String CPQChallengeRoomAnswer[] = new String[3];
|
||||
public static String CPQChallengeRoomSent[] = new String[3];
|
||||
public static String CPQChallengeRoomDenied[] = new String[3];
|
||||
public static String[] CPQBlue = new String[3];
|
||||
public static String[] CPQError = new String[3];
|
||||
public static String[] CPQEntry = new String[3];
|
||||
public static String[] CPQFindError = new String[3];
|
||||
public static String[] CPQRed = new String[3];
|
||||
public static String[] CPQPlayerExit = new String[3];
|
||||
public static String[] CPQEntryLobby = new String[3];
|
||||
public static String[] CPQPickRoom = new String[3];
|
||||
public static String[] CPQExtendTime = new String[3];
|
||||
public static String[] CPQLeaderNotFound = new String[3];
|
||||
public static String[] CPQChallengeRoomAnswer = new String[3];
|
||||
public static String[] CPQChallengeRoomSent = new String[3];
|
||||
public static String[] CPQChallengeRoomDenied = new String[3];
|
||||
|
||||
static {
|
||||
int lang;
|
||||
|
||||
@@ -128,8 +128,8 @@ public class MapleServerHandler extends IoHandlerAdapter {
|
||||
FilePrinter.print(FilePrinter.SESSION, "IoSession with " + session.getRemoteAddress() + " opened on " + sdf.format(Calendar.getInstance().getTime()), false);
|
||||
}
|
||||
|
||||
byte ivRecv[] = {70, 114, 122, 82};
|
||||
byte ivSend[] = {82, 48, 120, 115};
|
||||
byte[] ivRecv = {70, 114, 122, 82};
|
||||
byte[] ivSend = {82, 48, 120, 115};
|
||||
ivRecv[3] = (byte) (Math.random() * 255);
|
||||
ivSend[3] = (byte) (Math.random() * 255);
|
||||
MapleAESOFB sendCypher = new MapleAESOFB(ivSend, (short) (0xFFFF - ServerConstants.VERSION));
|
||||
|
||||
@@ -35,7 +35,7 @@ public class MapleCustomEncryption {
|
||||
return (byte) ((tmp & 0xFF) | (tmp >>> 8));
|
||||
}
|
||||
|
||||
public static byte[] encryptData(byte data[]) {
|
||||
public static byte[] encryptData(byte[] data) {
|
||||
for (int j = 0; j < 6; j++) {
|
||||
byte remember = 0;
|
||||
byte dataLength = (byte) (data.length & 0xFF);
|
||||
@@ -69,7 +69,7 @@ public class MapleCustomEncryption {
|
||||
return data;
|
||||
}
|
||||
|
||||
public static byte[] decryptData(byte data[]) {
|
||||
public static byte[] decryptData(byte[] data) {
|
||||
for (int j = 1; j <= 6; j++) {
|
||||
byte remember = 0;
|
||||
byte dataLength = (byte) (data.length & 0xFF);
|
||||
|
||||
@@ -21,19 +21,19 @@
|
||||
*/
|
||||
package net.mina;
|
||||
|
||||
import config.YamlConfig;
|
||||
import client.MapleClient;
|
||||
import config.YamlConfig;
|
||||
import constants.net.OpcodeConstants;
|
||||
import net.server.coordinator.session.MapleSessionCoordinator;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
import org.apache.mina.filter.codec.CumulativeProtocolDecoder;
|
||||
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
|
||||
import tools.FilePrinter;
|
||||
import tools.HexTool;
|
||||
import tools.MapleAESOFB;
|
||||
import tools.data.input.ByteArrayByteStream;
|
||||
import tools.data.input.GenericLittleEndianAccessor;
|
||||
import tools.FilePrinter;
|
||||
|
||||
public class MaplePacketDecoder extends CumulativeProtocolDecoder {
|
||||
private static final String DECODER_STATE_KEY = MaplePacketDecoder.class.getName() + ".STATE";
|
||||
@@ -68,7 +68,7 @@ public class MaplePacketDecoder extends CumulativeProtocolDecoder {
|
||||
return false;
|
||||
}
|
||||
if (in.remaining() >= decoderState.packetlength) {
|
||||
byte decryptedPacket[] = new byte[decoderState.packetlength];
|
||||
byte[] decryptedPacket = new byte[decoderState.packetlength];
|
||||
in.get(decryptedPacket, 0, decoderState.packetlength);
|
||||
decoderState.packetlength = -1;
|
||||
rcvdCrypto.crypt(decryptedPacket);
|
||||
|
||||
@@ -948,7 +948,7 @@ public class Server {
|
||||
tMan.register(new BossLogTask(), 24 * 60 * 60 * 1000, timeLeft);
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("wzpath", "wz");
|
||||
Security.setProperty("crypto.policy", "unlimited");
|
||||
AutoJCE.removeCryptographyRestrictions();
|
||||
|
||||
@@ -109,7 +109,7 @@ public final class Channel {
|
||||
private MonitoredReadLock merchRlock = MonitoredReadLockFactory.createLock(merchantLock);
|
||||
private MonitoredWriteLock merchWlock = MonitoredWriteLockFactory.createLock(merchantLock);
|
||||
|
||||
private MonitoredReentrantLock faceLock[] = new MonitoredReentrantLock[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private MonitoredReentrantLock[] faceLock = new MonitoredReentrantLock[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
|
||||
private MonitoredReentrantLock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHANNEL, true);
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ import client.MapleClient;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.opcodes.SendOpcode;
|
||||
import net.server.Server;
|
||||
import net.server.guild.MapleAlliance;
|
||||
import net.server.guild.MapleGuild;
|
||||
import net.server.guild.MapleGuildCharacter;
|
||||
import net.server.guild.MapleAlliance;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import tools.data.output.MaplePacketLittleEndianWriter;
|
||||
@@ -170,7 +170,7 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
|
||||
break;
|
||||
}
|
||||
case 0x08:
|
||||
String ranks[] = new String[5];
|
||||
String[] ranks = new String[5];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
ranks[i] = slea.readMapleAsciiString();
|
||||
}
|
||||
|
||||
@@ -21,22 +21,23 @@
|
||||
*/
|
||||
package net.server.channel.handlers;
|
||||
|
||||
import config.YamlConfig;
|
||||
import net.server.guild.MapleGuildResponse;
|
||||
import net.server.guild.MapleGuild;
|
||||
import constants.game.GameConstants;
|
||||
import client.MapleClient;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import tools.MaplePacketCreator;
|
||||
import client.MapleCharacter;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import client.MapleClient;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchCheckerType;
|
||||
import net.server.guild.MapleAlliance;
|
||||
import net.server.guild.MapleGuild;
|
||||
import net.server.guild.MapleGuildResponse;
|
||||
import net.server.world.MapleParty;
|
||||
import net.server.world.World;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
||||
private boolean isGuildNameAcceptable(String name) {
|
||||
@@ -187,7 +188,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
||||
System.out.println("[Hack] " + mc.getName() + " tried to change guild rank titles when s/he does not have permission.");
|
||||
return;
|
||||
}
|
||||
String ranks[] = new String[5];
|
||||
String[] ranks = new String[5];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
ranks[i] = slea.readMapleAsciiString();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class MultiChatHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
int type = slea.readByte(); // 0 for buddys, 1 for partys
|
||||
int numRecipients = slea.readByte();
|
||||
int recipients[] = new int[numRecipients];
|
||||
int[] recipients = new int[numRecipients];
|
||||
for (int i = 0; i < numRecipients; i++) {
|
||||
recipients[i] = slea.readInt();
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
|
||||
player.visitMap(player.getMap());
|
||||
|
||||
BuddyList bl = player.getBuddylist();
|
||||
int buddyIds[] = bl.getBuddyIds();
|
||||
int[] buddyIds = bl.getBuddyIds();
|
||||
wserv.loggedOn(player.getName(), player.getId(), c.getChannel(), buddyIds);
|
||||
for (CharacterIdChannelPair onlineBuddy : wserv.multiBuddyFind(player.getId(), buddyIds)) {
|
||||
BuddylistEntry ble = bl.get(onlineBuddy.getCharacterId());
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
*/
|
||||
package net.server.services.task.channel;
|
||||
|
||||
import net.server.services.BaseService;
|
||||
import config.YamlConfig;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.services.BaseScheduler;
|
||||
import net.server.services.BaseService;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,7 +30,7 @@ import net.server.services.BaseScheduler;
|
||||
*/
|
||||
public class EventService extends BaseService {
|
||||
|
||||
private EventScheduler eventSchedulers[] = new EventScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private EventScheduler[] eventSchedulers = new EventScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
|
||||
public EventService() {
|
||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||
|
||||
@@ -38,8 +38,8 @@ import java.util.Collections;
|
||||
*/
|
||||
public class FaceExpressionService extends BaseService {
|
||||
|
||||
private FaceExpressionScheduler faceExpressionSchedulers[] = new FaceExpressionScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private MonitoredReentrantLock faceLock[] = new MonitoredReentrantLock[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private FaceExpressionScheduler[] faceExpressionSchedulers = new FaceExpressionScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private MonitoredReentrantLock[] faceLock = new MonitoredReentrantLock[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
|
||||
public FaceExpressionService() {
|
||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class MobAnimationService extends BaseService {
|
||||
|
||||
private MobAnimationScheduler mobAnimationSchedulers[] = new MobAnimationScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private MobAnimationScheduler[] mobAnimationSchedulers = new MobAnimationScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
|
||||
public MobAnimationService() {
|
||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
*/
|
||||
package net.server.services.task.channel;
|
||||
|
||||
import net.server.services.BaseService;
|
||||
import config.YamlConfig;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.services.BaseScheduler;
|
||||
import net.server.services.BaseService;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,7 +30,7 @@ import net.server.services.BaseScheduler;
|
||||
*/
|
||||
public class MobClearSkillService extends BaseService {
|
||||
|
||||
private MobClearSkillScheduler mobClearSkillSchedulers[] = new MobClearSkillScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private MobClearSkillScheduler[] mobClearSkillSchedulers = new MobClearSkillScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
|
||||
public MobClearSkillService() {
|
||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
*/
|
||||
package net.server.services.task.channel;
|
||||
|
||||
import net.server.services.BaseService;
|
||||
import config.YamlConfig;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.services.BaseScheduler;
|
||||
import net.server.services.BaseService;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,7 +30,7 @@ import net.server.services.BaseScheduler;
|
||||
*/
|
||||
public class MobMistService extends BaseService {
|
||||
|
||||
private MobMistScheduler mobMistSchedulers[] = new MobMistScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private MobMistScheduler[] mobMistSchedulers = new MobMistScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
|
||||
public MobMistService() {
|
||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class MobStatusService extends BaseService {
|
||||
|
||||
private MobStatusScheduler mobStatusSchedulers[] = new MobStatusScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private MobStatusScheduler[] mobStatusSchedulers = new MobStatusScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
|
||||
public MobStatusService() {
|
||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
*/
|
||||
package net.server.services.task.channel;
|
||||
|
||||
import net.server.services.BaseService;
|
||||
import config.YamlConfig;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.services.BaseScheduler;
|
||||
import net.server.services.BaseService;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,7 +30,7 @@ import net.server.services.BaseScheduler;
|
||||
*/
|
||||
public class OverallService extends BaseService { // thanks Alex for suggesting a refactor over the several channel schedulers unnecessarily populating the Channel class
|
||||
|
||||
private OverallScheduler channelSchedulers[] = new OverallScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
private OverallScheduler[] channelSchedulers = new OverallScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||
|
||||
public OverallService() {
|
||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||
|
||||
@@ -1241,7 +1241,7 @@ public class World {
|
||||
updateBuddies(characterId, channel, buddies, true);
|
||||
}
|
||||
|
||||
public void loggedOn(String name, int characterId, int channel, int buddies[]) {
|
||||
public void loggedOn(String name, int characterId, int channel, int[] buddies) {
|
||||
updateBuddies(characterId, channel, buddies, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,21 +21,13 @@
|
||||
*/
|
||||
package provider.wz;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataDirectoryEntry;
|
||||
import provider.MapleDataFileEntry;
|
||||
import provider.MapleDataProvider;
|
||||
import tools.data.input.GenericLittleEndianAccessor;
|
||||
import tools.data.input.GenericSeekableLittleEndianAccessor;
|
||||
import tools.data.input.InputStreamByteStream;
|
||||
import tools.data.input.LittleEndianAccessor;
|
||||
import tools.data.input.RandomAccessByteStream;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import tools.data.input.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class WZFile implements MapleDataProvider {
|
||||
static {
|
||||
@@ -116,7 +108,7 @@ public class WZFile implements MapleDataProvider {
|
||||
}
|
||||
|
||||
public WZIMGFile getImgFile(String path) throws IOException {
|
||||
String segments[] = path.split("/");
|
||||
String[] segments = path.split("/");
|
||||
WZDirectoryEntry dir = root;
|
||||
for (int x = 0; x < segments.length - 1; x++) {
|
||||
dir = (WZDirectoryEntry) dir.getEntry(segments[x]);
|
||||
|
||||
@@ -21,12 +21,13 @@
|
||||
*/
|
||||
package provider.wz;
|
||||
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataEntity;
|
||||
|
||||
public class WZIMGEntry implements MapleData {
|
||||
private String name;
|
||||
@@ -56,7 +57,7 @@ public class WZIMGEntry implements MapleData {
|
||||
|
||||
@Override
|
||||
public MapleData getChildByPath(String path) {
|
||||
String segments[] = path.split("/");
|
||||
String[] segments = path.split("/");
|
||||
if (segments[0].equals("..")) {
|
||||
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
|
||||
}
|
||||
|
||||
@@ -21,15 +21,16 @@
|
||||
*/
|
||||
package provider.wz;
|
||||
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import tools.data.input.LittleEndianAccessor;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import tools.data.input.LittleEndianAccessor;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/*
|
||||
* Ported Code, see WZFile.java for more info
|
||||
@@ -108,7 +109,7 @@ public class WZTool {
|
||||
if (strLength < 0) {
|
||||
return "";
|
||||
}
|
||||
byte str[] = new byte[strLength * 2];
|
||||
byte[] str = new byte[strLength * 2];
|
||||
for (int i = 0; i < strLength * 2; i++) {
|
||||
str[i] = llea.readByte();
|
||||
}
|
||||
@@ -122,7 +123,7 @@ public class WZTool {
|
||||
if (strLength < 0) {
|
||||
return "";
|
||||
}
|
||||
byte str[] = new byte[strLength];
|
||||
byte[] str = new byte[strLength];
|
||||
for (int i = 0; i < strLength; i++) {
|
||||
str[i] = llea.readByte();
|
||||
}
|
||||
|
||||
@@ -22,23 +22,24 @@
|
||||
package provider.wz;
|
||||
|
||||
import constants.game.GameConstants;
|
||||
import java.awt.Point;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataEntity;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataEntity;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class XMLDomMapleData implements MapleData {
|
||||
private Node node;
|
||||
@@ -66,7 +67,7 @@ public class XMLDomMapleData implements MapleData {
|
||||
|
||||
@Override
|
||||
public synchronized MapleData getChildByPath(String path) { // the whole XML reading system seems susceptible to give nulls on strenuous read scenarios
|
||||
String segments[] = path.split("/");
|
||||
String[] segments = path.split("/");
|
||||
if (segments[0].equals("..")) {
|
||||
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
getClient().announce(MaplePacketCreator.getNPCTalk(npc, (byte) 4, text, "", speaker));
|
||||
}
|
||||
|
||||
public void sendStyle(String text, int styles[]) {
|
||||
public void sendStyle(String text, int[] styles) {
|
||||
if (styles.length > 0) {
|
||||
getClient().announce(MaplePacketCreator.getNPCTalkStyle(npc, text, styles));
|
||||
} else { // thanks Conrad for noticing empty styles crashing players
|
||||
|
||||
@@ -596,7 +596,7 @@ public class MapleMap {
|
||||
* @return correspondent coordinate.
|
||||
*/
|
||||
public static String getRoundedCoordinate(double angle) {
|
||||
String directions[] = {"E", "SE", "S", "SW", "W", "NW", "N", "NE", "E"};
|
||||
String[] directions = {"E", "SE", "S", "SW", "W", "NW", "N", "NE", "E"};
|
||||
return directions[ (int)Math.round(( ((double)angle % 360) / 45)) ];
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ public class MapleMapFactory {
|
||||
map.setTimeMob(MapleDataTool.getInt(timeMob.getChildByPath("id")), MapleDataTool.getString(timeMob.getChildByPath("message")));
|
||||
}
|
||||
|
||||
int bounds[] = new int[4];
|
||||
int[] bounds = new int[4];
|
||||
bounds[0] = MapleDataTool.getInt(infoData.getChildByPath("VRTop"));
|
||||
bounds[1] = MapleDataTool.getInt(infoData.getChildByPath("VRBottom"));
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
*/
|
||||
public class MapleTVEffect {
|
||||
|
||||
private final static boolean ACTIVE[] = new boolean[Server.getInstance().getWorldsSize()];
|
||||
private final static boolean[] ACTIVE = new boolean[Server.getInstance().getWorldsSize()];
|
||||
|
||||
public static synchronized boolean broadcastMapleTVIfNotActive(MapleCharacter player, MapleCharacter victim, List<String> messages, int tvType){
|
||||
int w = player.getWorld();
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
package tools;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
@@ -70,14 +68,14 @@ public class BCrypt {
|
||||
// Blowfish parameters
|
||||
private static final int BLOWFISH_NUM_ROUNDS = 16;
|
||||
// Initial contents of key schedule
|
||||
private static final int P_orig[] = {
|
||||
private static final int[] P_orig = {
|
||||
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
|
||||
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
|
||||
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
|
||||
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
|
||||
0x9216d5d9, 0x8979fb1b
|
||||
};
|
||||
private static final int S_orig[] = {
|
||||
private static final int[] S_orig = {
|
||||
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
|
||||
0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
|
||||
0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
|
||||
@@ -338,12 +336,12 @@ public class BCrypt {
|
||||
// bcrypt IV: "OrpheanBeholderScryDoubt". The C implementation calls
|
||||
// this "ciphertext", but it is really plaintext or an IV. We keep
|
||||
// the name to make code comparison easier.
|
||||
static private final int bf_crypt_ciphertext[] = {
|
||||
static private final int[] bf_crypt_ciphertext = {
|
||||
0x4f727068, 0x65616e42, 0x65686f6c,
|
||||
0x64657253, 0x63727944, 0x6f756274
|
||||
};
|
||||
// Table for Base64 encoding
|
||||
static private final char base64_code[] = {
|
||||
static private final char[] base64_code = {
|
||||
'.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
||||
'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
||||
@@ -352,7 +350,7 @@ public class BCrypt {
|
||||
'6', '7', '8', '9'
|
||||
};
|
||||
// Table for Base64 decoding
|
||||
static private final byte index_64[] = {
|
||||
static private final byte[] index_64 = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
@@ -368,8 +366,8 @@ public class BCrypt {
|
||||
51, 52, 53, -1, -1, -1, -1, -1
|
||||
};
|
||||
// Expanded Blowfish key
|
||||
private int P[];
|
||||
private int S[];
|
||||
private int[] P;
|
||||
private int[] S;
|
||||
|
||||
/**
|
||||
* Encode a byte array using bcrypt's slightly-modified base64
|
||||
@@ -381,7 +379,7 @@ public class BCrypt {
|
||||
* @return base64-encoded string
|
||||
* @exception IllegalArgumentException if the length is invalid
|
||||
*/
|
||||
private static String encode_base64(byte d[], int len)
|
||||
private static String encode_base64(byte[] d, int len)
|
||||
throws IllegalArgumentException {
|
||||
int off = 0;
|
||||
StringBuilder rs = new StringBuilder();
|
||||
@@ -441,7 +439,7 @@ public class BCrypt {
|
||||
throws IllegalArgumentException {
|
||||
StringBuilder rs = new StringBuilder();
|
||||
int off = 0, slen = s.length(), olen = 0;
|
||||
byte ret[];
|
||||
byte[] ret;
|
||||
byte c1, c2, c3, c4, o;
|
||||
|
||||
if (maxolen <= 0) {
|
||||
@@ -490,7 +488,7 @@ public class BCrypt {
|
||||
* @param lr an array containing the two 32-bit half blocks
|
||||
* @param off the position in the array of the blocks
|
||||
*/
|
||||
private final void encipher(int lr[], int off) {
|
||||
private final void encipher(int[] lr, int off) {
|
||||
int i, n, l = lr[off], r = lr[off + 1];
|
||||
|
||||
l ^= P[0];
|
||||
@@ -522,9 +520,9 @@ public class BCrypt {
|
||||
* cumulative flag for non-benign sign extension
|
||||
* @return correct and buggy next word of material from data as int[2]
|
||||
*/
|
||||
private static int[] streamtowords(byte data[], int offp[], int signp[]) {
|
||||
private static int[] streamtowords(byte[] data, int[] offp, int[] signp) {
|
||||
int i;
|
||||
int words[] = { 0, 0 };
|
||||
int[] words = { 0, 0 };
|
||||
int off = offp[0];
|
||||
int sign = signp[0];
|
||||
|
||||
@@ -547,8 +545,8 @@ public class BCrypt {
|
||||
* current offset into data
|
||||
* @return the next word of material from data
|
||||
*/
|
||||
private static int streamtoword(byte data[], int offp[]) {
|
||||
int signp[] = { 0 };
|
||||
private static int streamtoword(byte[] data, int[] offp) {
|
||||
int[] signp = { 0 };
|
||||
return streamtowords(data, offp, signp)[0];
|
||||
}
|
||||
|
||||
@@ -559,8 +557,8 @@ public class BCrypt {
|
||||
* current offset into data
|
||||
* @return the next word of material from data
|
||||
*/
|
||||
private static int streamtoword_bug(byte data[], int offp[]) {
|
||||
int signp[] = { 0 };
|
||||
private static int streamtoword_bug(byte[] data, int[] offp) {
|
||||
int[] signp = { 0 };
|
||||
return streamtowords(data, offp, signp)[1];
|
||||
}
|
||||
|
||||
@@ -577,10 +575,10 @@ public class BCrypt {
|
||||
* @param key an array containing the key
|
||||
* @param sign_ext_bug true to implement the 2x bug
|
||||
*/
|
||||
private void key(byte key[], boolean sign_ext_bug) {
|
||||
private void key(byte[] key, boolean sign_ext_bug) {
|
||||
int i;
|
||||
int koffp[] = {0};
|
||||
int lr[] = {0, 0};
|
||||
int[] koffp = {0};
|
||||
int[] lr = {0, 0};
|
||||
int plen = P.length, slen = S.length;
|
||||
|
||||
for (i = 0; i < plen; i++) {
|
||||
@@ -612,17 +610,17 @@ public class BCrypt {
|
||||
* @param sign_ext_bug true to implement the 2x bug
|
||||
* @param safety bit 16 is set when the safety measure is requested
|
||||
*/
|
||||
private void ekskey(byte data[], byte key[],
|
||||
boolean sign_ext_bug, int safety) {
|
||||
private void ekskey(byte[] data, byte[] key,
|
||||
boolean sign_ext_bug, int safety) {
|
||||
int i;
|
||||
int koffp[] = {0}, doffp[] = {0};
|
||||
int lr[] = {0, 0};
|
||||
int[] koffp = {0}, doffp = {0};
|
||||
int[] lr = {0, 0};
|
||||
int plen = P.length, slen = S.length;
|
||||
int signp[] = { 0 }; // non-benign sign-extension flag
|
||||
int[] signp = { 0 }; // non-benign sign-extension flag
|
||||
int diff = 0; // zero iff correct and buggy are same
|
||||
|
||||
for (i = 0; i < plen; i++) {
|
||||
int words[] = streamtowords(key, koffp, signp);
|
||||
int[] words = streamtowords(key, koffp, signp);
|
||||
diff |= words[0] ^ words[1];
|
||||
P[i] = P[i] ^ words[sign_ext_bug ? 1 : 0];
|
||||
}
|
||||
@@ -686,11 +684,11 @@ public class BCrypt {
|
||||
* @param cdata the plaintext to encrypt
|
||||
* @return an array containing the binary hashed password
|
||||
*/
|
||||
private byte[] crypt_raw(byte password[], byte salt[], int log_rounds,
|
||||
boolean sign_ext_bug, int safety, int cdata[]) {
|
||||
private byte[] crypt_raw(byte[] password, byte[] salt, int log_rounds,
|
||||
boolean sign_ext_bug, int safety, int[] cdata) {
|
||||
int rounds, i, j;
|
||||
int clen = cdata.length;
|
||||
byte ret[];
|
||||
byte[] ret;
|
||||
|
||||
if (log_rounds < 4 || log_rounds > 30) {
|
||||
throw new IllegalArgumentException("Bad number of rounds");
|
||||
@@ -729,7 +727,7 @@ public class BCrypt {
|
||||
* @return Byte representation of given plaintext.
|
||||
*/
|
||||
private static byte[] stringToBytes(String plaintext) {
|
||||
byte plaintextb[];
|
||||
byte[] plaintextb;
|
||||
|
||||
try {
|
||||
plaintextb = plaintext.getBytes("UTF-8");
|
||||
@@ -748,7 +746,7 @@ public class BCrypt {
|
||||
* @return the hashed password
|
||||
*/
|
||||
public static String hashpw(String password, String salt) {
|
||||
byte passwordb[] = stringToBytes(password);
|
||||
byte[] passwordb = stringToBytes(password);
|
||||
|
||||
return hashpw(passwordb, salt);
|
||||
}
|
||||
@@ -760,10 +758,10 @@ public class BCrypt {
|
||||
* using BCrypt.gensalt)
|
||||
* @return the hashed password
|
||||
*/
|
||||
public static String hashpw(byte passwordb[], String salt) {
|
||||
public static String hashpw(byte[] passwordb, String salt) {
|
||||
BCrypt B;
|
||||
String real_salt;
|
||||
byte saltb[], hashed[];
|
||||
byte[] saltb, hashed;
|
||||
char minor = (char) 0;
|
||||
int rounds, off = 0;
|
||||
StringBuilder rs = new StringBuilder();
|
||||
@@ -834,7 +832,7 @@ public class BCrypt {
|
||||
public static String gensalt(String prefix, int log_rounds, SecureRandom random)
|
||||
throws IllegalArgumentException {
|
||||
StringBuilder rs = new StringBuilder();
|
||||
byte rnd[] = new byte[BCRYPT_SALT_LEN];
|
||||
byte[] rnd = new byte[BCRYPT_SALT_LEN];
|
||||
|
||||
if (!prefix.startsWith("$2") ||
|
||||
(prefix.charAt(2) != 'a' && prefix.charAt(2) != 'y') &&
|
||||
@@ -924,7 +922,7 @@ public class BCrypt {
|
||||
* @return true if the passwords match, false otherwise
|
||||
*/
|
||||
public static boolean checkpw(String plaintext, String hashed) {
|
||||
byte plaintextb[] = stringToBytes(plaintext);
|
||||
byte[] plaintextb = stringToBytes(plaintext);
|
||||
return checkpw(plaintextb, hashed);
|
||||
}
|
||||
|
||||
@@ -936,8 +934,8 @@ public class BCrypt {
|
||||
* @return true if the passwords match, false otherwise
|
||||
*/
|
||||
public static boolean checkpw(byte[] plaintext, String hashed) {
|
||||
byte hashed_bytes[];
|
||||
byte try_bytes[];
|
||||
byte[] hashed_bytes;
|
||||
byte[] try_bytes;
|
||||
try {
|
||||
String try_pw = hashpw(plaintext, hashed);
|
||||
hashed_bytes = hashed.getBytes("UTF-8");
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
*/
|
||||
package tools;
|
||||
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class MapleAESOFB {
|
||||
private byte iv[];
|
||||
private byte[] iv;
|
||||
private Cipher cipher;
|
||||
private short mapleVersion;
|
||||
private final static SecretKeySpec skey = new SecretKeySpec(
|
||||
@@ -54,7 +54,7 @@ public class MapleAESOFB {
|
||||
(byte) 0xD3, (byte) 0xAB, (byte) 0x91, (byte) 0xB9, (byte) 0x84, (byte) 0x7F, (byte) 0x61, (byte) 0x1E, (byte) 0xCF, (byte) 0xC5, (byte) 0xD1, (byte) 0x56, (byte) 0x3D, (byte) 0xCA, (byte) 0xF4, (byte) 0x05,
|
||||
(byte) 0xC6, (byte) 0xE5, (byte) 0x08, (byte) 0x49};
|
||||
|
||||
public MapleAESOFB(byte iv[], short mapleVersion) {
|
||||
public MapleAESOFB(byte[] iv, short mapleVersion) {
|
||||
try {
|
||||
cipher = Cipher.getInstance("AES");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, skey);
|
||||
@@ -142,13 +142,13 @@ public class MapleAESOFB {
|
||||
}
|
||||
|
||||
public boolean checkPacket(int packetHeader) {
|
||||
byte packetHeaderBuf[] = new byte[2];
|
||||
byte[] packetHeaderBuf = new byte[2];
|
||||
packetHeaderBuf[0] = (byte) ((packetHeader >> 24) & 0xFF);
|
||||
packetHeaderBuf[1] = (byte) ((packetHeader >> 16) & 0xFF);
|
||||
return checkPacket(packetHeaderBuf);
|
||||
}
|
||||
|
||||
public static byte[] getNewIv(byte oldIv[]) {
|
||||
public static byte[] getNewIv(byte[] oldIv) {
|
||||
byte[] in = {(byte) 0xf2, 0x53, (byte) 0x50, (byte) 0xc6};
|
||||
for (int x = 0; x < 4; x++) {
|
||||
funnyShit(oldIv[x], in);
|
||||
|
||||
@@ -110,7 +110,7 @@ public class MaplePacketCreator {
|
||||
}
|
||||
|
||||
private static void addRemainingSkillInfo(final MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
|
||||
int remainingSp[] = chr.getRemainingSps();
|
||||
int[] remainingSp = chr.getRemainingSps();
|
||||
int effectiveLength = 0;
|
||||
for (int i = 0; i < remainingSp.length; i++) {
|
||||
if (remainingSp[i] > 0) {
|
||||
@@ -3143,7 +3143,7 @@ public class MaplePacketCreator {
|
||||
}
|
||||
|
||||
private static void writeLongEncodeTemporaryMask(final MaplePacketLittleEndianWriter mplew, Collection<MonsterStatus> stati) {
|
||||
int masks[] = new int[4];
|
||||
int[] masks = new int[4];
|
||||
|
||||
for (MonsterStatus statup : stati) {
|
||||
int pos = statup.isFirst() ? 0 : 2;
|
||||
@@ -3370,7 +3370,7 @@ public class MaplePacketCreator {
|
||||
addCharLook(mplew, shop.getOwner(), false);
|
||||
mplew.writeMapleAsciiString(shop.getOwner().getName());
|
||||
|
||||
MapleCharacter visitors[] = shop.getVisitors();
|
||||
MapleCharacter[] visitors = shop.getVisitors();
|
||||
for(int i = 0; i < 3; i++) {
|
||||
if(visitors[i] != null) {
|
||||
mplew.write(i + 1);
|
||||
@@ -3474,7 +3474,7 @@ public class MaplePacketCreator {
|
||||
return mplew.getPacket();
|
||||
}
|
||||
|
||||
public static byte[] getNPCTalkStyle(int npc, String talk, int styles[]) {
|
||||
public static byte[] getNPCTalkStyle(int npc, String talk, int[] styles) {
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.NPC_TALK.getValue());
|
||||
mplew.write(4); // ?
|
||||
@@ -5758,7 +5758,7 @@ public class MaplePacketCreator {
|
||||
mplew.writeInt(hm.getItemId());
|
||||
mplew.writeMapleAsciiString("Hired Merchant");
|
||||
|
||||
MapleCharacter visitors[] = hm.getVisitors();
|
||||
MapleCharacter[] visitors = hm.getVisitors();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (visitors[i] != null) {
|
||||
mplew.write(i + 1);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class StringUtil {
|
||||
* @param start Starting from which string.
|
||||
* @return The joined strings.
|
||||
*/
|
||||
public static String joinStringFrom(String arr[], int start) {
|
||||
public static String joinStringFrom(String[] arr, int start) {
|
||||
return joinStringFrom(arr, start, " ");
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class StringUtil {
|
||||
* @param start Starting from which string.
|
||||
* @return The joined strings.
|
||||
*/
|
||||
public static String joinStringFrom(String arr[], int start, String sep) {
|
||||
public static String joinStringFrom(String[] arr, int start, String sep) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = start; i < arr.length; i++) {
|
||||
builder.append(arr[i]);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
package tools.data.input;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.*;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ public class GenericLittleEndianAccessor implements LittleEndianAccessor {
|
||||
* @return The string read.
|
||||
*/
|
||||
public final String readAsciiString(int n) {
|
||||
char ret[] = new char[n];
|
||||
char[] ret = new char[n];
|
||||
for (int x = 0; x < n; x++) {
|
||||
ret[x] = (char) readByte();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
package tools.data.output;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Provides an interface to a writer class that writes a little-endian sequence
|
||||
@@ -38,7 +38,7 @@ public interface LittleEndianWriter {
|
||||
*
|
||||
* @param b The bytes to write.
|
||||
*/
|
||||
public void write(byte b[]);
|
||||
public void write(byte[] b);
|
||||
|
||||
/**
|
||||
* Write a byte to the sequence.
|
||||
|
||||
@@ -139,7 +139,7 @@ public class Fishing {
|
||||
}
|
||||
|
||||
private static void debugFishingLikelihood() {
|
||||
long a[] = new long[365], b[] = new long[365];
|
||||
long[] a = new long[365], b = new long[365];
|
||||
long hits = 0, hits10 = 0, total = 0;
|
||||
|
||||
for (int i = 0; i < 365; i++) {
|
||||
|
||||
Reference in New Issue
Block a user