Removed onBlockSent, added onLeavesDecay
This commit is contained in:
parent
458c62757a
commit
a210fcc0ef
@ -217,9 +217,9 @@ public abstract class Event {
|
|||||||
BLOCK_PLACED (Category.BLOCK),
|
BLOCK_PLACED (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a specific block is being sent to a player
|
* Called when leaves are decaying naturally
|
||||||
*/
|
*/
|
||||||
BLOCK_SENT (Category.BLOCK),
|
LEAVES_DECAY (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a liquid attempts to flow into a block which already
|
* Called when a liquid attempts to flow into a block which already
|
||||||
|
@ -1,81 +1,89 @@
|
|||||||
package org.bukkit.event.block;
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all events thrown in relation to Blocks
|
* Handles all events thrown in relation to Blocks
|
||||||
*
|
*
|
||||||
* @author durron597
|
* @author durron597
|
||||||
*/
|
*/
|
||||||
public class BlockListener implements Listener {
|
public class BlockListener implements Listener {
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
*/
|
*/
|
||||||
public BlockListener() {
|
public BlockListener() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is broken (or destroyed)
|
* Called when a block is broken (or destroyed)
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onBlockBroken(BlockBrokenEvent event) {
|
public void onBlockBroken(BlockBrokenEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 onBlockCanBuild(BlockCanBuildEvent event) {
|
public void onBlockCanBuild(BlockCanBuildEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block flows (water/lava)
|
* Called when a block flows (water/lava)
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onBlockFlow(BlockFromToEvent event) {
|
public void onBlockFlow(BlockFromToEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block gets ignited
|
* Called when a block gets ignited
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when block physics occurs
|
* Called when block physics occurs
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player places a block
|
* Called when a player places a block
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onBlockPlaced(BlockPlacedEvent event) {
|
public void onBlockPlaced(BlockPlacedEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when redstone changes
|
* Called when redstone changes
|
||||||
* From: the source of the redstone change
|
* From: the source of the redstone change
|
||||||
* To: The redstone dust that changed
|
* To: The redstone dust that changed
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onBlockRedstoneChange(BlockFromToEvent event) {
|
public void onBlockRedstoneChange(BlockFromToEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player right clicks a block
|
* Called when a player right clicks a block
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onBlockRightClicked(BlockRightClickedEvent event) {
|
public void onBlockRightClicked(BlockRightClickedEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* Called when leaves are decaying naturally
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
36
src/main/java/org/bukkit/event/block/LeavesDecayEvent.java
Normal file
36
src/main/java/org/bukkit/event/block/LeavesDecayEvent.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called on leaves decaying
|
||||||
|
*/
|
||||||
|
public class LeavesDecayEvent extends BlockEvent implements Cancellable {
|
||||||
|
private boolean cancel = false;
|
||||||
|
|
||||||
|
public LeavesDecayEvent(final Type type, final Block block) {
|
||||||
|
super(type, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins
|
||||||
|
*
|
||||||
|
* @return true if this event is cancelled
|
||||||
|
*/
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins
|
||||||
|
*
|
||||||
|
* @param cancel true if you wish to cancel this event
|
||||||
|
*/
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
}
|
@ -127,6 +127,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||||||
case BLOCK_FLOW:
|
case BLOCK_FLOW:
|
||||||
trueListener.onBlockFlow((BlockFromToEvent)event);
|
trueListener.onBlockFlow((BlockFromToEvent)event);
|
||||||
break;
|
break;
|
||||||
|
case LEAVES_DECAY:
|
||||||
|
trueListener.onLeavesDecay((LeavesDecayEvent)event);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if(listener instanceof ServerListener) {
|
} else if(listener instanceof ServerListener) {
|
||||||
ServerListener trueListener = (ServerListener)listener;
|
ServerListener trueListener = (ServerListener)listener;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user