mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Added BlockCanBuild Event. Fixed Event enumeration
By: durron597 <martin.jared@gmail.com>
This commit is contained in:
parent
1c88da4e93
commit
be1ad0e040
3 changed files with 36 additions and 1 deletions
|
@ -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),
|
||||
|
|
28
paper-api/src/org/bukkit/event/block/BlockCanBuildEvent.java
Normal file
28
paper-api/src/org/bukkit/event/block/BlockCanBuildEvent.java
Normal 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;
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue