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
1 changed files with 11 additions and 4 deletions

View File

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