Removed onBlockSent, added onLeavesDecay

This commit is contained in:
Dinnerbone 2011-01-04 22:03:15 +00:00
parent 458c62757a
commit a210fcc0ef
4 changed files with 130 additions and 83 deletions

View File

@ -217,9 +217,9 @@ public abstract class Event {
BLOCK_PLACED (Category.BLOCK), 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 * Called when a liquid attempts to flow into a block which already

View File

@ -78,4 +78,12 @@ public class BlockListener implements Listener {
public void onBlockRightClicked(BlockRightClickedEvent event) { public void onBlockRightClicked(BlockRightClickedEvent event) {
} }
/**
* Called when leaves are decaying naturally
*
* @param event Relevant event details
*/
public void onLeavesDecay(LeavesDecayEvent event) {
}
} }

View File

@ -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;
}
}

View File

@ -127,6 +127,9 @@ public final class JavaPluginLoader implements PluginLoader {
case BLOCK_FLOW: case BLOCK_FLOW:
trueListener.onBlockFlow((BlockFromToEvent)event); trueListener.onBlockFlow((BlockFromToEvent)event);
break; break;
case LEAVES_DECAY:
trueListener.onLeavesDecay((LeavesDecayEvent)event);
break;
} }
} else if(listener instanceof ServerListener) { } else if(listener instanceof ServerListener) {
ServerListener trueListener = (ServerListener)listener; ServerListener trueListener = (ServerListener)listener;