@@ -7,7 +7,7 @@ import org.bukkit.Block;
|
||||
*/
|
||||
public class BlockBrokenEvent extends BlockEvent {
|
||||
|
||||
public BlockBrokenEvent(Type type, Block block ) {
|
||||
super(type, block);
|
||||
}
|
||||
public BlockBrokenEvent(Type type, Block block ) {
|
||||
super(type, block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,37 +10,37 @@ import org.bukkit.Material;
|
||||
* @author durron597
|
||||
*/
|
||||
public class BlockCanBuildEvent extends BlockEvent {
|
||||
protected boolean buildable;
|
||||
protected int material;
|
||||
|
||||
public BlockCanBuildEvent(Type type, Block block, int id, boolean canBuild) {
|
||||
super(type, block);
|
||||
buildable = canBuild;
|
||||
material = id;
|
||||
}
|
||||
protected boolean buildable;
|
||||
protected int material;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public boolean isBuildable() {
|
||||
return buildable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the block can be built here.
|
||||
*/
|
||||
public void setBuildable(boolean cancel) {
|
||||
this.buildable = cancel;
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
return Material.getMaterial(material);
|
||||
}
|
||||
|
||||
public int getMaterialID() {
|
||||
return material;
|
||||
}
|
||||
public BlockCanBuildEvent(Type type, Block block, int id, boolean canBuild) {
|
||||
super(type, block);
|
||||
buildable = canBuild;
|
||||
material = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public boolean isBuildable() {
|
||||
return buildable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the block can be built here.
|
||||
*/
|
||||
public void setBuildable(boolean cancel) {
|
||||
this.buildable = cancel;
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
return Material.getMaterial(material);
|
||||
}
|
||||
|
||||
public int getMaterialID() {
|
||||
return material;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ import org.bukkit.event.Event;
|
||||
*/
|
||||
public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
protected Block from;
|
||||
protected BlockFace face;
|
||||
protected boolean cancel;
|
||||
|
||||
protected BlockFace face;
|
||||
protected boolean cancel;
|
||||
|
||||
public BlockFromToEvent(final Event.Type type, final Block block, final BlockFace face) {
|
||||
super(type, block);
|
||||
this.face = face;
|
||||
@@ -28,21 +28,21 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
public BlockFace getFace() {
|
||||
return face;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for getting the faced block
|
||||
*
|
||||
* @return Block the faced block
|
||||
*/
|
||||
public Block getFromBlock() {
|
||||
return from;
|
||||
return from;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import org.bukkit.event.Event;
|
||||
*/
|
||||
public class BlockIgniteEvent extends Event {
|
||||
|
||||
/**
|
||||
* @param type
|
||||
*/
|
||||
public BlockIgniteEvent(Type type) {
|
||||
super(type);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
/**
|
||||
* @param type
|
||||
*/
|
||||
public BlockIgniteEvent(Type type) {
|
||||
super(type);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import org.bukkit.event.Listener;
|
||||
* @author durron597
|
||||
*/
|
||||
public class BlockListener implements Listener {
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
public BlockListener() {
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
public BlockListener() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a block is broken (or destroyed)
|
||||
*
|
||||
@@ -27,7 +27,7 @@ public class BlockListener implements Listener {
|
||||
*/
|
||||
public void onBlockCanBuild(BlockCanBuildEvent event) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a block flows (water/lava)
|
||||
*
|
||||
@@ -43,7 +43,7 @@ public class BlockListener implements Listener {
|
||||
*/
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when block physics occurs
|
||||
*
|
||||
@@ -51,7 +51,7 @@ public class BlockListener implements Listener {
|
||||
*/
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a player places a block
|
||||
*
|
||||
@@ -69,7 +69,7 @@ public class BlockListener implements Listener {
|
||||
*/
|
||||
public void onBlockRedstoneChange(BlockFromToEvent event) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a player right clicks a block
|
||||
*
|
||||
|
||||
@@ -7,24 +7,24 @@ import org.bukkit.event.Cancellable;
|
||||
* Not implemented yet
|
||||
*/
|
||||
public class BlockPlacedEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancel;
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* @param theBlock
|
||||
*/
|
||||
public BlockPlacedEvent(Type type, Block theBlock) {
|
||||
super(type, theBlock);
|
||||
cancel = false;
|
||||
}
|
||||
private boolean cancel;
|
||||
|
||||
public boolean isCancelled() {
|
||||
// TODO Auto-generated method stub
|
||||
return cancel;
|
||||
}
|
||||
/**
|
||||
* @param type
|
||||
* @param theBlock
|
||||
*/
|
||||
public BlockPlacedEvent(Type type, Block theBlock) {
|
||||
super(type, theBlock);
|
||||
cancel = false;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
public boolean isCancelled() {
|
||||
// TODO Auto-generated method stub
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,42 +12,42 @@ import org.bukkit.Player;
|
||||
* @author durron597
|
||||
*/
|
||||
public class BlockRightClickedEvent extends BlockEvent {
|
||||
protected Player clicker;
|
||||
protected BlockFace direction;
|
||||
protected ItemStack clickedWith;
|
||||
|
||||
/**
|
||||
* @param type The type of event this is
|
||||
* @param theBlock The clicked block
|
||||
* @param direction The face we clicked from
|
||||
* @param clicker The player who clicked a block
|
||||
* @param clickedWith Item in player's hand
|
||||
*/
|
||||
public BlockRightClickedEvent(Type type, Block theBlock, BlockFace direction, Player clicker, ItemStack clickedWith) {
|
||||
super(type, theBlock);
|
||||
this.direction = direction;
|
||||
this.clicker = clicker;
|
||||
this.clickedWith = clickedWith;
|
||||
}
|
||||
protected Player clicker;
|
||||
protected BlockFace direction;
|
||||
protected ItemStack clickedWith;
|
||||
|
||||
/**
|
||||
* @return the clicker
|
||||
*/
|
||||
public Player getClicker() {
|
||||
return clicker;
|
||||
}
|
||||
/**
|
||||
* @param type The type of event this is
|
||||
* @param theBlock The clicked block
|
||||
* @param direction The face we clicked from
|
||||
* @param clicker The player who clicked a block
|
||||
* @param clickedWith Item in player's hand
|
||||
*/
|
||||
public BlockRightClickedEvent(Type type, Block theBlock, BlockFace direction, Player clicker, ItemStack clickedWith) {
|
||||
super(type, theBlock);
|
||||
this.direction = direction;
|
||||
this.clicker = clicker;
|
||||
this.clickedWith = clickedWith;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the direction
|
||||
*/
|
||||
public BlockFace getDirection() {
|
||||
return direction;
|
||||
}
|
||||
/**
|
||||
* @return the clicker
|
||||
*/
|
||||
public Player getClicker() {
|
||||
return clicker;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clickedWith
|
||||
*/
|
||||
public ItemStack getClickedWith() {
|
||||
return clickedWith;
|
||||
}
|
||||
/**
|
||||
* @return the direction
|
||||
*/
|
||||
public BlockFace getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clickedWith
|
||||
*/
|
||||
public ItemStack getClickedWith() {
|
||||
return clickedWith;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user