Minestom
Minestom copied to clipboard
Add PlayerBlockHitEvent
Adds a new event fired when a player hits a block (left click).
Currently PlayerBlockInteractEvent only handles right clicks, to listen to left clicks one should use PlayerStartDiggingEvent, however, that event is only fired when players don't have instant break (i.e. creative). There are then 2 workarounds for this: 1 - Listen for PlayerStartDiggingEvent and PlayerBlockBreakEvent checking for instabreak 2 - Create your own packet listener and intercept the packet and fire a custom event from your extension
This PR aims to simplify this process and simply handle everything with a PlayerBlockHitEvent that is structured similarly to PlayerStartDiggingEvent (same fields) but that has a more precise name and is fired before everything else.
Use cases could be for example WorldEdit using left click interactions to manage selections