mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Added block events
By: durron597 <martin.jared@gmail.com>
This commit is contained in:
parent
7e203ee761
commit
4e456dc092
8 changed files with 229 additions and 0 deletions
12
paper-api/src/org/bukkit/event/block/BlockBrokenEvent.java
Normal file
12
paper-api/src/org/bukkit/event/block/BlockBrokenEvent.java
Normal 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
|
||||
}
|
||||
|
||||
}
|
24
paper-api/src/org/bukkit/event/block/BlockEvent.java
Normal file
24
paper-api/src/org/bukkit/event/block/BlockEvent.java
Normal 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;
|
||||
}
|
||||
}
|
34
paper-api/src/org/bukkit/event/block/BlockFromToEvent.java
Normal file
34
paper-api/src/org/bukkit/event/block/BlockFromToEvent.java
Normal 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();
|
||||
}
|
||||
}
|
19
paper-api/src/org/bukkit/event/block/BlockIgniteEvent.java
Normal file
19
paper-api/src/org/bukkit/event/block/BlockIgniteEvent.java
Normal 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
|
||||
}
|
||||
|
||||
}
|
71
paper-api/src/org/bukkit/event/block/BlockListener.java
Normal file
71
paper-api/src/org/bukkit/event/block/BlockListener.java
Normal 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) {
|
||||
}
|
||||
}
|
23
paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java
Normal file
23
paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java
Normal 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
|
||||
}
|
||||
|
||||
}
|
23
paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java
Normal file
23
paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java
Normal 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
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue