Heartstopper Commit

Enabled every catch block in the project to log parsed exceptions.
This commit is contained in:
ronancpl
2017-04-02 21:38:07 -03:00
parent 3990a08202
commit 5f01d3b7fd
88 changed files with 13325 additions and 40964 deletions
+14 -4
View File
@@ -1145,8 +1145,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
private void changeMapInternal(final MapleMap to, final Point pos, final byte[] warpPacket) {
if (this.getTrade() != null) {
MapleTrade.cancelTrade(this);
}
MapleTrade.cancelTrade(this);
}
client.announce(warpPacket);
map.removePlayer(MapleCharacter.this);
if (client.getChannelServer().getPlayerStorage().getCharacterById(getId()) != null) {
@@ -1191,7 +1191,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
ps.execute();
}
} catch (SQLException ex) {
System.out.print("Error deleting skill: " + ex);
ex.printStackTrace();
}
}
}
@@ -1293,7 +1293,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
ps.execute();
}
} catch (SQLException ex) {
System.out.print("Error deleting guild: " + ex);
ex.printStackTrace();
}
}
@@ -1383,6 +1383,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
try {
Server.getInstance().disbandGuild(guildid);
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -1955,6 +1956,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
try {
return Server.getInstance().getGuild(getGuildId(), getWorld(), null);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
@@ -2003,6 +2005,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
return id;
} catch (Exception e) {
e.printStackTrace();
}
return -1;
}
@@ -2023,6 +2026,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
return name;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@@ -2625,6 +2629,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
@@ -4239,6 +4244,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
con.setAutoCommit(true);
con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -4450,6 +4456,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
return;
}
merchantmeso += add;
@@ -4463,6 +4470,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
return;
}
merchantmeso = set;
@@ -4835,6 +4843,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
}
} catch (SQLException e) {
e.printStackTrace();
}
}
@@ -5159,6 +5168,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
+13
View File
@@ -401,6 +401,7 @@ public class MapleClient {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
@@ -429,6 +430,7 @@ public class MapleClient {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
@@ -534,6 +536,7 @@ public class MapleClient {
lTempban.setTimeInMillis(rs.getTimestamp("tempban").getTime());
return lTempban;
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (ps != null) {
@@ -543,6 +546,7 @@ public class MapleClient {
rs.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
return null;//why oh why!?!
@@ -590,6 +594,7 @@ public class MapleClient {
ps.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
} else {
@@ -623,6 +628,7 @@ public class MapleClient {
ps.close();
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
@@ -724,6 +730,7 @@ public class MapleClient {
try {
merchant.saveItems(false);
} catch (SQLException ex) {
ex.printStackTrace();
System.out.println("Error while saving Hired Merchant items.");
}
}
@@ -931,6 +938,7 @@ public class MapleClient {
try {
Server.getInstance().deleteGuildCharacter(new MapleGuildCharacter(cid, 0, rs.getString("name"), (byte) -1, (byte) -1, 0, rs.getInt("guildrank"), rs.getInt("guildid"), false, rs.getInt("allianceRank")));
} catch (Exception re) {
re.printStackTrace();
return false;
}
}
@@ -994,6 +1002,7 @@ public class MapleClient {
}
}
} catch (NullPointerException e) {
e.printStackTrace();
}
}
}, 15000);
@@ -1061,6 +1070,7 @@ public class MapleClient {
ps.executeUpdate();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
return disconnectForBeingAFaggot;
}
@@ -1079,6 +1089,7 @@ public class MapleClient {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
votePoints = points;
return votePoints;
@@ -1152,6 +1163,7 @@ public class MapleClient {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
return true;
}
@@ -1180,6 +1192,7 @@ public class MapleClient {
rs.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
return 0;
+2
View File
@@ -48,6 +48,7 @@ public class MapleFamily {
rs.close();
getMapleFamily();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
@@ -72,6 +73,7 @@ public class MapleFamily {
rs.close();
ps.close();
} catch (SQLException sqle) {
sqle.printStackTrace();
}
}
+1
View File
@@ -134,6 +134,7 @@ public final class MonsterBook {
ps.execute();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
+12
View File
@@ -417,6 +417,7 @@ public class Commands {
float chance = 1000000 / drop.chance / player.getDropRate();
output += "- " + name + " (1/" + (int) chance + ")\r\n";
} catch (Exception ex){
ex.printStackTrace();
continue;
}
}
@@ -629,6 +630,7 @@ public class Commands {
rs.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
break;
@@ -765,6 +767,7 @@ public class Commands {
}
player.changeMap(target, target.getPortal(0));
} catch (Exception ex) {
ex.printStackTrace();
player.yellowMessage("Map ID " + sub[1] + " is invalid.");
return false;
}
@@ -859,6 +862,7 @@ public class Commands {
victim.getClient().disconnect(true, false);
player.getMap().removePlayer(victim);
} catch (Exception e) {
e.printStackTrace();
}
} else {
return true;
@@ -961,6 +965,7 @@ public class Commands {
}
}
} catch (Exception e) {
e.printStackTrace();
}
} else if (sub[0].equals("item") || sub[0].equals("drop")) {
int itemId = Integer.parseInt(sub[1]);
@@ -968,6 +973,7 @@ public class Commands {
try {
quantity = Short.parseShort(sub[2]);
} catch (Exception e) {
e.printStackTrace();
}
if (sub[0].equals("item")) {
int petid = -1;
@@ -1077,8 +1083,10 @@ public class Commands {
player.changeSkillLevel(skill, (byte) skill.getMaxLevel(), skill.getMaxLevel(), -1);
}
} catch (NumberFormatException nfe) {
nfe.printStackTrace();
break;
} catch (NullPointerException npe) {
npe.printStackTrace();
continue;
}
}
@@ -1099,6 +1107,7 @@ public class Commands {
is.close();
packet = packetProps.getProperty("pe");
} catch (IOException ex) {
ex.printStackTrace();
player.yellowMessage("Failed to load pe.txt");
return false;
}
@@ -1223,6 +1232,7 @@ public class Commands {
p.executeUpdate();
}
} catch (Exception e) {
e.printStackTrace();
player.message("Failed to unban " + sub[1]);
return true;
}
@@ -1249,6 +1259,7 @@ public class Commands {
ps.close();
}
} catch (SQLException ex) {
ex.printStackTrace();
c.getPlayer().message("Error occured while banning IP address");
c.getPlayer().message(target.getName() + "'s IP was not banned: " + ip);
}
@@ -1317,6 +1328,7 @@ public class Commands {
player.saveToDB();//To set the new world :O (true because else 2 player instances are created, one in both worlds)
c.announce(MaplePacketCreator.getChannelChange(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1])));
} catch (UnknownHostException | NumberFormatException ex) {
ex.printStackTrace();
player.message("Error when trying to change worlds, are you sure the world you are trying to warp to has the same amount of channels?");
}
+1
View File
@@ -82,6 +82,7 @@ public class ServerConstants {
ServerConstants.SHUTDOWNHOOK = p.getProperty("SHUTDOWNHOOK").equalsIgnoreCase("true");
} catch (Exception e) {
e.printStackTrace();
System.out.println("Failed to load configuration.ini.");
System.exit(0);
}
+3
View File
@@ -78,9 +78,11 @@ public class Main {
System.out.println("Finished crawling section.");
}
} catch (MalformedURLException mue) {
mue.printStackTrace();
System.out.println("Error parsing URL: " + url);
return;
} catch (IOException ioe) {
ioe.printStackTrace();
System.out.println("Error reading from URL: " + ioe.getLocalizedMessage());
return;
}
@@ -277,6 +279,7 @@ public class Main {
pw.close();
bw.close();
} catch (IOException ioe) {
ioe.printStackTrace();
System.out.println("Error writing to file: " + ioe.getLocalizedMessage());
}
}
+1
View File
@@ -61,6 +61,7 @@ public class MapleServerHandler extends IoHandlerAdapter {
@Override
public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
System.out.println("disconnect by exception");
cause.printStackTrace();
if (cause instanceof IOException || cause instanceof ClassCastException) {
return;
+1
View File
@@ -79,6 +79,7 @@ public final class PacketProcessor {
try {
handlers[code.getValue()] = handler;
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
System.out.println("Error registering handler - " + code.name());
}
}
+4
View File
@@ -73,12 +73,14 @@ public class CreateINI {
out = new FileOutputStream("moople.ini", false);
out.write(sb.toString().getBytes());
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
@@ -113,12 +115,14 @@ public class CreateINI {
}
out.write(sb.toString().getBytes());
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
System.out.println("\r\nMake sure that ServerConstants in modified too, and clean+compiled before you start the server.");
+3 -1
View File
@@ -130,6 +130,7 @@ public class Server implements Runnable {
try {
p.load(new FileInputStream("world.ini"));
} catch (Exception e) {
e.printStackTrace();
System.out.println("Please start create_server.bat");
System.exit(0);
}
@@ -200,8 +201,8 @@ public class Server implements Runnable {
System.out.println("Finished loading world " + i + "\r\n");
}
} catch (Exception e) {
System.out.println("Error in moople.ini, start CreateINI.bat to re-make the file.");
e.printStackTrace();//For those who get errors
System.out.println("Error in moople.ini, start CreateINI.bat to re-make the file.");
System.exit(0);
}
@@ -574,6 +575,7 @@ public class Server implements Runnable {
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
ie.printStackTrace();
System.err.println("FUCK MY LIFE");
}
}
+3 -2
View File
@@ -124,6 +124,7 @@ public final class Channel {
finishedShutdown = true;
System.out.println("Successfully shut down Channel " + channel + " on World " + world + "\r\n");
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error while shutting down Channel " + channel + " on World " + world + "\r\n" + e);
}
}
@@ -138,9 +139,9 @@ public final class Channel {
hmit.remove();
}
} catch (Exception e) {
e.printStackTrace();
e.printStackTrace();
} finally {
wlock.unlock();
wlock.unlock();
}
}
@@ -154,6 +154,7 @@ public class BuddylistModifyHandler extends AbstractMaplePacketHandler {
c.announce(MaplePacketCreator.serverNotice(1, "A character called \"" + addName + "\" does not exist"));
}
} catch (SQLException e) {
e.printStackTrace();
}
} else {
ble.changeGroup(group);
@@ -185,6 +186,7 @@ public class BuddylistModifyHandler extends AbstractMaplePacketHandler {
notifyRemoteChannel(c, channel, otherCid, ADDED);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
nextPendingRequest(c);
@@ -238,6 +238,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
try {
chr.sendNote(partner.getName(), text, (byte) 1);
} catch (SQLException ex) {
ex.printStackTrace();
}
partner.showNote();
}
@@ -59,6 +59,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
ps.executeUpdate();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
switch (type) {
@@ -98,6 +99,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
return item;
}
@@ -113,6 +115,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
return validcode;
}
@@ -117,6 +117,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
c.announce(MaplePacketCreator.sendMTS(items, 1, 0, 0, pages));
c.announce(MaplePacketCreator.transferInventory(getTransfer(chr.getId())));
@@ -163,6 +164,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return items;
}
@@ -208,6 +210,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return items;
}
@@ -115,6 +115,7 @@ public class FredrickHandler extends AbstractMaplePacketHandler {
}
return true;
} catch (SQLException e) {
e.printStackTrace();
return false;
}
@@ -47,6 +47,7 @@ public final class HiredMerchantRequest extends AbstractMaplePacketHandler {
chr.announce(MaplePacketCreator.retrieveFirstMessage());
}
} catch (SQLException ex) {
ex.printStackTrace();
}
} else {
chr.dropMessage(1, "You already have a store open.");
@@ -202,6 +202,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
ps.close();
MapleInventoryManipulator.removeFromSlot(c, type, slot, quantity, false);
} catch (SQLException e) {
e.printStackTrace();
}
c.getPlayer().gainMeso(-5000, false);
c.announce(MaplePacketCreator.MTSConfirmSell());
@@ -329,6 +330,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println("MTS Transfer error: " + e);
}
} else if (op == 9) { //add to cart
@@ -441,6 +443,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
c.announce(MaplePacketCreator.MTSFailBuy());
}
} else if (op == 17) { //buy from cart
@@ -498,6 +501,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
c.announce(MaplePacketCreator.MTSFailBuy());
}
} else {
@@ -551,6 +555,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
return items;
}
@@ -616,6 +621,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
return MaplePacketCreator.sendMTS(items, 4, 0, 0, pages);
}
@@ -663,6 +669,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
return items;
}
@@ -735,6 +742,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
return MaplePacketCreator.sendMTS(items, tab, type, page, pages); // resniff
}
@@ -828,6 +836,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
ps.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
return MaplePacketCreator.sendMTS(items, tab, type, page, pages);
}
@@ -126,6 +126,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
pss.executeUpdate();
pss.close();
} catch (SQLException e) {
e.printStackTrace();
}
c.announce(MaplePacketCreator.sendDueyMSG((byte) 0x1B));
}
@@ -84,6 +84,7 @@ public final class RingActionHandler extends AbstractMaplePacketHandler {
ps.executeUpdate();
ps.close();
} catch (Exception ex) {
ex.printStackTrace();
}
c.getPlayer().dropMessage(1, "Your engagement has been broken up.");
break;
@@ -47,6 +47,7 @@ public final class SpouseChatHandler extends AbstractMaplePacketHandler {
// } else
// c.getPlayer().message("You are either not married or your spouse is currently offline.");
// } catch (Exception e) {
// e.printStackTrace();
// c.getPlayer().message("You are either not married or your spouse is currently offline.");
// c.getChannelServer().reconnectWorld();
// }
@@ -357,6 +357,7 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
try {
player.sendNote(sendTo, msg, (byte) 0);
} catch (SQLException e) {
e.printStackTrace();
}
remove(c, itemId);
} else if (itemType == 510) {
+3
View File
@@ -79,6 +79,7 @@ public class MapleAlliance {
ps.close();
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
return alliance;
}
@@ -107,6 +108,7 @@ public class MapleAlliance {
ps.executeQuery();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
@@ -146,6 +148,7 @@ public class MapleAlliance {
ps.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
return ret;
}
+7
View File
@@ -103,6 +103,7 @@ public class MapleGuild {
ps.close();
rs.close();
} catch (SQLException se) {
se.printStackTrace();
System.out.println("unable to read guild information from sql" + se);
}
}
@@ -171,6 +172,7 @@ public class MapleGuild {
this.broadcast(MaplePacketCreator.guildDisband(this.id));
}
} catch (SQLException se) {
se.printStackTrace();
}
}
@@ -267,6 +269,7 @@ public class MapleGuild {
}
}
} catch (Exception re) {
re.printStackTrace();
System.out.println("Failed to contact channel(s) for broadcast.");//fu?
}
}
@@ -337,6 +340,7 @@ public class MapleGuild {
ps.close();
return guildid;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
@@ -389,6 +393,7 @@ public class MapleGuild {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
System.out.println("expelMember - MapleGuild " + e);
}
Server.getInstance().getWorld(mgc.getWorld()).setOfflineGuildStatus((short) 0, (byte) 5, cid);
@@ -531,6 +536,7 @@ public class MapleGuild {
}
rs.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println("failed to display guild ranks. " + e);
}
}
@@ -548,6 +554,7 @@ public class MapleGuild {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
@@ -49,6 +49,7 @@ public final class CharSelectedHandler extends AbstractMaplePacketHandler {
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException | NumberFormatException e) {
e.printStackTrace();
}
}
}
@@ -35,6 +35,7 @@ public class CharSelectedWithPicHandler extends AbstractMaplePacketHandler {
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException | NumberFormatException e) {
e.printStackTrace();
}
} else {
c.announce(MaplePacketCreator.wrongPic());
@@ -46,6 +46,7 @@ public final class PickCharHandler extends AbstractMaplePacketHandler {
try {
c.setChannel(Randomizer.nextInt(Server.getInstance().getWorld(world).getChannels().size()));
} catch (Exception e) {
e.printStackTrace();
c.setChannel(1);
}
if (c.getIdleTask() != null) {
@@ -56,6 +57,7 @@ public final class PickCharHandler extends AbstractMaplePacketHandler {
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
@@ -37,6 +37,7 @@ public final class RegisterPicHandler extends AbstractMaplePacketHandler {
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException e) {
e.printStackTrace();
}
} else {
c.getSession().close(true);
@@ -38,6 +38,7 @@ public class ViewAllCharSelectedWithPicHandler extends AbstractMaplePacketHandle
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException e) {
e.printStackTrace();
}
} else {
@@ -36,6 +36,7 @@ public final class ViewAllPicRegisterHandler extends AbstractMaplePacketHandler
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
@@ -76,6 +76,7 @@ public final class ViewCharHandler extends AbstractMaplePacketHandler {
c.announce(MaplePacketCreator.showAllCharacterInfo(w, chrsinworld));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
+1
View File
@@ -105,6 +105,7 @@ public class MapleDataTool {
try {
return Integer.parseInt(getString(d));
} catch (NumberFormatException nfe) {
nfe.printStackTrace();
return def;
}
} else {
+1
View File
@@ -75,6 +75,7 @@ public class ListWZFile {
listwz = new ListWZFile(MapleDataProviderFactory.fileInWZPath("List.wz"));
modernImgs = new HashSet<String>(listwz.getEntries());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
+1
View File
@@ -142,6 +142,7 @@ public class WZFile implements MapleDataProvider {
MapleData ret = imgFile.getRoot();
return ret;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
+3
View File
@@ -56,11 +56,14 @@ public class WZTool {
try {
cipher = Cipher.getInstance("AES");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
}
try {
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
} catch (InvalidKeyException e) {
e.printStackTrace();
}
encKey = new byte[0xFFFF];
for (int i = 0; i < (0xFFFF / 16); i++) {
+31 -16
View File
@@ -28,6 +28,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.text.NumberFormat;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -42,6 +44,7 @@ import org.xml.sax.SAXException;
public class XMLDomMapleData implements MapleData {
private Node node;
private File imageDataDir;
private NumberFormat nf;
public XMLDomMapleData(FileInputStream fis, File imageDataDir) {
try {
@@ -57,10 +60,12 @@ public class XMLDomMapleData implements MapleData {
throw new RuntimeException(e);
}
this.imageDataDir = imageDataDir;
this.nf = NumberFormat.getInstance(Locale.FRANCE);
}
private XMLDomMapleData(Node node) {
this.node = node;
this.nf = NumberFormat.getInstance(Locale.FRANCE);
}
@Override
@@ -114,25 +119,35 @@ public class XMLDomMapleData implements MapleData {
case DOUBLE:
case FLOAT:
case INT:
case SHORT:
case SHORT: {
String value = attributes.getNamedItem("value").getNodeValue();
Number nval;
try {
nval = nf.parse(value);
}
catch(java.text.ParseException pe) {
pe.printStackTrace();
nval = 0.0f;
}
switch (type) {
case DOUBLE:
return nval.doubleValue();
case FLOAT:
return nval.floatValue();
case INT:
return nval.intValue();
case SHORT:
return nval.shortValue();
default:
return null;
}
}
case STRING:
case UOL: {
String value = attributes.getNamedItem("value").getNodeValue();
switch (type) {
case DOUBLE:
return Double.valueOf(Double.parseDouble(value));
case FLOAT:
return Float.valueOf(Float.parseFloat(value));
case INT:
return Integer.valueOf(Integer.parseInt(value));
case SHORT:
return Short.valueOf(Short.parseShort(value));
case STRING:
case UOL:
return value;
default:
break;
}
return value;
}
case VECTOR: {
String x = attributes.getNamedItem("x").getNodeValue();
+3 -3
View File
@@ -216,7 +216,7 @@ public class AbstractPlayerInteraction {
try {
return getQuestStatus(quest) == MapleQuestStatus.Status.COMPLETED;
} catch (NullPointerException e) {
e.printStackTrace();
e.printStackTrace();
return false;
}
}
@@ -229,7 +229,7 @@ public class AbstractPlayerInteraction {
try {
return getQuestStatus(quest) == MapleQuestStatus.Status.STARTED;
} catch (NullPointerException e) {
e.printStackTrace();
e.printStackTrace();
return false;
}
}
@@ -461,7 +461,7 @@ public class AbstractPlayerInteraction {
try {
return Server.getInstance().getGuild(getPlayer().getGuildId(), getPlayer().getWorld(), null);
} catch (Exception e) {
e.printStackTrace();
e.printStackTrace();
}
return null;
}
+7 -21
View File
@@ -61,9 +61,7 @@ public class EventManager {
public void cancel() {
try {
iv.invokeFunction("cancelSchedule", (Object) null);
} catch (ScriptException ex) {
ex.printStackTrace();
} catch (NoSuchMethodException ex) {
} catch (ScriptException | NoSuchMethodException ex) {
ex.printStackTrace();
}
}
@@ -77,9 +75,7 @@ public class EventManager {
public void run() {
try {
iv.invokeFunction(methodName, eim);
} catch (ScriptException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchMethodException ex) {
} catch (ScriptException | NoSuchMethodException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -95,9 +91,7 @@ public class EventManager {
public void run() {
try {
iv.invokeFunction(methodName, (Object) null);
} catch (ScriptException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchMethodException ex) {
} catch (ScriptException | NoSuchMethodException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -156,9 +150,7 @@ public class EventManager {
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", (Object) null));
eim.registerExpedition(exped);
exped.start();
} catch (ScriptException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchMethodException ex) {
} catch (ScriptException | NoSuchMethodException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -168,9 +160,7 @@ public class EventManager {
try {
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", (Object) null));
eim.registerPlayer(chr);
} catch (ScriptException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchMethodException ex) {
} catch (ScriptException | NoSuchMethodException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -180,9 +170,7 @@ public class EventManager {
try {
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", (Object) null));
eim.registerParty(party, map);
} catch (ScriptException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchMethodException ex) {
} catch (ScriptException | NoSuchMethodException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -192,9 +180,7 @@ public class EventManager {
try {
iv.invokeFunction("setup", eim);
eim.setProperty("leader", leader);
} catch (ScriptException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchMethodException ex) {
} catch (ScriptException | NoSuchMethodException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -91,6 +91,7 @@ public class ItemScriptManager {
try {
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
+2
View File
@@ -66,6 +66,7 @@ public class MapScriptManager {
try {
scripts.get(scriptName).invokeFunction("start", new MapScriptMethods(c));
} catch (final ScriptException | NoSuchMethodException e) {
e.printStackTrace();
}
return;
}
@@ -93,6 +94,7 @@ public class MapScriptManager {
try {
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -191,6 +191,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
try {
MapleQuest.getInstance(id).forceStart(getPlayer(), npc);
} catch (NullPointerException ex) {
ex.printStackTrace();
}
}
@@ -198,6 +199,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
try {
MapleQuest.getInstance(id).forceComplete(getPlayer(), npc);
} catch (NullPointerException ex) {
ex.printStackTrace();
}
}
@@ -205,6 +207,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
try {
MapleQuest.getInstance(id).forceStart(getPlayer(), npc);
} catch (NullPointerException ex) {
ex.printStackTrace();
}
}
@@ -212,6 +215,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
try {
MapleQuest.getInstance(id).forceComplete(getPlayer(), npc);
} catch (NullPointerException ex) {
ex.printStackTrace();
}
}
@@ -326,8 +330,10 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
Skill skill = SkillFactory.getSkill(Integer.parseInt(skill_.getName()));
getPlayer().changeSkillLevel(skill, (byte) 0, skill.getMaxLevel(), -1);
} catch (NumberFormatException nfe) {
nfe.printStackTrace();
break;
} catch (NullPointerException npe) {
npe.printStackTrace();
continue;
}
}
@@ -368,6 +374,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
ps.close();
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
@@ -425,6 +432,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
Server.getInstance().addAlliance(id, alliance);
Server.getInstance().allianceMessage(id, MaplePacketCreator.makeNewAlliance(alliance, chr1.getClient()), -1, -1);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return alliance;
@@ -440,7 +448,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
return true;
}
} catch (SQLException e) {
e.printStackTrace();
e.printStackTrace();
return false;
}
if (getPlayer().getMerchantMeso() == 0) {
@@ -68,6 +68,7 @@ public class PortalPlayerInteraction extends AbstractPlayerInteraction {
rs.close();
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
return false;
@@ -73,7 +73,7 @@ public class PortalScriptManager {
try {
fr.close();
} catch (IOException e) {
System.out.println("ERROR CLOSING " + e);
e.printStackTrace();
}
}
}
+1
View File
@@ -71,6 +71,7 @@ public class MakerItemFactory {
ps.close();
createCache.put(toCreate, ret);
} catch (SQLException sqle) {
sqle.printStackTrace();
}
}
return createCache.get(toCreate);
@@ -1134,6 +1134,7 @@ public class MapleItemInformationProvider {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (rs != null) {
@@ -1143,6 +1144,7 @@ public class MapleItemInformationProvider {
ps.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
@@ -1293,6 +1295,7 @@ public class MapleItemInformationProvider {
}
}
} catch (SQLException ex) {
ex.printStackTrace();
}*/
int tdex = chr.getDex(), tstr = chr.getStr(), tint = chr.getInt(), tluk = chr.getLuk(), fame = chr.getFame();
if (chr.getJob() != MapleJob.SUPERGM || chr.getJob() != MapleJob.GM) {
@@ -1374,6 +1377,7 @@ public class MapleItemInformationProvider {
}
}
} catch (SQLException ex) {
ex.printStackTrace();
}*/
int reqLevel = getEquipStats(equip.getItemId()).get("reqLevel");
+1
View File
@@ -40,6 +40,7 @@ public class TimerManager implements TimerManagerMBean {
try {
mBeanServer.registerMBean(this, new ObjectName("server:type=TimerManger"));
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -79,7 +79,7 @@ public class MapleMonsterInformationProvider {
rs.close();
ps.close();
} catch (SQLException e) {
System.err.println("Error retrieving drop" + e);
System.err.println("Error retrieving drop" + e);
} finally {
try {
if (ps != null) {
@@ -89,6 +89,7 @@ public class MapleMonsterInformationProvider {
rs.close();
}
} catch (SQLException ignore) {
ignore.printStackTrace();
}
}
}
@@ -116,6 +117,7 @@ public class MapleMonsterInformationProvider {
rs.getShort("questid")));
}
} catch (SQLException e) {
e.printStackTrace();
return ret;
} finally {
try {
@@ -126,6 +128,7 @@ public class MapleMonsterInformationProvider {
rs.close();
}
} catch (SQLException ignore) {
ignore.printStackTrace();
return ret;
}
}
@@ -159,6 +162,8 @@ public class MapleMonsterInformationProvider {
return MapleLifeFactory.getMonster(id).getName();
} catch (Exception e)
{
e.printStackTrace();
System.err.println("Nonexistant mob id " + id);
return null; //nonexistant mob
}
}
+7
View File
@@ -175,6 +175,7 @@ public class HiredMerchant extends AbstractMapleMapObject {
ps.executeUpdate();
}
} catch (Exception e) {
e.printStackTrace();
}
}
} else {
@@ -186,6 +187,7 @@ public class HiredMerchant extends AbstractMapleMapObject {
try {
this.saveItems(false);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -198,6 +200,7 @@ public class HiredMerchant extends AbstractMapleMapObject {
saveItems(true);
items.clear();
} catch (SQLException ex) {
ex.printStackTrace();
}
//Server.getInstance().getChannel(world, channel).removeHiredMerchant(ownerId);
map.broadcastMessage(MaplePacketCreator.destroyHiredMerchant(getOwnerId()));
@@ -247,10 +250,12 @@ public class HiredMerchant extends AbstractMapleMapObject {
try {
this.saveItems(timeout);
} catch (Exception e) {
e.printStackTrace();
}
items.clear();
} catch (Exception e) {
e.printStackTrace();
}
schedule.cancel(false);
}
@@ -284,6 +289,7 @@ public class HiredMerchant extends AbstractMapleMapObject {
try {
this.saveItems(false);
} catch (SQLException ex) {
ex.printStackTrace();
}
}
@@ -292,6 +298,7 @@ public class HiredMerchant extends AbstractMapleMapObject {
try {
this.saveItems(false);
} catch (SQLException ex) {
ex.printStackTrace();
}
}
+33 -17
View File
@@ -733,6 +733,39 @@ public class MapleMap {
public List<MapleMapObject> getAllPlayer() {
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER));
}
public List<MapleCharacter> getAllPlayers() {
List<MapleCharacter> character = new LinkedList<>();
chrRLock.lock();
try {
for (MapleCharacter a : characters) {
character.add(a);
}
} finally {
chrRLock.unlock();
}
return character;
}
public List<MapleCharacter> getPlayersInRange(Rectangle box, List<MapleCharacter> chr) {
List<MapleCharacter> character = new LinkedList<>();
chrRLock.lock();
try {
for (MapleCharacter a : characters) {
if (chr.contains(a.getClient().getPlayer())) {
if (box.contains(a.getPosition())) {
character.add(a);
}
}
}
} finally {
chrRLock.unlock();
}
return character;
}
public void destroyReactor(int oid) {
final MapleReactor reactor = getReactorByOid(oid);
@@ -1131,23 +1164,6 @@ public class MapleMap {
}
public List<MapleCharacter> getPlayersInRange(Rectangle box, List<MapleCharacter> chr) {
List<MapleCharacter> character = new LinkedList<>();
chrRLock.lock();
try {
for (MapleCharacter a : characters) {
if (chr.contains(a.getClient().getPlayer())) {
if (box.contains(a.getPosition())) {
character.add(a);
}
}
}
return character;
} finally {
chrRLock.unlock();
}
}
public void spawnSummon(final MapleSummon summon) {
spawnAndAddRangedMapObject(summon, new DelayedPacketCreation() {
@Override
+5 -1
View File
@@ -146,6 +146,7 @@ public class MapleMapFactory {
}
}
} catch (Exception e) {
e.printStackTrace();
}
for (MapleData life : mapData.getChildByPath("life")) {
String id = MapleDataTool.getString(life.getChildByPath("id"));
@@ -180,6 +181,9 @@ public class MapleMapFactory {
map.setMapName(MapleDataTool.getString("mapName", nameData.getChildByPath(getMapStringName(omapid)), ""));
map.setStreetName(MapleDataTool.getString("streetName", nameData.getChildByPath(getMapStringName(omapid)), ""));
} catch (Exception e) {
e.printStackTrace();
System.err.println("Not found mapid " + omapid);
map.setMapName("");
map.setStreetName("");
}
@@ -270,7 +274,7 @@ public class MapleMapFactory {
builder.append("victoria");
} else if (mapid >= 200000000 && mapid < 300000000) {
builder.append("ossyria");
} else if (mapid >= 540000000 && mapid < 551030200) {
} else if (mapid >= 540000000 && mapid < 560000000) {
builder.append("singapore");
} else if (mapid >= 600000000 && mapid < 620000000) {
builder.append("MasteriaGL");
+1
View File
@@ -63,6 +63,7 @@ public class PlayerNPCs extends AbstractMapleMapObject {
rs2.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
+9
View File
@@ -60,12 +60,14 @@ public class FilePrinter {
out.write(getString(t).getBytes());
out.write("\n---------------------------------\r\n".getBytes());
} catch (IOException ess) {
ess.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ignore) {
ignore.printStackTrace();
}
}
}
@@ -85,12 +87,14 @@ public class FilePrinter {
out.write(getString(t).getBytes());
out.write("\n---------------------------------\r\n".getBytes());
} catch (IOException ess) {
ess.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ignore) {
ignore.printStackTrace();
}
}
}
@@ -109,12 +113,14 @@ public class FilePrinter {
out.write(s.getBytes());
//out.write("\n---------------------------------\n".getBytes());
} catch (IOException ess) {
ess.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ignore) {
ignore.printStackTrace();
}
}
}
@@ -140,12 +146,14 @@ public class FilePrinter {
out.write("---------------------------------\r\n".getBytes());
}
} catch (IOException ess) {
ess.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ignore) {
ignore.printStackTrace();
}
}
}
@@ -168,6 +176,7 @@ public class FilePrinter {
sw.close();
}
} catch (IOException ignore) {
ignore.printStackTrace();
}
}
return retValue;
+3
View File
@@ -63,6 +63,7 @@ public class MapleAESOFB {
try {
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
} catch (InvalidKeyException e) {
e.printStackTrace();
}
this.setIv(iv);
this.mapleVersion = (short) (((mapleVersion >> 8) & 0xFF) | ((mapleVersion << 8) & 0xFF00));
@@ -97,7 +98,9 @@ public class MapleAESOFB {
myIv[j] = newIv[j];
}
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
}
}
data[x] ^= myIv[(x - start) % myIv.length];
@@ -57,6 +57,7 @@ public class GenericSeekableLittleEndianAccessor extends GenericLittleEndianAcce
try {
bs.seek(offset);
} catch (IOException e) {
e.printStackTrace();
System.out.println("Seek failed " + e);
}
}
@@ -72,6 +73,7 @@ public class GenericSeekableLittleEndianAccessor extends GenericLittleEndianAcce
try {
return bs.getPosition();
} catch (IOException e) {
e.printStackTrace();
System.out.println("getPosition failed" + e);
return -1;
}
@@ -85,6 +85,7 @@ public class InputStreamByteStream implements ByteInputStream {
try {
return is.available();
} catch (IOException e) {
e.printStackTrace();
System.out.println("ERROR" + e);
return 0;
}
@@ -76,6 +76,7 @@ public class RandomAccessByteStream implements SeekableInputStreamBytestream {
try {
return raf.length() - raf.getFilePointer();
} catch (IOException e) {
e.printStackTrace();
System.out.println("ERROR " + e);
return 0;
}