summaryrefslogtreecommitdiffstats
path: root/Server/Plugins
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2015-11-03 22:06:43 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2015-11-03 22:06:43 +0100
commit1bc145ff44bee52d3b71812cc06ffe214f4ac216 (patch)
tree7ea9f3b0029bbf5041c2f05c7d3f3e156c3e6186 /Server/Plugins
parentMerge pull request #2595 from cengizIO/master (diff)
parentImplemented brewing (diff)
downloadcuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.gz
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.bz2
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.lz
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.xz
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.zst
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.zip
Diffstat (limited to 'Server/Plugins')
-rw-r--r--Server/Plugins/APIDump/APIDesc.lua3
-rw-r--r--Server/Plugins/APIDump/Classes/BlockEntities.lua41
-rw-r--r--Server/Plugins/APIDump/Classes/Plugins.lua2
-rw-r--r--Server/Plugins/APIDump/Hooks/OnBrewingCompleted.lua26
-rw-r--r--Server/Plugins/APIDump/Hooks/OnBrewingCompleting.lua28
5 files changed, 100 insertions, 0 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index 33d351104..02ce1f894 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -2067,6 +2067,7 @@ a_Player:OpenWindow(Window);
ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|cPlayer}})</pre>" },
ForEachWorld = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each world. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cWorld|cWorld}})</pre>" },
Get = { Params = "", Return = "Root object", Notes = "(STATIC) This function returns the cRoot object." },
+ GetBrewingRecipe = { Params = "{{cItem|cItem}}, {{cItem|cItem}}", Return = "{{cItem|cItem}}", Notes = "(STATIC) Returns the result item, if a recipe has been found. If no recipe is found, returns no value." },
GetBuildCommitID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the exact commit hash used for the build. For unofficial local builds, returns the approximate commit hash (since the true one cannot be determined), formatted as \"approx: &lt;CommitHash&gt;\"." },
GetBuildDateTime = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travic CI / Jenkins) it returns the date and time of the build. For unofficial local builds, returns the approximate datetime of the commit (since the true one cannot be determined), formatted as \"approx: &lt;DateTime-iso8601&gt;\"." },
GetBuildID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the unique ID of the build, as recognized by the build system. For unofficial local builds, returns the string \"Unknown\"." },
@@ -2333,6 +2334,7 @@ local CompressedString = cStringCompression.CompressStringGZIP("DataToCompress")
DigBlock = { Params = "X, Y, Z", Return = "", Notes = "Replaces the specified block with air, without dropping the usual pickups for the block. Wakes up the simulators for the block and its neighbors." },
DoExplosionAt = { Params = "Force, X, Y, Z, CanCauseFire, Source, SourceData", Return = "", Notes = "Creates an explosion of the specified relative force in the specified position. If CanCauseFire is set, the explosion will set blocks on fire, too. The Source parameter specifies the source of the explosion, one of the esXXX constants. The SourceData parameter is specific to each source type, usually it provides more info about the source." },
DoWithBlockEntityAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a block entity at the specified coords, calls the CallbackFunction with the {{cBlockEntity}} parameter representing the block entity. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBlockEntity|BlockEntity}})</pre> The function returns false if there is no block entity, or if there is, it returns the bool value that the callback has returned. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." },
+ DoWithBrewingstandAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a brewingstand at the specified coords, calls the CallbackFunction with the {{cBrewingstandEntity}} parameter representing the brewingstand. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBrewingstandEntity|cBrewingstandEntity}})</pre> The function returns false if there is no brewingstand, or if there is, it returns the bool value that the callback has returned." },
DoWithBeaconAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a beacon at the specified coords, calls the CallbackFunction with the {{cBeaconEntity}} parameter representing the beacon. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBeaconEntity|BeaconEntity}})</pre> The function returns false if there is no beacon, or if there is, it returns the bool value that the callback has returned." },
DoWithChestAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a chest at the specified coords, calls the CallbackFunction with the {{cChestEntity}} parameter representing the chest. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cChestEntity|ChestEntity}})</pre> The function returns false if there is no chest, or if there is, it returns the bool value that the callback has returned." },
DoWithCommandBlockAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a command block at the specified coords, calls the CallbackFunction with the {{cCommandBlockEntity}} parameter representing the command block. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cCommandBlockEntity|CommandBlockEntity}})</pre> The function returns false if there is no command block, or if there is, it returns the bool value that the callback has returned." },
@@ -2353,6 +2355,7 @@ local CompressedString = cStringCompression.CompressStringGZIP("DataToCompress")
},
FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "bool", Notes = "Calls the given callback function for the player with the name best matching the name string provided.<br>This function is case-insensitive and will match partial names.<br>Returns false if player not found or there is ambiguity, true otherwise. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre>" },
ForEachBlockEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each block entity in the chunk. Returns true if all block entities in the chunk have been processed (including when there are zero block entities), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBlockEntity|BlockEntity}})</pre> The callback should return false or no value to continue with the next block entity, or true to abort the enumeration. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." },
+ ForEachBrewingstandInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each brewingstand in the chunk. Returns true if all brewingstands in the chunk have been processed (including when there are zero brewingstands), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBrewingstandEntity|cBrewingstandEntity}})</pre> The callback should return false or no value to continue with the next brewingstand, or true to abort the enumeration." },
ForEachChestInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each chest in the chunk. Returns true if all chests in the chunk have been processed (including when there are zero chests), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cChestEntity|ChestEntity}})</pre> The callback should return false or no value to continue with the next chest, or true to abort the enumeration." },
ForEachEntity = { Params = "CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the loaded world. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
ForEachEntityInBox = { Params = "{{cBoundingBox|Box}}, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the specified bounding box. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. If any chunk within the bounding box is not valid, it is silently skipped without any notification. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
diff --git a/Server/Plugins/APIDump/Classes/BlockEntities.lua b/Server/Plugins/APIDump/Classes/BlockEntities.lua
index daa658654..019e702eb 100644
--- a/Server/Plugins/APIDump/Classes/BlockEntities.lua
+++ b/Server/Plugins/APIDump/Classes/BlockEntities.lua
@@ -76,6 +76,47 @@ return
},
},
+ cBrewingstandEntity =
+ {
+ Desc = [[
+ This class represents a brewingstand entity in the world.</p>
+ <p>
+ See also the {{cRoot}}:GetBrewingRecipe() function.
+ ]],
+ Functions =
+ {
+ GetBrewingTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current items finishes brewing, in ticks" },
+ GetTimeBrewed = { Params = "", Return = "number", Notes = "Returns the time that the current items has been brewing, in ticks" },
+ GetLeftBottleSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the left bottle slot" },
+ GetMiddleBottleSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the middle bottle slot" },
+ GetRightBottleSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the right bottle slot" },
+ GetIndgredientSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the ingredient slot" },
+ GetResultItem = { Params = "number", Return = "{{cItem|cItem}}", Notes = "Returns the expected result item for the given slot number." },
+ SetLeftBottleSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the left bottle slot" },
+ SetMiddleBottleSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the middle bottle slot" },
+ SetRightBottleSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the right bottle slot" },
+ SetIngredientSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the ingredient bottle slot" },
+ },
+ Constants =
+ {
+ bsLeftBottle = { Notes = "Index of the left bottle slot" },
+ bsMiddleBottle = { Notes = "Index of the middle bottle slot" },
+ bsRightBottle = { Notes = "Index of the right bottle slot" },
+ bsIngredient = { Notes = "Index of the ingredient slot" },
+ ContentsWidth = { Notes = "Width (X) of the {{cItemGrid|cItemGrid}} representing the contents" },
+ ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid|cItemGrid}} representing the contents" },
+ },
+ ConstantGroups =
+ {
+ SlotIndices =
+ {
+ Include = "bs.*",
+ TextBefore = "When using the GetSlot() or SetSlot() function, use these constants for slot index:",
+ },
+ },
+ Inherits = "cBlockEntityWithItems"
+ }, -- cBrewingstandEntity
+
cChestEntity =
{
Desc = [[
diff --git a/Server/Plugins/APIDump/Classes/Plugins.lua b/Server/Plugins/APIDump/Classes/Plugins.lua
index f892ad8f6..758598242 100644
--- a/Server/Plugins/APIDump/Classes/Plugins.lua
+++ b/Server/Plugins/APIDump/Classes/Plugins.lua
@@ -110,6 +110,8 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
crUnknownCommand = { Notes = "When the given command doesn't exist." },
HOOK_BLOCK_SPREAD = { Notes = "Called when a block spreads based on world conditions" },
HOOK_BLOCK_TO_PICKUPS = { Notes = "Called when a block has been dug and is being converted to pickups. The server has provided the default pickups and the plugins may modify them." },
+ HOOK_BREWING_COMPLETING = { "Called before a brewing stand completes a brewing process." },
+ HOOK_BREWING_COMPLETED = { "Called when a brewing stand completed a brewing process." },
HOOK_CHAT = { Notes = "Called when a client sends a chat message that is not a command. The plugin may modify the chat message" },
HOOK_CHUNK_AVAILABLE = { Notes = "Called when a chunk is loaded or generated and becomes available in the {{cWorld|world}}." },
HOOK_CHUNK_GENERATED = { Notes = "Called after a chunk is generated. A plugin may do last modifications on the generated chunk before it is handed of to the {{cWorld|world}}." },
diff --git a/Server/Plugins/APIDump/Hooks/OnBrewingCompleted.lua b/Server/Plugins/APIDump/Hooks/OnBrewingCompleted.lua
new file mode 100644
index 000000000..316227739
--- /dev/null
+++ b/Server/Plugins/APIDump/Hooks/OnBrewingCompleted.lua
@@ -0,0 +1,26 @@
+return
+{
+ HOOK_BREWING_COMPLETED =
+ {
+ CalledWhen = "A brewing process is completed.",
+ DefaultFnName = "OnBrewingCompleted", -- also used as pagename
+ Desc = [[
+ This hook is called whenever a {{cBrewingstand|brewing stand}} has completed the brewing process.
+ See also the {{OnBrewingCompleting|HOOK_BREWING_COMPLETING}} hook for a similar hook, is called when a
+ brewing process is completing.
+ ]],
+ Params =
+ {
+ { Name = "World", Type = "{{cWorld}}", Notes = "World where the brewing stand resides." },
+ { Name = "Brewingstand", Type = "{{cBrewingstand}}", Notes = "The brewing stand that completed the brewing process." },
+ },
+ Returns = [[
+ If the function returns false or no value, Cuberite calls other plugins with this event. If the
+ function returns true, no other plugin is called for this event.</p>
+ ]],
+ }, -- HOOK_BREWING_COMPLETED
+}
+
+
+
+
diff --git a/Server/Plugins/APIDump/Hooks/OnBrewingCompleting.lua b/Server/Plugins/APIDump/Hooks/OnBrewingCompleting.lua
new file mode 100644
index 000000000..14429c8ff
--- /dev/null
+++ b/Server/Plugins/APIDump/Hooks/OnBrewingCompleting.lua
@@ -0,0 +1,28 @@
+return
+{
+ HOOK_BREWING_COMPLETING =
+ {
+ CalledWhen = "A brewing process is completing.",
+ DefaultFnName = "OnBrewingCompleting", -- also used as pagename
+ Desc = [[
+ This hook is called whenever a {{cBrewingstand|brewing stand}} is completing the brewing process. Plugins may
+ refuse the completing of the brewing process.<p>
+ See also the {{OnBrewingCompleted|HOOK_BREWING_COMPLETED}} hook for a similar hook, is called after the
+ brewing process has been completed.
+ ]],
+ Params =
+ {
+ { Name = "World", Type = "{{cWorld}}", Notes = "World where the brewing stand resides." },
+ { Name = "Brewingstand", Type = "{{cBrewingstand}}", Notes = "The brewing stand that completes the brewing process." },
+ },
+ Returns = [[
+ If the function returns false or no value, Cuberite calls other plugins with this event. If the function returns true,
+ no other plugin's callback is called and the brewing process is canceled.
+ <p>
+ ]],
+ }, -- HOOK_BREWING_COMPLETING
+}
+
+
+
+