diff --git a/paper-api/src/org/bukkit/BlockFace.java b/paper-api/src/org/bukkit/BlockFace.java index eb7f29c6e4..aba16cbf6f 100644 --- a/paper-api/src/org/bukkit/BlockFace.java +++ b/paper-api/src/org/bukkit/BlockFace.java @@ -9,7 +9,8 @@ public enum BlockFace { South(1, 0, 0), West(0, 0, 1), Up(0, 1, 0), - Down(0, -1, 0); + Down(0, -1, 0), + Self(0, 0, 0); private final int modX; private final int modY; diff --git a/paper-api/src/org/bukkit/event/block/BlockFlowEvent.java b/paper-api/src/org/bukkit/event/block/BlockFlowEvent.java index df126fcf3c..a91cedfdcd 100644 --- a/paper-api/src/org/bukkit/event/block/BlockFlowEvent.java +++ b/paper-api/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); } /** @@ -61,7 +74,7 @@ public class BlockFlowEvent extends BlockEvent { } public boolean equals(BlockFlow flow) { - return flow.flowDirection.equals(flow); + return flowDirection.equals(flow.flowDirection); } @Override diff --git a/paper-api/src/org/bukkit/event/block/BlockFromToEvent.java b/paper-api/src/org/bukkit/event/block/BlockFromToEvent.java index fc029c369e..2fcbcf0c76 100644 --- a/paper-api/src/org/bukkit/event/block/BlockFromToEvent.java +++ b/paper-api/src/org/bukkit/event/block/BlockFromToEvent.java @@ -8,11 +8,13 @@ import org.bukkit.event.Event; * Holds information for events with a source block and a destination block */ public class BlockFromToEvent extends BlockEvent { - protected BlockFace face; + protected Block from; + protected BlockFace face; public BlockFromToEvent(final Event.Type type, final Block block, final BlockFace face) { super(type, block); this.face = face; + this.from = block.getRelative(face.getModX(), face.getModY(), face.getModZ()); } /** @@ -29,7 +31,7 @@ public class BlockFromToEvent extends BlockEvent { * * @return Block the faced block */ - public Block getFacedBlock() { - return block.getRelative(face.getModX(), face.getModY(), face.getModZ()); + public Block getFromBlock() { + return from; } } diff --git a/paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java b/paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java index 625a1e95c7..e8e15e21cd 100644 --- a/paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java +++ b/paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java @@ -1,13 +1,9 @@ -/** - * - */ package org.bukkit.event.block; import org.bukkit.Block; /** - * @author jmartin - * + * Not implemented yet */ public class BlockPlacedEvent extends BlockEvent { diff --git a/paper-api/src/org/bukkit/event/block/BlockRightClickedEvent.java b/paper-api/src/org/bukkit/event/block/BlockRightClickedEvent.java index 730d68794e..4f43492c7b 100644 --- a/paper-api/src/org/bukkit/event/block/BlockRightClickedEvent.java +++ b/paper-api/src/org/bukkit/event/block/BlockRightClickedEvent.java @@ -4,19 +4,50 @@ package org.bukkit.event.block; import org.bukkit.Block; +import org.bukkit.BlockFace; +import org.bukkit.ItemStack; +import org.bukkit.Player; /** - * Not implemented yet + * @author durron597 */ public class BlockRightClickedEvent extends BlockEvent { - + protected Player clicker; + protected BlockFace direction; + protected ItemStack clickedWith; + /** - * @param type - * @param theBlock + * @param type The type of event this is + * @param theBlock The clicked block + * @param direction The face we clicked from + * @param clicker The player who clicked a block + * @param clickedWith Item in player's hand */ - public BlockRightClickedEvent(Type type, Block theBlock) { + public BlockRightClickedEvent(Type type, Block theBlock, BlockFace direction, Player clicker, ItemStack clickedWith) { super(type, theBlock); - // TODO Auto-generated constructor stub + this.direction = direction; + this.clicker = clicker; + this.clickedWith = clickedWith; } + /** + * @return the clicker + */ + public Player getClicker() { + return clicker; + } + + /** + * @return the direction + */ + public BlockFace getDirection() { + return direction; + } + + /** + * @return the clickedWith + */ + public ItemStack getClickedWith() { + return clickedWith; + } }