diff options
author | Taylor Kelly <tkelly910@gmail.com> | 2011-01-26 16:13:04 -0500 |
---|---|---|
committer | Taylor Kelly <tkelly910@gmail.com> | 2011-01-26 16:13:04 -0500 |
commit | b2efe281229378967d9c0633b82f0303b7b621f4 (patch) | |
tree | 8e0c0cd006763c1f692ff7845366efdc28ac6993 /src | |
parent | 8e927a84bb3af7931fc5a6d6f41260fc9aa1fe6e (diff) | |
download | bukkit-b2efe281229378967d9c0633b82f0303b7b621f4.tar bukkit-b2efe281229378967d9c0633b82f0303b7b621f4.tar.gz bukkit-b2efe281229378967d9c0633b82f0303b7b621f4.tar.lz bukkit-b2efe281229378967d9c0633b82f0303b7b621f4.tar.xz bukkit-b2efe281229378967d9c0633b82f0303b7b621f4.zip |
BlockBurnEvent
Diffstat (limited to 'src')
4 files changed, 49 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java index 1fb0966f..ac998d39 100644 --- a/src/main/java/org/bukkit/event/Event.java +++ b/src/main/java/org/bukkit/event/Event.java @@ -276,6 +276,13 @@ public abstract class Event { BLOCK_INTERACT (Category.BLOCK), /** + * Called when a block is destroyed from being burnt by fire + * + * @see org.bukkit.event.block.BlockBurnEvent + */ + BLOCK_BURN (Category.BLOCK), + + /** * Called when leaves are decaying naturally * * @see org.bukkit.event.block.LeavesDecayEvent diff --git a/src/main/java/org/bukkit/event/block/BlockBurnEvent.java b/src/main/java/org/bukkit/event/block/BlockBurnEvent.java new file mode 100644 index 00000000..ba8b64ff --- /dev/null +++ b/src/main/java/org/bukkit/event/block/BlockBurnEvent.java @@ -0,0 +1,31 @@ + + +package org.bukkit.event.block; + +import org.bukkit.block.Block; +import org.bukkit.event.Cancellable; + +/** + * Called when a block is destroyed because of being burnt by fire + * @author tkelly + */ +public class BlockBurnEvent extends BlockEvent implements Cancellable { + private boolean cancelled; + + public BlockBurnEvent(Block block) { + super(Type.BLOCK_BURN, block); + this.cancelled = false; + } + + public boolean isCancelled() { + return cancelled; + } + + /** + * Allow for the block to be stopped from being destroyed + * @param cancel + */ + public void setCancelled(boolean cancel) { + this.cancelled = cancel; + } +} diff --git a/src/main/java/org/bukkit/event/block/BlockListener.java b/src/main/java/org/bukkit/event/block/BlockListener.java index e2c44f8f..5d70acf4 100644 --- a/src/main/java/org/bukkit/event/block/BlockListener.java +++ b/src/main/java/org/bukkit/event/block/BlockListener.java @@ -94,4 +94,12 @@ public class BlockListener implements Listener { public void onLeavesDecay(LeavesDecayEvent event) {
}
+ /**
+ * Called when a block is destroyed from burning
+ *
+ * @param event Relevant event details
+ */
+ public void onBlockBurn(BlockBurnEvent event) {
+ }
+
}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 34e66cf7..f0844258 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -191,6 +191,9 @@ public final class JavaPluginLoader implements PluginLoader { case REDSTONE_CHANGE: trueListener.onBlockRedstoneChange((BlockFromToEvent)event); break; + case BLOCK_BURN: + trueListener.onBlockBurn((BlockBurnEvent)event); + break; } } else if(listener instanceof ServerListener) { ServerListener trueListener = (ServerListener)listener; |