From d9dc241e6fe669585d7c0b13d55818a22e1c76bc Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 23 Nov 2013 21:26:24 +0100 Subject: APIDump: The descriptions are read from multiple files. All the files in the Classes subfolder are read for class descriptions, and in the Hooks subfolder for the hook descriptions. --- .../Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 MCServer/Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua (limited to 'MCServer/Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua') diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua new file mode 100644 index 000000000..8acc84b5f --- /dev/null +++ b/MCServer/Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua @@ -0,0 +1,46 @@ +return +{ + HOOK_PLAYER_USING_BLOCK = + { + CalledWhen = "Just before a player uses a block (chest, furnace...). Plugin may override / refuse.", + DefaultFnName = "OnPlayerUsingBlock", -- also used as pagename + Desc = [[ + This hook is called when a {{cPlayer|player}} has right-clicked a block that can be used, such as a + {{cChestEntity|chest}} or a lever. It is called before MCServer processes the usage (sends the UI + handling packets / toggles redstone). Plugins may refuse the interaction by returning true.

+

+ 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.

+

+ To get the world at which the right-click occurred, use the {{cPlayer}}:GetWorld() function.

+

+ See also the {{OnPlayerUsedBlock|HOOK_PLAYER_USED_BLOCK}} for a similar hook called after 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 is using 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 and then MCServer + processes the interaction. If the function returns true, no other callbacks are called for this + event and the interaction is silently dropped. + ]], + }, -- HOOK_PLAYER_USING_BLOCK +} + + + + + -- cgit v1.2.3