====== OnPlayerRightClick hook callback function ======
MCServer calls this function every time the client sends a right-click packet.  It is called before any processing whatsoever is performed on the packet, meaning that hacked / malicious clients may be trigerring this event very often and with unchecked parameters. Therefore plugin authors are advised to use extreme caution with this callback.

Plugins may refuse the default processing for the packet, causing MCServer to behave as if the packet has never arrived. This may, however, create inconsistencies in the client - the client may think that they placed a block, while the server didn't process theplacement, etc. For this reason, if a plugin refuses the processing, MCServer sends the old block at the coords specified in the packet back to the client, as if the placed block was immediately broken again.

Note that the block coordinates specified in the packet are the coordinates of an existing block with which the player is interacting, so in order to get the coordinates for the placement, you should use the [[API:Plugin:Globals|AddFaceDirection]] function.

The client may send the right-click packet for several occasions, such as placing a block, using the held item, placing or removing liquid from a bucket etc. Consult the [[http://wiki.vg/Protocol#0x0F|Protocol documentation]] for details.

===== Function signature =====
<code lua>
function OnPlayerRightClick(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
</code>
Parameters:
| Player | [[API::cPlayer|cPlayer]] | The player whose client sent the packet |
| BlockX | number | X-coord of the block |
| BlockY | number | Y-coord of the block |
| BlockZ | number | Z-coord of the block |
| BlockFace | number | Face of the block through which the player interacted |
| CursorX | number (0..16) | X-coord of the crosshair cursor on the block face |
| CursorY | number (0..16) | Y-coord of the crosshair cursor on the block face |
| CursorZ | number (0..16) | Z-coord of the crosshair cursor on the block face |

===== Return values =====
If the function returns false or no value, the next plugin's callback is called and finally the packet is sent for further processing. If the function returns true, no other callback is called for this event, MCServer sends the block which would've been replaced by the placement back to the client and drops the packet.

===== Registering the callback =====
To register your plugin to receive a callback through this function, use the hook [[api:plugin:hooks|HOOK_PLAYER_RIGHT_CLICK]]
<code lua>
cPluginManager:Get():AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICK);
</code>