summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorspeakeasy <mekevin1917@gmail.com>2011-01-09 18:10:44 +0800
committerDinner Bone <dinnerbone@dinnerbone.com>2011-01-10 09:09:43 +0800
commit7d6400eb1df06de2f8e341d3b45d1312908f7b15 (patch)
treedfdbe3ad326ddaad1b6c3868003fcc7d195dd6b8 /src/main
parent9967ab16f61b2c3d5d495550d3da9f204989e216 (diff)
downloadbukkit-7d6400eb1df06de2f8e341d3b45d1312908f7b15.tar
bukkit-7d6400eb1df06de2f8e341d3b45d1312908f7b15.tar.gz
bukkit-7d6400eb1df06de2f8e341d3b45d1312908f7b15.tar.lz
bukkit-7d6400eb1df06de2f8e341d3b45d1312908f7b15.tar.xz
bukkit-7d6400eb1df06de2f8e341d3b45d1312908f7b15.zip
Added BlockIgniteEvent.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/event/block/BlockIgniteEvent.java91
-rw-r--r--src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java3
2 files changed, 88 insertions, 6 deletions
diff --git a/src/main/java/org/bukkit/event/block/BlockIgniteEvent.java b/src/main/java/org/bukkit/event/block/BlockIgniteEvent.java
index 62745b34..c43a6a2b 100644
--- a/src/main/java/org/bukkit/event/block/BlockIgniteEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockIgniteEvent.java
@@ -1,19 +1,98 @@
package org.bukkit.event.block;
+import org.bukkit.Block;
+import org.bukkit.Player;
+import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
/**
- * @author durron597
+ * @author SpeaKeasY
*
+ * Represents a block ignite event.
*/
-public class BlockIgniteEvent extends Event {
+public class BlockIgniteEvent extends BlockEvent implements Cancellable {
+
+ private IgniteCause cause;
+ private boolean cancel;
+ private Player thePlayer;
+ private Block theBlock;
+
+ /**
+ * @param Block, IgniteCause, Player or null.
+ */
+ public BlockIgniteEvent(Block theBlock, IgniteCause cause, Player thePlayer) {
+ super(Event.Type.BLOCK_IGNITE, theBlock);
+ this.cause = cause;
+ this.theBlock = theBlock;
+ this.thePlayer = thePlayer;
+ this.cancel = false;
+ }
+
+ /**
+ * Gets the cancellation state of this event. A cancelled event will not
+ * be executed in the server, but will still pass to other plugins.
+ *
+ * If an ignite event is cancelled, the block will not be ignited.
+ * This will not fire an event.
+ *
+ * @return true if this event is cancelled
+ */
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ /**
+ * Sets the cancellation state of this event. A cancelled event will not
+ * be executed in the server, but will still pass to other plugins.
+ *
+ * If an ignite event is cancelled, the block will not be ignited.
+ * This will not fire an event.
+ *
+ * @param cancel true if you wish to cancel this event
+ */
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ /**
+ * Gets the cause of block ignite.
+ * @return An IgniteCause value detailing the cause of block ignition.
+ */
+ public IgniteCause getCause()
+ {
+ return cause;
+ }
/**
- * @param type
+ * Gets the player who ignited this block
+ *
+ * @return Player who placed the block, if not ignited by player returns null.
*/
- public BlockIgniteEvent(Type type) {
- super(type);
- // TODO Auto-generated constructor stub
+ public Player getPlayer() {
+ return thePlayer;
+ }
+
+ /**
+ * An enum to specify the cause of the ignite
+ */
+ public enum IgniteCause {
+ /**
+ * Block ignition caused by lava.
+ */
+ LAVA,
+ /**
+ * Block ignition caused by player using flint-and-steel.
+ */
+ FLINT_AND_STEEL,
+ /**
+ * Block ignition caused by dynamic spreading of fire.
+ */
+ SPREAD,
+ /**
+ * Block ignition caused by VERY SLOW dynamic spreading of fire.
+ */
+ SLOW_SPREAD
+
}
}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index fd68f0c4..346429d5 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -140,6 +140,9 @@ public final class JavaPluginLoader implements PluginLoader {
case LEAVES_DECAY:
trueListener.onLeavesDecay((LeavesDecayEvent)event);
break;
+ case BLOCK_IGNITE:
+ trueListener.onBlockIgnite((BlockIgniteEvent)event);
+ break;
}
} else if(listener instanceof ServerListener) {
ServerListener trueListener = (ServerListener)listener;