Fabric API

Fabric API

106M Downloads

The interface events in PlayerBlockBreakEvents are named horribly

WaveringAna opened this issue ยท 4 comments

commented

They're just named Before, After, Cancelled instead of something more descriptive like BeforeBreak and CancelledBreak like any of the other events

commented

This is intended, and matches our newer conventions for event naming. See also the example under https://github.com/FabricMC/fabric/blob/1.19.3/CONTRIBUTING.md#events.

commented

its a terrible naming convention

commented

To be less crass and give examples, this shows very clearly what event I'm listening to without the need of a comment
image
However this just says after and won't be clear unless I look at the imports, and even then if I have many packages imported, it will not be clear unless I add an unnecessary comment
image

commented

Two notes:

  1. You can use a more qualified name, for example implements BlockBreakEvents.After.
  2. It's recommended to use lambda functions for event listeners. Then the listener declaration will look like BlockBreakEvents.AFTER.register((...) -> {...});