Solved BlockPlaceEvent and BlockMultiPlaceEvent contain the same block

Discussion in 'Plugin Development' started by blackwolf12333, Jun 15, 2014.

Thread Status:
Not open for further replies.
  1. Hello,
    I have 2 event handlers, one for BlockPlaceEvent and one for BlockMultiPlaceEvent. When you place a bed or double plant or door both events fire. The BlockMultiPlaceEvent contains one block that is the same as the block from BlockPlaceEvent. But I obviously don't want to handle that block twice.
    The question is, is there a clean way to not handle the block twice?
    I thought about only using BlockMultiPlaceEvent, but that doesn't fire for normal blocks, so I can't use that. And I really would like to not have to keep a list of all the blocks from the BlockPlaceEvent that are the same in the BlockMultiPlaceEvent, because it could get messy because of synchronization issues.
    Thanks in advance,
    blackwolf12333
     
  2. Offline

    Smerfa

    hyym
    try check if BlockPlaceEvent is instance of BlockMultiPlaceEvent, BlockMultiPlaceEvent is extends BlockPlaceEvent so maybe that is one this same event :p

    end if yes, then you can use only one event and just casting it.
     
  3. I feel pretty stupid for not thinking about that :(
     
Thread Status:
Not open for further replies.

Share This Page