From a1d10a087c0d1079cf7e304fc290bc9d885cf194 Mon Sep 17 00:00:00 2001 From: durron597 Date: Thu, 30 Dec 2010 17:16:06 -0500 Subject: Added block events --- src/org/bukkit/event/block/BlockBrokenEvent.java | 12 ++++ src/org/bukkit/event/block/BlockEvent.java | 24 ++++++++ src/org/bukkit/event/block/BlockFromToEvent.java | 34 +++++++++++ src/org/bukkit/event/block/BlockIgniteEvent.java | 19 ++++++ src/org/bukkit/event/block/BlockListener.java | 71 ++++++++++++++++++++++ src/org/bukkit/event/block/BlockPhysicsEvent.java | 23 +++++++ src/org/bukkit/event/block/BlockPlacedEvent.java | 23 +++++++ .../bukkit/event/block/BlockRightClickedEvent.java | 23 +++++++ 8 files changed, 229 insertions(+) create mode 100644 src/org/bukkit/event/block/BlockBrokenEvent.java create mode 100644 src/org/bukkit/event/block/BlockEvent.java create mode 100644 src/org/bukkit/event/block/BlockFromToEvent.java create mode 100644 src/org/bukkit/event/block/BlockIgniteEvent.java create mode 100644 src/org/bukkit/event/block/BlockListener.java create mode 100644 src/org/bukkit/event/block/BlockPhysicsEvent.java create mode 100644 src/org/bukkit/event/block/BlockPlacedEvent.java create mode 100644 src/org/bukkit/event/block/BlockRightClickedEvent.java diff --git a/src/org/bukkit/event/block/BlockBrokenEvent.java b/src/org/bukkit/event/block/BlockBrokenEvent.java new file mode 100644 index 00000000..68756832 --- /dev/null +++ b/src/org/bukkit/event/block/BlockBrokenEvent.java @@ -0,0 +1,12 @@ +package org.bukkit.event.block; + +import org.bukkit.event.Event; + +public class BlockBrokenEvent extends Event { + + public BlockBrokenEvent(Type type) { + super(type); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/org/bukkit/event/block/BlockEvent.java b/src/org/bukkit/event/block/BlockEvent.java new file mode 100644 index 00000000..6e50caed --- /dev/null +++ b/src/org/bukkit/event/block/BlockEvent.java @@ -0,0 +1,24 @@ +package org.bukkit.event.block; + +import org.bukkit.Block; +import org.bukkit.event.Event; + +/** + * Represents a block related event + */ +public class BlockEvent extends Event { + protected Block block; + + public BlockEvent(final Event.Type type, final Block theBlock) { + super(type); + block = theBlock; + } + + /** + * Returns the block involved in this event + * @return Block which block is involved in this event + */ + public final Block getBlock() { + return block; + } +} diff --git a/src/org/bukkit/event/block/BlockFromToEvent.java b/src/org/bukkit/event/block/BlockFromToEvent.java new file mode 100644 index 00000000..2bf3f058 --- /dev/null +++ b/src/org/bukkit/event/block/BlockFromToEvent.java @@ -0,0 +1,34 @@ +package org.bukkit.event.block; + +import org.bukkit.Block; +import org.bukkit.event.Event; + +/** + * Holds information for events with a source block and a destination block + */ +public class BlockFromToEvent extends BlockEvent { + protected Block from; + + public BlockFromToEvent(final Event.Type type, final Block from, final Block to) { + super(type, to); + this.from = from; + } + + /** + * Gets the location this player moved to + * + * @return Block the block is event originated from + */ + public Block getFrom() { + return from; + } + + /** + * Gets the target block of this event + * + * @return Block the block containing this event + */ + public Block getTo() { + return getBlock(); + } +} diff --git a/src/org/bukkit/event/block/BlockIgniteEvent.java b/src/org/bukkit/event/block/BlockIgniteEvent.java new file mode 100644 index 00000000..90347096 --- /dev/null +++ b/src/org/bukkit/event/block/BlockIgniteEvent.java @@ -0,0 +1,19 @@ +package org.bukkit.event.block; + +import org.bukkit.event.Event; + +/** + * @author durron597 + * + */ +public class BlockIgniteEvent extends Event { + + /** + * @param type + */ + public BlockIgniteEvent(Type type) { + super(type); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/org/bukkit/event/block/BlockListener.java b/src/org/bukkit/event/block/BlockListener.java new file mode 100644 index 00000000..722edb60 --- /dev/null +++ b/src/org/bukkit/event/block/BlockListener.java @@ -0,0 +1,71 @@ +package org.bukkit.event.block; + +import org.bukkit.event.Listener; + +/** + * Handles all events thrown in relation to a Block + * + * @author durron597 + */ +public class BlockListener implements Listener { + public BlockListener() { + } + + /** + * Called when a block is broken (or destroyed) + * + * @param event Relevant event details + */ + public void onBlockBroken(BlockBrokenEvent event) { + } + + /** + * Called when a block flows (water/lava) + * + * @param event Relevant event details + */ + public void onBlockFlow(BlockFromToEvent event) { + } + + /** + * Called when a block gets ignited + * + * @param event Relevant event details + */ + public void onBlockIgnite(BlockIgniteEvent event) { + } + + /** + * Called when block physics occurs + * + * @param event Relevant event details + */ + public void onBlockPhysics(BlockPhysicsEvent event) { + } + + /** + * Called when a player places a block + * + * @param event Relevant event details + */ + public void onBlockPlaced(BlockPlacedEvent event) { + } + + /** + * Called when a player right clicks a block + * + * @param event Relevant event details + */ + public void onBlockRightClicked(BlockRightClickedEvent event) { + } + + /** + * Called when redstone changes + * From: the source of the redstone change + * To: The redstone dust that changed + * + * @param event Relevant event details + */ + public void onRedstoneChange(BlockFromToEvent event) { + } +} diff --git a/src/org/bukkit/event/block/BlockPhysicsEvent.java b/src/org/bukkit/event/block/BlockPhysicsEvent.java new file mode 100644 index 00000000..cb44ef31 --- /dev/null +++ b/src/org/bukkit/event/block/BlockPhysicsEvent.java @@ -0,0 +1,23 @@ +/** + * + */ +package org.bukkit.event.block; + +import org.bukkit.Block; + +/** + * @author jmartin + * + */ +public class BlockPhysicsEvent extends BlockEvent { + + /** + * @param type + * @param theBlock + */ + public BlockPhysicsEvent(Type type, Block theBlock) { + super(type, theBlock); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/org/bukkit/event/block/BlockPlacedEvent.java b/src/org/bukkit/event/block/BlockPlacedEvent.java new file mode 100644 index 00000000..625a1e95 --- /dev/null +++ b/src/org/bukkit/event/block/BlockPlacedEvent.java @@ -0,0 +1,23 @@ +/** + * + */ +package org.bukkit.event.block; + +import org.bukkit.Block; + +/** + * @author jmartin + * + */ +public class BlockPlacedEvent extends BlockEvent { + + /** + * @param type + * @param theBlock + */ + public BlockPlacedEvent(Type type, Block theBlock) { + super(type, theBlock); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/org/bukkit/event/block/BlockRightClickedEvent.java b/src/org/bukkit/event/block/BlockRightClickedEvent.java new file mode 100644 index 00000000..3f8c8397 --- /dev/null +++ b/src/org/bukkit/event/block/BlockRightClickedEvent.java @@ -0,0 +1,23 @@ +/** + * + */ +package org.bukkit.event.block; + +import org.bukkit.Block; + +/** + * @author jmartin + * + */ +public class BlockRightClickedEvent extends BlockEvent { + + /** + * @param type + * @param theBlock + */ + public BlockRightClickedEvent(Type type, Block theBlock) { + super(type, theBlock); + // TODO Auto-generated constructor stub + } + +} -- cgit v1.2.3