From 9c6d23f11e5894d4c774a07ca43492f5de6c5e52 Mon Sep 17 00:00:00 2001 From: cnr Date: Sat, 16 Apr 2016 07:31:00 -0500 Subject: [PATCH] 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 --- .../game/clans/clans/siege/weapon/Cannon.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java index bb880fcf0..648e6baf8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java @@ -437,19 +437,19 @@ public class Cannon extends SiegeWeapon int attempts = 0; while (blocks.size() < 10 && (attempts < 30)) { + attempts++; 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))) { blocks.add(block); } - - attempts++; } _clans.getExplosion().BlockExplosion(