From 94921bc3e573b51497cf02dc58f9317fb0927502 Mon Sep 17 00:00:00 2001 From: durron597 Date: Fri, 31 Dec 2010 07:53:56 -0500 Subject: [PATCH] Implemented BLOCK_FLOW --- .../bukkit/event/block/BlockFlowEvent.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/org/bukkit/event/block/BlockFlowEvent.java b/src/org/bukkit/event/block/BlockFlowEvent.java index df126fcf..c2af4c4b 100644 --- a/src/org/bukkit/event/block/BlockFlowEvent.java +++ b/src/org/bukkit/event/block/BlockFlowEvent.java @@ -1,6 +1,8 @@ package org.bukkit.event.block; import java.util.HashSet; +import java.util.List; + import org.bukkit.Block; import org.bukkit.BlockFace; import org.bukkit.event.Event; @@ -9,7 +11,7 @@ import org.bukkit.event.Event; * Holds information for events with a source block and a destination block */ public class BlockFlowEvent extends BlockEvent { - protected HashSet faceList; + protected final HashSet faceList; public BlockFlowEvent(final Event.Type type, final Block block, BlockFace... faces) { super(type, block); @@ -20,14 +22,25 @@ public class BlockFlowEvent extends BlockEvent { } } } + + public BlockFlowEvent(final Event.Type type, final Block block, List faces) { + super(type, block); + this.faceList = new HashSet(); + if (faces != null && faces.size() > 0) { + for (BlockFace theFace : faces) { + faceList.add(new BlockFlow(theFace)); + } + } + } /** - * Gets the location this player moved to + * We don't want plugins changing the eligible flowing faces + * therefore give them a new HashSet instance * * @return Block the block is event originated from */ public HashSet getFaces() { - return faceList; + return new HashSet(faceList); } /**