diff options
Diffstat (limited to 'src')
4 files changed, 130 insertions, 83 deletions
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java index fe1d6920..045da30e 100644 --- a/src/main/java/org/bukkit/event/Event.java +++ b/src/main/java/org/bukkit/event/Event.java @@ -217,9 +217,9 @@ public abstract class Event { BLOCK_PLACED (Category.BLOCK), /** - * Called when a specific block is being sent to a player + * Called when leaves are decaying naturally */ - BLOCK_SENT (Category.BLOCK), + LEAVES_DECAY (Category.BLOCK), /** * Called when a liquid attempts to flow into a block which already diff --git a/src/main/java/org/bukkit/event/block/BlockListener.java b/src/main/java/org/bukkit/event/block/BlockListener.java index c7607588..723572f9 100644 --- a/src/main/java/org/bukkit/event/block/BlockListener.java +++ b/src/main/java/org/bukkit/event/block/BlockListener.java @@ -1,81 +1,89 @@ -package org.bukkit.event.block; - -import org.bukkit.event.Listener; - -/** - * Handles all events thrown in relation to Blocks - * - * @author durron597 - */ -public class BlockListener implements Listener { - /** - * Default Constructor - */ - public BlockListener() { - } - - /** - * Called when a block is broken (or destroyed) - * - * @param event Relevant event details - */ - public void onBlockBroken(BlockBrokenEvent event) { - } - - /** - * Called when we try to place a block, to see if we can build it - */ - public void onBlockCanBuild(BlockCanBuildEvent 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 redstone changes - * From: the source of the redstone change - * To: The redstone dust that changed - * - * @param event Relevant event details - */ - public void onBlockRedstoneChange(BlockFromToEvent event) { - } - - /** - * Called when a player right clicks a block - * - * @param event Relevant event details - */ - public void onBlockRightClicked(BlockRightClickedEvent event) { - } - -} +package org.bukkit.event.block;
+
+import org.bukkit.event.Listener;
+
+/**
+ * Handles all events thrown in relation to Blocks
+ *
+ * @author durron597
+ */
+public class BlockListener implements Listener {
+ /**
+ * Default Constructor
+ */
+ public BlockListener() {
+ }
+
+ /**
+ * Called when a block is broken (or destroyed)
+ *
+ * @param event Relevant event details
+ */
+ public void onBlockBroken(BlockBrokenEvent event) {
+ }
+
+ /**
+ * Called when we try to place a block, to see if we can build it
+ */
+ public void onBlockCanBuild(BlockCanBuildEvent 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 redstone changes
+ * From: the source of the redstone change
+ * To: The redstone dust that changed
+ *
+ * @param event Relevant event details
+ */
+ public void onBlockRedstoneChange(BlockFromToEvent event) {
+ }
+
+ /**
+ * Called when a player right clicks a block
+ *
+ * @param event Relevant event details
+ */
+ public void onBlockRightClicked(BlockRightClickedEvent event) {
+ }
+
+ /**
+ * Called when leaves are decaying naturally
+ *
+ * @param event Relevant event details
+ */
+ public void onLeavesDecay(LeavesDecayEvent event) {
+ }
+
+}
diff --git a/src/main/java/org/bukkit/event/block/LeavesDecayEvent.java b/src/main/java/org/bukkit/event/block/LeavesDecayEvent.java new file mode 100644 index 00000000..1ee2f403 --- /dev/null +++ b/src/main/java/org/bukkit/event/block/LeavesDecayEvent.java @@ -0,0 +1,36 @@ + +package org.bukkit.event.block; + +import org.bukkit.Block; +import org.bukkit.event.Cancellable; + +/** + * Called on leaves decaying + */ +public class LeavesDecayEvent extends BlockEvent implements Cancellable { + private boolean cancel = false; + + public LeavesDecayEvent(final Type type, final Block block) { + super(type, block); + } + + /** + * Gets the cancellation state of this event. A cancelled event will not + * be executed in the server, but will still pass to other plugins + * + * @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 + * + * @param cancel true if you wish to cancel this event + */ + public void setCancelled(boolean cancel) { + this.cancel = cancel; + } +} diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 7cbccbe8..2c9b5078 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -127,6 +127,9 @@ public final class JavaPluginLoader implements PluginLoader { case BLOCK_FLOW: trueListener.onBlockFlow((BlockFromToEvent)event); break; + case LEAVES_DECAY: + trueListener.onLeavesDecay((LeavesDecayEvent)event); + break; } } else if(listener instanceof ServerListener) { ServerListener trueListener = (ServerListener)listener; |