Fixed MagicNumberCheck in MVWorld

This commit is contained in:
main() 2011-12-31 19:56:53 +01:00
parent 76629ebd25
commit d48927787b
2 changed files with 8 additions and 2 deletions

View File

@ -93,7 +93,9 @@
</module> </module>
<module name="IllegalInstantiation"/> <module name="IllegalInstantiation"/>
<module name="InnerAssignment"/> <module name="InnerAssignment"/>
<module name="MagicNumber"/> <module name="MagicNumber">
<property name="ignoreNumbers" value="-1, 0, 1, 2, 8"/>
</module>
<module name="MissingSwitchDefault"/> <module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/> <module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/> <module name="SimplifyBooleanExpression"/>

View File

@ -830,6 +830,9 @@ public class MVWorld implements MultiverseWorld {
this.saveConfig(); this.saveConfig();
} }
private static final int SPAWN_LOCATION_SEARCH_TOLERANCE = 16;
private static final int SPAWN_LOCATION_SEARCH_RADIUS = 16;
private Location readSpawnFromConfig(World w) { private Location readSpawnFromConfig(World w) {
Location spawnLocation = w.getSpawnLocation(); Location spawnLocation = w.getSpawnLocation();
Location configLocation = this.getSpawnLocation(); Location configLocation = this.getSpawnLocation();
@ -850,7 +853,8 @@ public class MVWorld implements MultiverseWorld {
// If it's not, find a better one. // If it's not, find a better one.
this.plugin.log(Level.WARNING, "Spawn location from world.dat file was unsafe. Adjusting..."); this.plugin.log(Level.WARNING, "Spawn location from world.dat file was unsafe. Adjusting...");
this.plugin.log(Level.WARNING, "Original Location: " + LocationManipulation.strCoordsRaw(spawnLocation)); this.plugin.log(Level.WARNING, "Original Location: " + LocationManipulation.strCoordsRaw(spawnLocation));
Location newSpawn = teleporter.getSafeLocation(spawnLocation, 16, 16); Location newSpawn = teleporter.getSafeLocation(spawnLocation,
SPAWN_LOCATION_SEARCH_TOLERANCE, SPAWN_LOCATION_SEARCH_RADIUS);
// I think we could also do this, as I think this is what Notch does. // I think we could also do this, as I think this is what Notch does.
// Not sure how it will work in the nether... // Not sure how it will work in the nether...
//Location newSpawn = this.spawnLocation.getWorld().getHighestBlockAt(this.spawnLocation).getLocation(); //Location newSpawn = this.spawnLocation.getWorld().getHighestBlockAt(this.spawnLocation).getLocation();