Correctly count cannon explosion effect attempts

Previously, cannon explosions effects could lock up the main thread if:
- The effect location selection RNG was sufficiently unlucky
- The explosion occured sufficiently deep into a larger claimed
  territory
This commit is contained in:
cnr 2016-04-16 07:31:00 -05:00
parent 77b6515387
commit 9c6d23f11e
1 changed files with 6 additions and 6 deletions

View File

@ -437,19 +437,19 @@ public class Cannon extends SiegeWeapon
int attempts = 0; int attempts = 0;
while (blocks.size() < 10 && (attempts < 30)) while (blocks.size() < 10 && (attempts < 30))
{ {
attempts++;
Block block = UtilAlg.getRandomLocation(event.getProjectile().getLocation(), (4 * getPowerLevel())).getBlock(); Block block = UtilAlg.getRandomLocation(event.getProjectile().getLocation(), (4 * getPowerLevel())).getBlock();
if (_siegeManager.getClansManager().getClanUtility().getClaim(block.getLocation()) != null && !_siegeManager.getClansManager().getBlacklist().allowed(_siegeManager.getClansManager().getClanUtility().getClaim(block.getLocation()).Owner)) ClanTerritory claim = _siegeManager.getClansManager().getClanUtility().getClaim(block.getLocation());
if (claim != null && !_siegeManager.getClansManager().getBlacklist().allowed(claim.Owner))
{ {
continue; continue; // This block is in a claimed territory
} }
if ((block.getType() != Material.AIR) && (!blocks.contains(block))) if ((block.getType() != Material.AIR) && (!blocks.contains(block)))
{ {
blocks.add(block); blocks.add(block);
} }
attempts++;
} }
_clans.getExplosion().BlockExplosion( _clans.getExplosion().BlockExplosion(