Cuberite Forum
onActionCallBack - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: onActionCallBack (/thread-415.html)



onActionCallBack - geser - 03-31-2012

Are there any callback that works when player do something with some blockEntity (right click)? For example, when player open the chest or close the door. I want to write plugin, providing private chest , but I can not find any callback on this situation.

P.S. Is wiki plugin API documentation up to date?


RE: onActionCallBack - FakeTruth - 03-31-2012

(03-31-2012, 08:57 AM)geser Wrote: Are there any callback that works when player do something with some blockEntity (right click)? For example, when player open the chest or close the door. I want to write plugin, providing private chest , but I can not find any callback on this situation.
Use E_PLUGIN_BLOCK_PLACE
http://mc-server.org/wiki/doku.php?id=api:plugin:onblockplace

(03-31-2012, 08:57 AM)geser Wrote: P.S. Is wiki plugin API documentation up to date?
No, it's not



RE: onActionCallBack - geser - 04-01-2012

Thanks. Callback name is not good i think. May be onBlockRightClick, or other name will be better?


RE: onActionCallBack - FakeTruth - 04-01-2012

(04-01-2012, 04:37 AM)geser Wrote: Thanks. Callback name is not good i think. May be onBlockRightClick, or other name will be better?

YupTongue


RE: onActionCallBack - Taugeshtu - 05-31-2012

Tiny bump:
I want a hook for right-click with an empy hand (or a tool/weapon) on any "static" block (not a chest or something "actable")

Should I use E_PLUGIN_BLOCK_PLACE? If so - how do I "get" what kind of item player was holding while right-click?
There's player link in E_PLUGIN_BLOCK_PLACE, and player has an inventory, but I don't know how to get infro about which item was held by player. Is it possible? (Yes, I'm a maniac and I would like to write a runecraft analog)


RE: onActionCallBack - FakeTruth - 05-31-2012

Yes, use E_PLUGIN_BLOCK_PLACE.

And yes you can get the currently holding item from the player's inventory.

http://mc-server.org/wiki/doku.php?id=api:cinventory
cPlayer:GetInventory():GetEquippedItem()

This gives you a cItem object http://mc-server.org/wiki/doku.php?id=api:citem


RE: onActionCallBack - Taugeshtu - 05-31-2012

Oh, I appologize for being inattentive again Smile Thanks


RE: onActionCallBack - FakeTruth - 05-31-2012

No problem, I'm glad you askTongue