From 1f51ee9699935c9eb8bb95e3dff8c162f8d998c0 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Tue, 8 May 2012 15:14:16 -0500 Subject: [PATCH] Improved explosion handling speed --- .../factions/listeners/FactionsEntityListener.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index 4ddb8156..2d81371e 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.listeners; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; @@ -106,12 +107,17 @@ public class FactionsEntityListener implements Listener { if (event.isCancelled()) return; + Set explosionLocs = new HashSet(); for (Block block : event.blockList()) { - Faction faction = Board.getFactionAt(new FLocation(block)); + explosionLocs.add(new FLocation(block)); + } + for (FLocation loc : explosionLocs) + { + Faction faction = Board.getFactionAt(loc); if (faction.getFlag(FFlag.EXPLOSIONS) == false) { - // faction is peaceful and has explosions set to disabled + // faction has explosions disabled event.setCancelled(true); return; }