mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Implemented BLOCK_CANBUILD, had wrong Listener method name
By: durron597 <martin.jared@gmail.com>
This commit is contained in:
parent
be1ad0e040
commit
7aac860d94
2 changed files with 15 additions and 4 deletions
|
@ -12,15 +12,26 @@ import org.bukkit.event.Cancellable;
|
||||||
public class BlockCanBuildEvent extends BlockEvent implements Cancellable {
|
public class BlockCanBuildEvent extends BlockEvent implements Cancellable {
|
||||||
protected boolean cancel;
|
protected boolean cancel;
|
||||||
|
|
||||||
public BlockCanBuildEvent(Type type, Block block) {
|
public BlockCanBuildEvent(Type type, Block block, boolean canBuild) {
|
||||||
super(type, block);
|
super(type, block);
|
||||||
|
|
||||||
|
cancel = canBuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether or not the block can be built here. By default, returns
|
||||||
|
* Minecraft's answer on whether the block can be built
|
||||||
|
*
|
||||||
|
* @return boolean whether or not the block can be built
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancel;
|
return cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether the block can be built here.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setCancelled(boolean cancel) {
|
public void setCancelled(boolean cancel) {
|
||||||
this.cancel = cancel;
|
this.cancel = cancel;
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class BlockListener implements Listener {
|
||||||
/**
|
/**
|
||||||
* Called when we try to place a block, to see if we can build it
|
* Called when we try to place a block, to see if we can build it
|
||||||
*/
|
*/
|
||||||
public void canBuild(BlockCanBuildEvent event) {
|
public void onBlockCanBuild(BlockCanBuildEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue