mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Add BellRingEvent
Add a new event, BellRingEvent, to trigger whenever a player rings a village bell. Passes along the bell block and the player who rang it.
This commit is contained in:
parent
54ce8682aa
commit
2e8691de65
1 changed files with 2 additions and 1 deletions
|
@ -377,10 +377,11 @@ public class CraftEventFactory {
|
|||
return tradeSelectEvent;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Paper use deprecated event to maintain compat (it extends modern event)
|
||||
public static boolean handleBellRingEvent(Level world, BlockPos position, Direction direction, Entity entity) {
|
||||
Block block = CraftBlock.at(world, position);
|
||||
BlockFace bukkitDirection = CraftBlock.notchToBlockFace(direction);
|
||||
BellRingEvent event = new BellRingEvent(block, bukkitDirection, (entity != null) ? entity.getBukkitEntity() : null);
|
||||
BellRingEvent event = new io.papermc.paper.event.block.BellRingEvent(block, bukkitDirection, (entity != null) ? entity.getBukkitEntity() : null); // Paper - deprecated BellRingEvent
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return !event.isCancelled();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue