9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 23:19:18 +00:00

Update changes from ver/1.21.4 branch

This commit is contained in:
Dreeam
2025-06-10 12:34:55 +08:00
155 changed files with 2833 additions and 1026 deletions

View File

@@ -0,0 +1,63 @@
package org.dreeam.leaf.event;
import org.bukkit.ExplosionResult;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockEvent;
import org.jetbrains.annotations.NotNull;
/**
* Called when a block executes its explosion hit actions.
* If the event is cancelled, the block will not execute the explosion hit actions.
*/
public class BlockExplosionHitEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private final Entity source;
private final ExplosionResult result;
public BlockExplosionHitEvent(@NotNull Block block, Entity source, ExplosionResult result) {
super(block);
this.source = source;
this.result = result;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
/**
* Returns the entity responsible for the explosion.
*
* @return Entity responsible for the explosion
*/
public Entity getSource() {
return source;
}
/**
* Returns the result of the explosion.
*
* @return the result of the explosion
*/
public ExplosionResult getResult() {
return result;
}
}