diff --git a/GameServer/src/org/moparscape/msc/gs/Server.java b/GameServer/src/org/moparscape/msc/gs/Server.java index 7c81ae3..f78b934 100644 --- a/GameServer/src/org/moparscape/msc/gs/Server.java +++ b/GameServer/src/org/moparscape/msc/gs/Server.java @@ -49,7 +49,12 @@ public class Server { Config.initConfig(configFile); world = Instance.getWorld(); - world.wl.loadObjects(); + try { + world.wl.loadObjects(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(0); + } World.initilizeDB(); diff --git a/GameServer/src/org/moparscape/msc/gs/core/GameEngine.java b/GameServer/src/org/moparscape/msc/gs/core/GameEngine.java index 84487f7..0f2388f 100644 --- a/GameServer/src/org/moparscape/msc/gs/core/GameEngine.java +++ b/GameServer/src/org/moparscape/msc/gs/core/GameEngine.java @@ -91,7 +91,12 @@ public final class GameEngine extends Thread { captcha = new Captcha(); captcha.init(); packetQueue = new PacketQueue(); - loadPacketHandlers(); + try { + loadPacketHandlers(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(0); + } for (Shop shop : world.getShops()) { shop.initRestock(); } @@ -146,8 +151,9 @@ public final class GameEngine extends Thread { /** * Loads the packet handling classes from the persistence manager. + * @throws Exception */ - protected void loadPacketHandlers() { + protected void loadPacketHandlers() throws Exception { PacketHandlerDef[] handlerDefs = Instance.getDataStore() .loadPacketHandlerDefs(); for (PacketHandlerDef handlerDef : handlerDefs) { diff --git a/GameServer/src/org/moparscape/msc/gs/core/LoginConnector.java b/GameServer/src/org/moparscape/msc/gs/core/LoginConnector.java index 9e910f8..066e350 100644 --- a/GameServer/src/org/moparscape/msc/gs/core/LoginConnector.java +++ b/GameServer/src/org/moparscape/msc/gs/core/LoginConnector.java @@ -112,7 +112,12 @@ public class LoginConnector { public LoginConnector() { packetQueue = new PacketQueue(); - loadPacketHandlers(); + try { + loadPacketHandlers(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(0); + } reconnect(); } @@ -138,7 +143,7 @@ public class LoginConnector { actionSender.unregisterWorld(); } - private void loadPacketHandlers() { + private void loadPacketHandlers() throws Exception { PacketHandlerDef[] handlerDefs = Instance.getDataStore().loadLSPacketHandlerDefs(); for (PacketHandlerDef handlerDef : handlerDefs) { try { diff --git a/GameServer/src/org/moparscape/msc/gs/external/EntityHandler.java b/GameServer/src/org/moparscape/msc/gs/external/EntityHandler.java index 9c01703..230acf7 100644 --- a/GameServer/src/org/moparscape/msc/gs/external/EntityHandler.java +++ b/GameServer/src/org/moparscape/msc/gs/external/EntityHandler.java @@ -52,43 +52,48 @@ public class EntityHandler { static { DataStore dataStore = Instance.getDataStore(); - doors = dataStore.loadDoorDefs(); - gameObjects = dataStore.loadGameObjectDefs(); - npcs = dataStore.loadNPCDefs(); - for (NPCDef n : npcs) { - if (n.isAttackable()) { - n.respawnTime -= (n.respawnTime / 3); + try { + doors = dataStore.loadDoorDefs(); + gameObjects = dataStore.loadGameObjectDefs(); + npcs = dataStore.loadNPCDefs(); + for (NPCDef n : npcs) { + if (n.isAttackable()) { + n.respawnTime -= (n.respawnTime / 3); + } } + prayers = dataStore.loadPrayerDefs(); + items = dataStore.loadItemDefs(); + spells = dataStore.loadSpellDefs(); + tiles = dataStore.loadTileDefs(); + keyChestLoots = dataStore.loadKeyChestLoots(); + herbSeconds = dataStore.loadItemHerbSeconds(); + dartTips = dataStore.loadDartTips(); + gems = dataStore.loadGemDefs(); + logCut = dataStore.loadItemLogCutDefs(); + bowString = dataStore.loadItemBowStringDefs(); + arrowHeads = dataStore.loadItemArrowHeadDefs(); + firemaking = dataStore.loadFiremakingDefs(); + itemAffectedTypes = dataStore.loadItemAffectedTypes(); + itemWieldable = dataStore.loadItemWieldableDefs(); + itemUnIdentHerb = dataStore.loadItemUnIdentHerbDefs(); + itemHerb = dataStore.loadItemHerbDefs(); + itemEdibleHeals = dataStore.loadItemEdibleHeals(); + itemCooking = dataStore.loadItemCookingDefs(); + itemSmelting = dataStore.loadItemSmeltingDefs(); + itemSmithing = dataStore.loadItemSmithingDefs(); + itemCrafting = dataStore.loadItemCraftingDefs(); + objectMining = dataStore.loadObjectMiningDefs(); + objectWoodcutting = dataStore.loadObjectWoodcuttingDefs(); + objectFishing = dataStore.loadObjectFishDefs(); + spellAggressiveLvl = dataStore.loadSpellAgressiveLevel(); + objectTelePoints = dataStore.loadTelePoints(); + certers = dataStore.loadCerterDefs(); + agilityObjects = dataStore.loadAgilityDefs(); + agilityCourses = dataStore.loadAgilityCourseDefs(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(0); } - prayers = dataStore.loadPrayerDefs(); - items = dataStore.loadItemDefs(); - spells = dataStore.loadSpellDefs(); - tiles = dataStore.loadTileDefs(); - keyChestLoots = dataStore.loadKeyChestLoots(); - herbSeconds = dataStore.loadItemHerbSeconds(); - dartTips = dataStore.loadDartTips(); - gems = dataStore.loadGemDefs(); - logCut = dataStore.loadItemLogCutDefs(); - bowString = dataStore.loadItemBowStringDefs(); - arrowHeads = dataStore.loadItemArrowHeadDefs(); - firemaking = dataStore.loadFiremakingDefs(); - itemAffectedTypes = dataStore.loadItemAffectedTypes(); - itemWieldable = dataStore.loadItemWieldableDefs(); - itemUnIdentHerb = dataStore.loadItemUnIdentHerbDefs(); - itemHerb = dataStore.loadItemHerbDefs(); - itemEdibleHeals = dataStore.loadItemEdibleHeals(); - itemCooking = dataStore.loadItemCookingDefs(); - itemSmelting = dataStore.loadItemSmeltingDefs(); - itemSmithing = dataStore.loadItemSmithingDefs(); - itemCrafting = dataStore.loadItemCraftingDefs(); - objectMining = dataStore.loadObjectMiningDefs(); - objectWoodcutting = dataStore.loadObjectWoodcuttingDefs(); - objectFishing = dataStore.loadObjectFishDefs(); - spellAggressiveLvl = dataStore.loadSpellAgressiveLevel(); - objectTelePoints = dataStore.loadTelePoints(); - certers = dataStore.loadCerterDefs(); - agilityObjects = dataStore.loadAgilityDefs(); - agilityCourses = dataStore.loadAgilityCourseDefs(); dataStore.dispose(); } diff --git a/GameServer/src/org/moparscape/msc/gs/io/WorldLoader.java b/GameServer/src/org/moparscape/msc/gs/io/WorldLoader.java index 7f176c8..d5db80f 100644 --- a/GameServer/src/org/moparscape/msc/gs/io/WorldLoader.java +++ b/GameServer/src/org/moparscape/msc/gs/io/WorldLoader.java @@ -127,7 +127,7 @@ public class WorldLoader { * } */ - public void loadWorld(World world) { + public void loadWorld(World world) throws Exception { try { tileArchive = new ZipFile(new File(Config.CONF_DIR, "data/Landscape.rscd")); @@ -157,7 +157,7 @@ public class WorldLoader { System.gc(); } - public void loadObjects() { + public void loadObjects() throws Exception { World world = Instance.getWorld(); for (GameObjectLoc gameObject : Instance.getDataStore().loadGameObjectLocs()) { if (Config.f2pWildy && Formulae.isP2P(true, gameObject)) diff --git a/GameServer/src/org/moparscape/msc/gs/model/World.java b/GameServer/src/org/moparscape/msc/gs/model/World.java index be76e12..89cb5b2 100644 --- a/GameServer/src/org/moparscape/msc/gs/model/World.java +++ b/GameServer/src/org/moparscape/msc/gs/model/World.java @@ -468,8 +468,9 @@ public final class World { /** * Loads the npc handling classes + * @throws Exception */ - private void loadNpcHandlers() { + private void loadNpcHandlers() throws Exception { NpcHandlerDef[] handlerDefs = Instance.getDataStore().loadNpcHandlers(); for (NpcHandlerDef handlerDef : handlerDefs) {