mirror of
https://github.com/PaperMC/Paper.git
synced 2025-04-12 15:06:05 +02:00
Added the single most important event ever to be conceived
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
7e203ee761
commit
56bf34db1e
13
paper-api/src/org/bukkit/event/block/BlockEvent.java
Normal file
13
paper-api/src/org/bukkit/event/block/BlockEvent.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a block related event
|
||||||
|
*/
|
||||||
|
public class BlockEvent extends Event {
|
||||||
|
public BlockEvent(final Event.Type type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
}
|
15
paper-api/src/org/bukkit/event/block/BlockListener.java
Normal file
15
paper-api/src/org/bukkit/event/block/BlockListener.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles all events thrown in relation to Blocks
|
||||||
|
*/
|
||||||
|
public class BlockListener implements Listener {
|
||||||
|
public BlockListener() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPhysics(BlockPhysicsEvent event) {
|
||||||
|
}
|
||||||
|
}
|
47
paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java
Normal file
47
paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.ItemStack;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when a block physics check is called
|
||||||
|
*/
|
||||||
|
public class BlockPhysicsEvent extends BlockEvent {
|
||||||
|
private final Block block;
|
||||||
|
private final int changed;
|
||||||
|
|
||||||
|
public BlockPhysicsEvent(final Event.Type type, final Block block, final int changed) {
|
||||||
|
super(type);
|
||||||
|
this.block = block;
|
||||||
|
this.changed = changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the block currently undergoing a physics check
|
||||||
|
*
|
||||||
|
* @return Block to check physics on
|
||||||
|
*/
|
||||||
|
public Block getBlock() {
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type of block that changed, causing this event
|
||||||
|
*
|
||||||
|
* @return Changed block's type ID
|
||||||
|
*/
|
||||||
|
public int getChangedTypeID() {
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type of block that changed, causing this event
|
||||||
|
*
|
||||||
|
* @return Changed block's type
|
||||||
|
*/
|
||||||
|
public ItemStack.Type getChangedType() {
|
||||||
|
return ItemStack.Type.getType(changed); // TODO: Move type to its own file
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user