Move have handler creation up, to prevent NPE.

This commit is contained in:
Lex Manos 2013-09-19 16:47:46 -07:00
parent f58df75bea
commit 98aecd7f6b

View file

@ -92,11 +92,10 @@
this.worldLogAgent = par6ILogAgent; this.worldLogAgent = par6ILogAgent;
this.worldInfo = par1ISaveHandler.loadWorldInfo(); this.worldInfo = par1ISaveHandler.loadWorldInfo();
@@ -275,12 +315,20 @@ @@ -249,6 +289,14 @@
this.worldInfo.setServerInitialized(true);
}
- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages"); this.provider.registerWorld(this);
this.chunkProvider = this.createChunkProvider();
+ if (this instanceof WorldServer) + if (this instanceof WorldServer)
+ { + {
+ this.perWorldStorage = new MapStorage(new WorldSpecificSaveHandler((WorldServer)this, par1ISaveHandler)); + this.perWorldStorage = new MapStorage(new WorldSpecificSaveHandler((WorldServer)this, par1ISaveHandler));
@ -105,6 +104,14 @@
+ { + {
+ this.perWorldStorage = new MapStorage((ISaveHandler)null); + this.perWorldStorage = new MapStorage((ISaveHandler)null);
+ } + }
if (!this.worldInfo.isInitialized())
{
@@ -275,12 +323,12 @@
this.worldInfo.setServerInitialized(true);
}
- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages");
+ VillageCollection villagecollection = (VillageCollection)perWorldStorage.loadData(VillageCollection.class, "villages"); + VillageCollection villagecollection = (VillageCollection)perWorldStorage.loadData(VillageCollection.class, "villages");
if (villagecollection == null) if (villagecollection == null)