@@ -230,17 +230,6 @@ static void LoadWorldListEntry([NotNull] XElement el)
230230 if ( blockEl != null ) {
231231 world . BlockDB . LoadSettings ( blockEl ) ;
232232 }
233-
234- // Load CustomBlock settings
235- string blockDefPath = Path . Combine ( Paths . BlockDefsDirectory , world . Name + ".txt" ) ;
236- if ( File . Exists ( blockDefPath ) ) {
237- int count ;
238- BlockDefinition [ ] defs = BlockDefinition . Load ( blockDefPath , out count ) ;
239- for ( int i = 0 ; i < defs . Length ; i ++ ) {
240- if ( defs [ i ] == null ) defs [ i ] = BlockDefinition . GlobalDefs [ i ] ;
241- }
242- world . BlockDefs = defs ;
243- }
244233
245234 // load environment settings
246235 XElement envEl = el . Element ( EnvironmentXmlTagName ) ;
@@ -732,6 +721,7 @@ public static World AddWorld( [CanBeNull] Player player, [NotNull] string name,
732721 throw new WorldOpException ( name , WorldOpExceptionCode . InvalidWorldName ) ;
733722 }
734723
724+ World newWorld ;
735725 lock ( SyncRoot ) {
736726 if ( WorldIndex . ContainsKey ( name . ToLower ( ) ) ) {
737727 throw new WorldOpException ( name , WorldOpExceptionCode . DuplicateWorldName ) ;
@@ -741,25 +731,28 @@ public static World AddWorld( [CanBeNull] Player player, [NotNull] string name,
741731 throw new WorldOpException ( name , WorldOpExceptionCode . Cancelled ) ;
742732 }
743733
744- World newWorld = new World ( name ) {
745- Map = map
746- } ;
747-
748- if ( preload ) {
749- newWorld . Preload = true ;
750- }
751-
752- if ( map != null ) {
753- newWorld . SaveMap ( ) ;
754- }
734+ newWorld = new World ( name ) { Map = map } ;
735+ if ( preload ) newWorld . Preload = true ;
736+ if ( map != null ) newWorld . SaveMap ( ) ;
755737
756738 WorldIndex . Add ( name . ToLower ( ) , newWorld ) ;
757739 UpdateWorldList ( ) ;
758740
759741 RaiseWorldCreatedEvent ( player , newWorld ) ;
760-
761- return newWorld ;
762742 }
743+
744+ // Load CustomBlock settings
745+ string blockDefPath = Path . Combine ( Paths . BlockDefsDirectory , name + ".txt" ) ;
746+ if ( File . Exists ( blockDefPath ) ) {
747+ int count ;
748+ BlockDefinition [ ] defs = BlockDefinition . Load ( blockDefPath , out count ) ;
749+ for ( int i = 0 ; i < defs . Length ; i ++ ) {
750+ if ( defs [ i ] == null ) defs [ i ] = BlockDefinition . GlobalDefs [ i ] ;
751+ }
752+ newWorld . BlockDefs = defs ;
753+ }
754+
755+ return newWorld ;
763756 }
764757
765758
0 commit comments