# HG changeset patch # User jrvanwhy # Date 1317588524 25200 # Node ID 6e1b14cf27cca014168a402bb22492e2f0d832a2 # Parent 81acf2c701fe9b48f942ecc52f2db5b2a53c1279 Fixes a bug in which the monster can move out of water, destroying the surrounding blocks. diff -r 81acf2c701fe -r 6e1b14cf27cc src/net/jrvanwhy/watermonster/WaterEntity.java --- a/src/net/jrvanwhy/watermonster/WaterEntity.java Sat Sep 24 16:10:26 2011 -0700 +++ b/src/net/jrvanwhy/watermonster/WaterEntity.java Sun Oct 02 13:48:44 2011 -0700 @@ -28,8 +28,9 @@ double closestDist = -1.0; for (int i = 0; i < players.length; i++) { - if (closestDist < 0.0 || - players[i].getLocation().distance(location) < closestDist) { + if (players[i].getWorld().equals(location.getWorld()) && + (closestDist < 0.0 || + players[i].getLocation().distance(location) < closestDist)) { closestPlayer = players[i]; closestDist = closestPlayer.getLocation().distance(location); } @@ -157,6 +158,8 @@ } private void placeMonster(Location location) { + if (!location.getBlock().getType().equals(Material.STATIONARY_WATER)) + return; position = location; position.getBlock().setType(Material.AIR); }