summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordurron597 <martin.jared@gmail.com>2010-12-30 17:16:06 -0500
committerdurron597 <martin.jared@gmail.com>2010-12-30 17:16:06 -0500
commita1d10a087c0d1079cf7e304fc290bc9d885cf194 (patch)
treebb883b48e686bb852dddf44f346f8155c77d1ac7
parent0b29a78cc3e17c509c033f583caea2db7378e8ac (diff)
downloadbukkit-a1d10a087c0d1079cf7e304fc290bc9d885cf194.tar
bukkit-a1d10a087c0d1079cf7e304fc290bc9d885cf194.tar.gz
bukkit-a1d10a087c0d1079cf7e304fc290bc9d885cf194.tar.lz
bukkit-a1d10a087c0d1079cf7e304fc290bc9d885cf194.tar.xz
bukkit-a1d10a087c0d1079cf7e304fc290bc9d885cf194.zip
Added block events
-rw-r--r--src/org/bukkit/event/block/BlockBrokenEvent.java12
-rw-r--r--src/org/bukkit/event/block/BlockEvent.java24
-rw-r--r--src/org/bukkit/event/block/BlockFromToEvent.java34
-rw-r--r--src/org/bukkit/event/block/BlockIgniteEvent.java19
-rw-r--r--src/org/bukkit/event/block/BlockListener.java71
-rw-r--r--src/org/bukkit/event/block/BlockPhysicsEvent.java23
-rw-r--r--src/org/bukkit/event/block/BlockPlacedEvent.java23
-rw-r--r--src/org/bukkit/event/block/BlockRightClickedEvent.java23
8 files changed, 229 insertions, 0 deletions
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
+ }
+
+}