summaryrefslogtreecommitdiffstats
path: root/Server/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'Server/Plugins')
-rw-r--r--Server/Plugins/APIDump/APIDesc.lua107
-rw-r--r--Server/Plugins/APIDump/Hooks/OnPlayerEditedBook.lua26
-rw-r--r--Server/Plugins/APIDump/Hooks/OnPlayerEditingBook.lua26
3 files changed, 158 insertions, 1 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index d7dc83043..c7d47219a 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -6943,7 +6943,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins,
},
m_Enchantments =
{
- Type = "{{cEnchantments|cEnchantments}}}",
+ Type = "{{cEnchantments|cEnchantments}}",
Notes = "The enchantments of the item.",
},
m_ItemCount =
@@ -6971,6 +6971,11 @@ These ItemGrids are available in the API and can be manipulated by the plugins,
Type = "number",
Notes = "The repair cost of the item. The anvil need this value",
},
+ m_BookContent =
+ {
+ Type = "{{cBookContent|cBookContent}}",
+ Notes = "If it's a written or a writeable book, it contains the information of the book: Author, title and pages",
+ },
},
AdditionalInfo =
{
@@ -7014,6 +7019,106 @@ local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3");
},
},
},
+ cBookContent =
+ {
+ Desc = [[
+This class contains the information for a signed or writeable book: The author, title and the pages. A page of the writeable book is a simple string. For a signed book it can be a json string. For the json string use {{cCompositeChat}} to create a page and then the function {{cCompositeChat#CreateJsonString_1|CreateJsonString}} to get the json string.
+]],
+ Functions =
+ {
+ constructor =
+ {
+ Notes = "Creates a empty book",
+ },
+ SetAuthor =
+ {
+ Params =
+ {
+ {
+ Name = "Author",
+ Type = "string",
+ },
+ },
+ Notes = "Set the author of the book",
+ },
+ GetAuthor =
+ {
+ Returns =
+ {
+ {
+ Type = "string",
+ },
+ },
+ Notes = "Get the author of the book",
+ },
+ SetTitle =
+ {
+ Params =
+ {
+ {
+ Name = "Title",
+ Type = "string",
+ },
+ },
+ Notes = "Set the title of the book",
+ },
+ GetTitle =
+ {
+ Returns =
+ {
+ {
+ Type = "string",
+ },
+ },
+ Notes = "Returns the title of the book",
+ },
+ AddPage =
+ {
+ Params =
+ {
+ {
+ Name = "Page",
+ Type = "string",
+ },
+ },
+ Notes = "Add a page to the end of the book. Note: A page can be a json string",
+ },
+ GetPages =
+ {
+ Returns =
+ {
+ {
+ Type = "table",
+ },
+ },
+ Notes = "Returns the pages of the book as a table",
+ },
+ SetPages =
+ {
+ Params =
+ {
+ {
+ Type = "table",
+ },
+ },
+ Notes = "Set the pages of the book",
+ },
+ Clear =
+ {
+ Notes = "Clears the whole book",
+ },
+ IsEmpty =
+ {
+ Returns =
+ {
+ {
+ Type = "boolean",
+ },
+ },
+ Notes = "Returns true if the book has no author, title and no pages",
+ },
+ },
+ },
cItemFrame =
{
Functions =
diff --git a/Server/Plugins/APIDump/Hooks/OnPlayerEditedBook.lua b/Server/Plugins/APIDump/Hooks/OnPlayerEditedBook.lua
new file mode 100644
index 000000000..275bd129d
--- /dev/null
+++ b/Server/Plugins/APIDump/Hooks/OnPlayerEditedBook.lua
@@ -0,0 +1,26 @@
+return
+{
+ HOOK_PLAYER_EDITED_BOOK =
+ {
+ CalledWhen = "A player has edited a book.",
+ DefaultFnName = "OnPlayerEditedBook", -- also used as pagename
+ Desc = [[
+ This hook is called whenever a {{cPlayer|player}} has edited a book.
+ See also the {{OnPlayerEditingBook|HOOK_PLAYER_EDITING_BOOK}} hook for a similar hook, is called when a
+ player is editing a book.
+ ]],
+ Params =
+ {
+ { Name = "Player", Type = "{{cPlayer}}", Notes = "The player that edited the book" },
+ { Name = "BookContent", Type = "{{cBookContent}}", Notes = "The class that contains the current info of the book" },
+ },
+ 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_PLAYER_EDITED_BOOK
+}
+
+
+
+
diff --git a/Server/Plugins/APIDump/Hooks/OnPlayerEditingBook.lua b/Server/Plugins/APIDump/Hooks/OnPlayerEditingBook.lua
new file mode 100644
index 000000000..96521c361
--- /dev/null
+++ b/Server/Plugins/APIDump/Hooks/OnPlayerEditingBook.lua
@@ -0,0 +1,26 @@
+return
+{
+ HOOK_PLAYER_EDITING_BOOK =
+ {
+ CalledWhen = "A player is editing a book.",
+ DefaultFnName = "OnPlayerEditingBook", -- also used as pagename
+ Desc = [[
+ This hook is called whenever a {{cPlayer|player}} is editing a book.
+ See also the {{OnPlayerEditingBook|HOOK_PLAYER_EDITED_BOOK}} hook for a similar hook, is called when a
+ player has edited a book.
+ ]],
+ Params =
+ {
+ { Name = "Player", Type = "{{cPlayer}}", Notes = "The player that is editing the book" },
+ { Name = "BookContent", Type = "{{cBookContent}}", Notes = "The class that contains the current info of the book" },
+ },
+ 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 editing of the book is denied.
+ ]],
+ }, -- HOOK_PLAYER_EDITING_BOOK
+}
+
+
+
+