Migrate old TNT height nerf settings to falling block height nerf

This commit is contained in:
Byteflux 2015-06-04 03:57:23 -07:00
parent 5866cac361
commit 7d15ab73ad
7 changed files with 65 additions and 9 deletions

View File

@ -77,4 +77,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false ); + boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
+ } + }
} }
-- --
1.9.5.msysgit.1

View File

@ -57,4 +57,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed ); + log( "Water over lava flow speed: " + waterOverLavaFlowSpeed );
+ } + }
} }
-- --
1.9.5.msysgit.1

View File

@ -46,4 +46,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false ); + netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false );
+ } + }
} }
-- --
1.9.5.msysgit.1

View File

@ -39,6 +39,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public int fallingBlockHeightNerf; + public int fallingBlockHeightNerf;
+ private void fallingBlockheightNerf() + private void fallingBlockheightNerf()
+ { + {
+ // TODO: Remove migrations after most users have upgraded.
+ if ( PaperSpigotConfig.version < 8 )
+ {
+ // Migrate default value
+
+ int heightNerf = config.getInt( "world-settings.default.falling-block-height-nerf", 0 );
+ if ( heightNerf == 0 ) heightNerf = config.getInt( "world-settings.default.tnt-entity-height-nerf", 0 );
+ if ( heightNerf == 0 ) heightNerf = config.getInt( "world-settings.default.tnt-gameplay.tnt-entity-height-limit", 0 );
+ if ( heightNerf != 0 ) config.set( "world-settings.default.falling-block-height-nerf", heightNerf );
+
+ if ( config.contains( "world-settings.default.tnt-entity-height-nerf" ) )
+ {
+ config.getDefaults().set( "world-settings.default.tnt-entity-height-nerf", null );
+ config.set( "world-settings.default.tnt-entity-height-nerf", null );
+ }
+
+ if ( config.contains( "world-settings.default.tnt-gameplay.tnt-entity-height-limit" ) )
+ {
+ config.getDefaults().set( "world-settings.default.tnt-gameplay.tnt-entity-height-limit", null );
+ config.set( "world-settings.default.tnt-gameplay.tnt-entity-height-limit", null );
+ }
+
+ // Migrate world setting
+
+ heightNerf = config.getInt( "world-settings." + worldName + ".falling-block-height-nerf" );
+ if ( heightNerf == 0 ) heightNerf = config.getInt( "world-settings." + worldName + ".tnt-entity-height-nerf", 0 );
+ if ( heightNerf == 0 ) heightNerf = config.getInt( "world-settings." + worldName + ".tnt-gameplay.tnt-entity-height-limit", 0 );
+ if ( heightNerf != 0 ) config.set( "world-settings." + worldName + ".falling-block-height-nerf", heightNerf );
+
+ if ( config.contains( "world-settings." + worldName + ".tnt-entity-height-nerf" ) )
+ {
+ config.getDefaults().set( "world-settings." + worldName + ".tnt-entity-height-nerf", null );
+ config.set( "world-settings." + worldName + ".tnt-entity-height-nerf", null);
+ }
+
+ if ( config.contains( "world-settings." + worldName + ".tnt-gameplay.tnt-entity-height-limit" ) )
+ {
+ config.getDefaults().set( "world-settings." + worldName + ".tnt-gameplay.tnt-entity-height-limit", null );
+ config.set( "world-settings." + worldName + ".tnt-gameplay.tnt-entity-height-limit", null );
+ }
+ }
+
+ fallingBlockHeightNerf = getInt( "falling-block-height-nerf", 0 ); + fallingBlockHeightNerf = getInt( "falling-block-height-nerf", 0 );
+ if ( fallingBlockHeightNerf != 0 ) + if ( fallingBlockHeightNerf != 0 )
+ { + {
@ -46,4 +88,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ } + }
} }
-- --
1.9.5.msysgit.1

View File

@ -147,8 +147,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ commands = new HashMap<String, Command>(); + commands = new HashMap<String, Command>();
+ +
+ version = getInt( "config-version", 7 ); + version = getInt( "config-version", 8 );
+ set( "config-version", 7 ); + set( "config-version", 8 );
+ readConfig( PaperSpigotConfig.class, null ); + readConfig( PaperSpigotConfig.class, null );
+ } + }
+ +
@ -316,4 +316,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) ); + return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
+ } + }
+} +}
-- --
1.9.5.msysgit.1

View File

@ -115,4 +115,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ removeUnloadedFallingBlocks = getBoolean( "remove-unloaded.falling-blocks", true ); + removeUnloadedFallingBlocks = getBoolean( "remove-unloaded.falling-blocks", true );
+ } + }
} }
-- --
1.9.5.msysgit.1

View File

@ -36,4 +36,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ log( "Remove invalid mob spawner tile entities: " + removeInvalidMobSpawnerTEs ); + log( "Remove invalid mob spawner tile entities: " + removeInvalidMobSpawnerTEs );
+ } + }
} }
-- --
1.9.5.msysgit.1