API change: OnPlayerPlacingBlock / OnPlayerPlacedBlock
#12
Oh my, this is a bigger change than I anticipated. I'll have to change quite a few BlockHandlers and ItemHandlers to make things right.

Take the bed item handler, for example. Currently, it only places the "sheets" block and lets the blockhandler for the bed block handle placing the "pillow" block. This is however against the design I'm making here - if the placement of the "pillow" block is refused by the plugins, the "sheets" block should not be placed either. So I need to make the bed item handler place both blocks *at once* (atomically), so that the events are like this:
1. Hook call: OnPlayerPlacingBlock("sheets")
2. Hook call: OnPlayerPlacingBlock("pillow")
3. Set the "sheets" block
4. Set the "pillow" block
5. Hook call: OnPlayerPlacedBlock("sheets")
6. Hook call: OnPlayerPlacedBlock("pillow")
Now, if a plugin refuses step 2, neither of the blocks will be placed.

This means a complete rewrite of the cItemHandler::GetPlacementBlockTypeMeta() into another function, PlayerPlace()
Reply
Thanks given by:


Messages In This Thread
RE: API change: OnPlayerPlacingBlock / OnPlayerPlacedBlock - by xoft - 12-13-2014, 07:36 AM



Users browsing this thread: 1 Guest(s)