1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Feature BlockChangeEvent

Discussion in 'Bugs & Feature Requests' started by Flamedek, May 18, 2015.

?

This could be useful

  1. True

    3 vote(s)
    100.0%
  2. False

    0 vote(s)
    0.0%
  1. My suggestion is to add a BlockChangeEvent to the API.
    This event would live on block level, and is fired whenever a block changes it's type, for any reason.

    This would be useful when tracking block metadata or other, custom data. This way you can be guaranteed the data is removed when the block is also removed.

    Right now many different causes have different events, such as PistonExtendEvent, EntityExplodeEvent, BlockExplodeEvent and more.

    The information in the event should hold the block in question, and the BlockState(or material) it will change to. Optionally it could hold an BlockChangeReason enum.

    Hierarchy
    BlockChangeEvent would extend BlockEvent, and the excisting events could extend this BlockChangeEvent.
    One event would be an exception, EntityChangeBlockEvent, since that is currently an EntityEvent.

    List of suggested subclasses:
    BlockBreakEvent, BlockPhysicsEvent, BlockPistonEvent, EntityChangeBlockEvent, BlockFromToEvent, EntityExplodeEvent, BlockExplodeEvent, BlockPlaceEvent, BlockBurnEvent, BlockGrowEvent.