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:
parent
01bc9e9e6b
commit
f2f627116a
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user