Added BlockCanBuild Event. Fixed Event enumeration

By: durron597 <martin.jared@gmail.com>
This commit is contained in:
Bukkit/Spigot 2010-12-31 22:44:11 -05:00
parent 1c88da4e93
commit be1ad0e040
3 changed files with 36 additions and 1 deletions

View file

@ -76,7 +76,8 @@ public abstract class Event {
/**
* Block Events
*/
BLOCK_DAMAGED (Category.BLOCK),
BLOCK_BROKEN (Category.BLOCK),
BLOCK_CANBUILD (Category.BLOCK),
BLOCK_FLOW (Category.BLOCK),
BLOCK_IGNITE (Category.BLOCK),
BLOCK_PHYSICS (Category.BLOCK),

View file

@ -0,0 +1,28 @@
/**
*
*/
package org.bukkit.event.block;
import org.bukkit.Block;
import org.bukkit.event.Cancellable;
/**
* @author durron597
*/
public class BlockCanBuildEvent extends BlockEvent implements Cancellable {
protected boolean cancel;
public BlockCanBuildEvent(Type type, Block block) {
super(type, block);
}
@Override
public boolean isCancelled() {
return cancel;
}
@Override
public void setCancelled(boolean cancel) {
this.cancel = cancel;
}
}

View file

@ -22,6 +22,12 @@ public class BlockListener implements Listener {
public void onBlockBroken(BlockBrokenEvent event) {
}
/**
* Called when we try to place a block, to see if we can build it
*/
public void canBuild(BlockCanBuildEvent event) {
}
/**
* Called when a block flows (water/lava)
*