diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-24 15:55:08 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-24 15:55:08 +0100 |
commit | f95064a85c83e1a77a5de2f8a09e5907573f8277 (patch) | |
tree | 9896aa6cff228acbc0b188b6c37e2032152fe661 /MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua | |
parent | Fixed some comments and added debug logging (diff) | |
parent | RCONClient: Initial implementation. (diff) | |
download | cuberite-f95064a85c83e1a77a5de2f8a09e5907573f8277.tar cuberite-f95064a85c83e1a77a5de2f8a09e5907573f8277.tar.gz cuberite-f95064a85c83e1a77a5de2f8a09e5907573f8277.tar.bz2 cuberite-f95064a85c83e1a77a5de2f8a09e5907573f8277.tar.lz cuberite-f95064a85c83e1a77a5de2f8a09e5907573f8277.tar.xz cuberite-f95064a85c83e1a77a5de2f8a09e5907573f8277.tar.zst cuberite-f95064a85c83e1a77a5de2f8a09e5907573f8277.zip |
Diffstat (limited to 'MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua')
-rw-r--r-- | MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua new file mode 100644 index 000000000..4c91ea89e --- /dev/null +++ b/MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua @@ -0,0 +1,46 @@ +return +{ + HOOK_PLAYER_USED_BLOCK = + { + CalledWhen = "A player has just used a block (chest, furnace…). Notification only.", + DefaultFnName = "OnPlayerUsedBlock", -- also used as pagename + Desc = [[ + This hook is called after a {{cPlayer|player}} has right-clicked a block that can be used, such as a + {{cChestEntity|chest}} or a lever. It is called after MCServer processes the usage (sends the UI + handling packets / toggles redstone). Note that for UI-related blocks, the player is most likely + still using the UI. This is a notification-only event.</p> + <p> + Note that the block coords given in this callback are for the (solid) block that is being clicked, + not the air block between it and the player.</p> + <p> + To get the world at which the right-click occurred, use the {{cPlayer}}:GetWorld() function.</p> + <p> + See also the {{OnPlayerUsingBlock|HOOK_PLAYER_USING_BLOCK}} for a similar hook called before the + use, the {{OnPlayerUsingItem|HOOK_PLAYER_USING_ITEM}} and {{OnPlayerUsedItem|HOOK_PLAYER_USED_ITEM}} + for similar hooks called when a player interacts with any block with a usable item in hand, such as + a bucket. + ]], + Params = + { + { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who used the block" }, + { Name = "BlockX", Type = "number", Notes = "X-coord of the clicked block" }, + { Name = "BlockY", Type = "number", Notes = "Y-coord of the clicked block" }, + { Name = "BlockZ", Type = "number", Notes = "Z-coord of the clicked block" }, + { Name = "BlockFace", Type = "number", Notes = "Face of clicked block which has been clicked. One of the BLOCK_FACE_ constants" }, + { Name = "CursorX", Type = "number", Notes = "X-coord of the cursor crosshair on the block being clicked" }, + { Name = "CursorY", Type = "number", Notes = "Y-coord of the cursor crosshair on the block being clicked" }, + { Name = "CursorZ", Type = "number", Notes = "Z-coord of the cursor crosshair on the block being clicked" }, + { Name = "BlockType", Type = "number", Notes = "Block type of the clicked block" }, + { Name = "BlockMeta", Type = "number", Notes = "Block meta of the clicked block" }, + }, + Returns = [[ + If the function returns false or no value, other plugins' callbacks are called. If the function + returns true, no other callbacks are called for this event. + ]], + }, -- HOOK_PLAYER_USED_BLOCK +} + + + + + |