Fixed various errors.

This commit is contained in:
Joe0 2011-12-19 00:27:59 -06:00
parent 0145a249a8
commit 7629871bc7
6 changed files with 65 additions and 43 deletions

View File

@ -49,7 +49,12 @@ public class Server {
Config.initConfig(configFile); Config.initConfig(configFile);
world = Instance.getWorld(); world = Instance.getWorld();
try {
world.wl.loadObjects(); world.wl.loadObjects();
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
World.initilizeDB(); World.initilizeDB();

View File

@ -91,7 +91,12 @@ public final class GameEngine extends Thread {
captcha = new Captcha(); captcha = new Captcha();
captcha.init(); captcha.init();
packetQueue = new PacketQueue<RSCPacket>(); packetQueue = new PacketQueue<RSCPacket>();
try {
loadPacketHandlers(); loadPacketHandlers();
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
for (Shop shop : world.getShops()) { for (Shop shop : world.getShops()) {
shop.initRestock(); shop.initRestock();
} }
@ -146,8 +151,9 @@ public final class GameEngine extends Thread {
/** /**
* Loads the packet handling classes from the persistence manager. * Loads the packet handling classes from the persistence manager.
* @throws Exception
*/ */
protected void loadPacketHandlers() { protected void loadPacketHandlers() throws Exception {
PacketHandlerDef[] handlerDefs = Instance.getDataStore() PacketHandlerDef[] handlerDefs = Instance.getDataStore()
.loadPacketHandlerDefs(); .loadPacketHandlerDefs();
for (PacketHandlerDef handlerDef : handlerDefs) { for (PacketHandlerDef handlerDef : handlerDefs) {

View File

@ -112,7 +112,12 @@ public class LoginConnector {
public LoginConnector() { public LoginConnector() {
packetQueue = new PacketQueue<LSPacket>(); packetQueue = new PacketQueue<LSPacket>();
try {
loadPacketHandlers(); loadPacketHandlers();
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
reconnect(); reconnect();
} }
@ -138,7 +143,7 @@ public class LoginConnector {
actionSender.unregisterWorld(); actionSender.unregisterWorld();
} }
private void loadPacketHandlers() { private void loadPacketHandlers() throws Exception {
PacketHandlerDef[] handlerDefs = Instance.getDataStore().loadLSPacketHandlerDefs(); PacketHandlerDef[] handlerDefs = Instance.getDataStore().loadLSPacketHandlerDefs();
for (PacketHandlerDef handlerDef : handlerDefs) { for (PacketHandlerDef handlerDef : handlerDefs) {
try { try {

View File

@ -52,6 +52,7 @@ public class EntityHandler {
static { static {
DataStore dataStore = Instance.getDataStore(); DataStore dataStore = Instance.getDataStore();
try {
doors = dataStore.loadDoorDefs(); doors = dataStore.loadDoorDefs();
gameObjects = dataStore.loadGameObjectDefs(); gameObjects = dataStore.loadGameObjectDefs();
npcs = dataStore.loadNPCDefs(); npcs = dataStore.loadNPCDefs();
@ -89,6 +90,10 @@ public class EntityHandler {
certers = dataStore.loadCerterDefs(); certers = dataStore.loadCerterDefs();
agilityObjects = dataStore.loadAgilityDefs(); agilityObjects = dataStore.loadAgilityDefs();
agilityCourses = dataStore.loadAgilityCourseDefs(); agilityCourses = dataStore.loadAgilityCourseDefs();
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
dataStore.dispose(); dataStore.dispose();
} }

View File

@ -127,7 +127,7 @@ public class WorldLoader {
* } * }
*/ */
public void loadWorld(World world) { public void loadWorld(World world) throws Exception {
try { try {
tileArchive = new ZipFile(new File(Config.CONF_DIR, tileArchive = new ZipFile(new File(Config.CONF_DIR,
"data/Landscape.rscd")); "data/Landscape.rscd"));
@ -157,7 +157,7 @@ public class WorldLoader {
System.gc(); System.gc();
} }
public void loadObjects() { public void loadObjects() throws Exception {
World world = Instance.getWorld(); World world = Instance.getWorld();
for (GameObjectLoc gameObject : Instance.getDataStore().loadGameObjectLocs()) { for (GameObjectLoc gameObject : Instance.getDataStore().loadGameObjectLocs()) {
if (Config.f2pWildy && Formulae.isP2P(true, gameObject)) if (Config.f2pWildy && Formulae.isP2P(true, gameObject))

View File

@ -468,8 +468,9 @@ public final class World {
/** /**
* Loads the npc handling classes * Loads the npc handling classes
* @throws Exception
*/ */
private void loadNpcHandlers() { private void loadNpcHandlers() throws Exception {
NpcHandlerDef[] handlerDefs = Instance.getDataStore().loadNpcHandlers(); NpcHandlerDef[] handlerDefs = Instance.getDataStore().loadNpcHandlers();
for (NpcHandlerDef handlerDef : handlerDefs) { for (NpcHandlerDef handlerDef : handlerDefs) {