Added block events

By: durron597 <martin.jared@gmail.com>
This commit is contained in:
Bukkit/Spigot 2010-12-30 17:16:06 -05:00
parent 7e203ee761
commit 4e456dc092
8 changed files with 229 additions and 0 deletions

View file

@ -0,0 +1,12 @@
package org.bukkit.event.block;
import org.bukkit.event.Event;
public class BlockBrokenEvent extends Event {
public BlockBrokenEvent(Type type) {
super(type);
// TODO Auto-generated constructor stub
}
}

View file

@ -0,0 +1,24 @@
package org.bukkit.event.block;
import org.bukkit.Block;
import org.bukkit.event.Event;
/**
* Represents a block related event
*/
public class BlockEvent extends Event {
protected Block block;
public BlockEvent(final Event.Type type, final Block theBlock) {
super(type);
block = theBlock;
}
/**
* Returns the block involved in this event
* @return Block which block is involved in this event
*/
public final Block getBlock() {
return block;
}
}

View file

@ -0,0 +1,34 @@
package org.bukkit.event.block;
import org.bukkit.Block;
import org.bukkit.event.Event;
/**
* Holds information for events with a source block and a destination block
*/
public class BlockFromToEvent extends BlockEvent {
protected Block from;
public BlockFromToEvent(final Event.Type type, final Block from, final Block to) {
super(type, to);
this.from = from;
}
/**
* Gets the location this player moved to
*
* @return Block the block is event originated from
*/
public Block getFrom() {
return from;
}
/**
* Gets the target block of this event
*
* @return Block the block containing this event
*/
public Block getTo() {
return getBlock();
}
}

View file

@ -0,0 +1,19 @@
package org.bukkit.event.block;
import org.bukkit.event.Event;
/**
* @author durron597
*
*/
public class BlockIgniteEvent extends Event {
/**
* @param type
*/
public BlockIgniteEvent(Type type) {
super(type);
// TODO Auto-generated constructor stub
}
}

View file

@ -0,0 +1,71 @@
package org.bukkit.event.block;
import org.bukkit.event.Listener;
/**
* Handles all events thrown in relation to a Block
*
* @author durron597
*/
public class BlockListener implements Listener {
public BlockListener() {
}
/**
* Called when a block is broken (or destroyed)
*
* @param event Relevant event details
*/
public void onBlockBroken(BlockBrokenEvent event) {
}
/**
* Called when a block flows (water/lava)
*
* @param event Relevant event details
*/
public void onBlockFlow(BlockFromToEvent event) {
}
/**
* Called when a block gets ignited
*
* @param event Relevant event details
*/
public void onBlockIgnite(BlockIgniteEvent event) {
}
/**
* Called when block physics occurs
*
* @param event Relevant event details
*/
public void onBlockPhysics(BlockPhysicsEvent event) {
}
/**
* Called when a player places a block
*
* @param event Relevant event details
*/
public void onBlockPlaced(BlockPlacedEvent event) {
}
/**
* Called when a player right clicks a block
*
* @param event Relevant event details
*/
public void onBlockRightClicked(BlockRightClickedEvent event) {
}
/**
* Called when redstone changes
* From: the source of the redstone change
* To: The redstone dust that changed
*
* @param event Relevant event details
*/
public void onRedstoneChange(BlockFromToEvent event) {
}
}

View file

@ -0,0 +1,23 @@
/**
*
*/
package org.bukkit.event.block;
import org.bukkit.Block;
/**
* @author jmartin
*
*/
public class BlockPhysicsEvent extends BlockEvent {
/**
* @param type
* @param theBlock
*/
public BlockPhysicsEvent(Type type, Block theBlock) {
super(type, theBlock);
// TODO Auto-generated constructor stub
}
}

View file

@ -0,0 +1,23 @@
/**
*
*/
package org.bukkit.event.block;
import org.bukkit.Block;
/**
* @author jmartin
*
*/
public class BlockPlacedEvent extends BlockEvent {
/**
* @param type
* @param theBlock
*/
public BlockPlacedEvent(Type type, Block theBlock) {
super(type, theBlock);
// TODO Auto-generated constructor stub
}
}

View file

@ -0,0 +1,23 @@
/**
*
*/
package org.bukkit.event.block;
import org.bukkit.Block;
/**
* @author jmartin
*
*/
public class BlockRightClickedEvent extends BlockEvent {
/**
* @param type
* @param theBlock
*/
public BlockRightClickedEvent(Type type, Block theBlock) {
super(type, theBlock);
// TODO Auto-generated constructor stub
}
}