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:
Eearslya Sleiarion 2020-08-23 13:04:02 +02:00
parent 54ce8682aa
commit 2e8691de65

View file

@ -377,10 +377,11 @@ public class CraftEventFactory {
return tradeSelectEvent; 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) { public static boolean handleBellRingEvent(Level world, BlockPos position, Direction direction, Entity entity) {
Block block = CraftBlock.at(world, position); Block block = CraftBlock.at(world, position);
BlockFace bukkitDirection = CraftBlock.notchToBlockFace(direction); 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); Bukkit.getPluginManager().callEvent(event);
return !event.isCancelled(); return !event.isCancelled();
} }