summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-15 17:35:34 +0200
committermadmaxoft <github@xoft.cz>2013-10-15 17:35:34 +0200
commitb079676290cdd6be5b6e3fd84f46b8d25f959b9e (patch)
tree114860ee9a476b62d845f5b1e75a30d8f21cac0b
parentAPIDump: Documented HOOK_PLAYER_PLACING_BLOCK. (diff)
downloadcuberite-b079676290cdd6be5b6e3fd84f46b8d25f959b9e.tar
cuberite-b079676290cdd6be5b6e3fd84f46b8d25f959b9e.tar.gz
cuberite-b079676290cdd6be5b6e3fd84f46b8d25f959b9e.tar.bz2
cuberite-b079676290cdd6be5b6e3fd84f46b8d25f959b9e.tar.lz
cuberite-b079676290cdd6be5b6e3fd84f46b8d25f959b9e.tar.xz
cuberite-b079676290cdd6be5b6e3fd84f46b8d25f959b9e.tar.zst
cuberite-b079676290cdd6be5b6e3fd84f46b8d25f959b9e.zip
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index b4b2e11a3..9430f370d 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -2864,6 +2864,35 @@ end;
]],
}, -- HOOK_PLAYER_PLACING_BLOCK
+ HOOK_POST_CRAFTING =
+ {
+ CalledWhen = "After the built-in recipes are checked and a recipe was found.",
+ DefaultFnName = "OnPostCrafting", -- also used as pagename
+ Desc = [[
+ This hook is called when a {{cPlayer|player}} changes contents of their
+ {{cCraftingGrid|crafting grid}}, after the recipe has been established by MCServer. Plugins may use
+ this to modify the resulting recipe or provide an alternate recipe.</p>
+ <p>
+ If a plugin implements custom recipes, it should do so using the {{OnPreCrafting|HOOK_PRE_CRAFTING}}
+ hook, because that will save the server from going through the built-in recipes. The
+ HOOK_POST_CRAFTING hook is intended as a notification, with a chance to tweak the result.</p>
+ <p>
+ Note that this hook is not called if a built-in recipe is not found;
+ {{OnCraftingNoRecipe|HOOK_CRAFTING_NO_RECIPE}} is called instead in such a case.
+ ]],
+ Params =
+ {
+ { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has changed their crafting grid contents" },
+ { Name = "Grid", Type = "{{cCraftingGrid}}", Notes = "The new crafting grid contents" },
+ { Name = "Recipe", Type = "{{cCraftingRecipe}}", Notes = "The recipe that MCServer has decided to use (can be tweaked by plugins)" },
+ },
+ 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. In either case, MCServer uses the value
+ of Recipe as the recipe to be presented to the player.
+ ]],
+ }, -- HOOK_POST_CRAFTING
+
}, -- Hooks[]