mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-03 23:07:40 +01:00
Merge branch 'master' of https://github.com/Meaglin/Bukkit
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
commit
89ca5a877c
@ -319,6 +319,13 @@ public abstract class Event {
|
|||||||
*/
|
*/
|
||||||
REDSTONE_CHANGE (Category.BLOCK),
|
REDSTONE_CHANGE (Category.BLOCK),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a block is destroyed by a player.
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.BlockBreakEvent
|
||||||
|
*/
|
||||||
|
BLOCK_BREAK (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INVENTORY EVENTS
|
* INVENTORY EVENTS
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Meaglin
|
||||||
|
*/
|
||||||
|
public class BlockBreakEvent extends BlockEvent implements Cancellable {
|
||||||
|
|
||||||
|
private Player player;
|
||||||
|
private boolean cancel;
|
||||||
|
|
||||||
|
public BlockBreakEvent(final Block theBlock, Player player) {
|
||||||
|
super(Event.Type.BLOCK_BREAK, theBlock);
|
||||||
|
this.player = player;
|
||||||
|
this.cancel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player doing the damage
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
}
|
@ -101,4 +101,12 @@ public class BlockListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
public void onBlockBurn(BlockBurnEvent event) {
|
public void onBlockBurn(BlockBurnEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a block is destroyed by a player.
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,12 +235,16 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||||||
((BlockListener)listener).onBlockRedstoneChange( (BlockFromToEvent)event );
|
((BlockListener)listener).onBlockRedstoneChange( (BlockFromToEvent)event );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
case BLOCK_BURN:
|
case BLOCK_BURN:
|
||||||
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||||
((BlockListener)listener).onBlockBurn( (BlockBurnEvent)event );
|
((BlockListener)listener).onBlockBurn( (BlockBurnEvent)event );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
case BLOCK_BREAK:
|
||||||
|
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||||
|
((BlockListener)listener).onBlockBreak( (BlockBreakEvent)event );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Server Events
|
// Server Events
|
||||||
case PLUGIN_ENABLE:
|
case PLUGIN_ENABLE:
|
||||||
|
Loading…
Reference in New Issue
Block a user