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);
world = Instance.getWorld();
world.wl.loadObjects();
try {
world.wl.loadObjects();
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
World.initilizeDB();

View File

@ -91,7 +91,12 @@ public final class GameEngine extends Thread {
captcha = new Captcha();
captcha.init();
packetQueue = new PacketQueue<RSCPacket>();
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) {

View File

@ -112,7 +112,12 @@ public class LoginConnector {
public LoginConnector() {
packetQueue = new PacketQueue<LSPacket>();
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 {

View File

@ -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();
}

View File

@ -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))

View File

@ -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) {