diff options
author | Lukas Pioch <lukas@zgow.de> | 2017-08-03 13:31:06 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-08-27 14:54:43 +0200 |
commit | 0a7784465463a7c8c86a0a52b53bb510751ce3a8 (patch) | |
tree | aff4cf44a327b9c64349c1fbc6719502d9a52caa | |
parent | Fixed nbt content lost on open creative inventory and alpha shorted (diff) | |
download | cuberite-0a7784465463a7c8c86a0a52b53bb510751ce3a8.tar cuberite-0a7784465463a7c8c86a0a52b53bb510751ce3a8.tar.gz cuberite-0a7784465463a7c8c86a0a52b53bb510751ce3a8.tar.bz2 cuberite-0a7784465463a7c8c86a0a52b53bb510751ce3a8.tar.lz cuberite-0a7784465463a7c8c86a0a52b53bb510751ce3a8.tar.xz cuberite-0a7784465463a7c8c86a0a52b53bb510751ce3a8.tar.zst cuberite-0a7784465463a7c8c86a0a52b53bb510751ce3a8.zip |
-rw-r--r-- | Server/Plugins/APIDump/APIDesc.lua | 2 | ||||
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 1 | ||||
-rw-r--r-- | src/Bindings/Plugin.h | 4 | ||||
-rw-r--r-- | src/Bindings/PluginLua.cpp | 6 | ||||
-rw-r--r-- | src/Bindings/PluginLua.h | 4 | ||||
-rw-r--r-- | src/Bindings/PluginManager.cpp | 4 | ||||
-rw-r--r-- | src/Bindings/PluginManager.h | 4 | ||||
-rw-r--r-- | src/BookContent.h | 5 |
8 files changed, 18 insertions, 12 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index a22eab601..01bd5f42e 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -6938,7 +6938,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins, { m_BookContent = { - Type = "{{cBookContent|cBookContent}}", + Type = "cBookContent", Notes = "If it's a written or a writeable book, it contains the information of the book: Author, title and pages", }, m_CustomName = diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index c298170a8..2a08e3e56 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -4007,6 +4007,7 @@ static int tolua_cBookContent_SetPages(lua_State * tolua_S) cBookContent * BookContent = nullptr; cLuaState::cStackTablePtr Pages; L.GetStackValues(1, BookContent, Pages); + BookContent->ClearPages(); Pages->ForEachArrayElement([=](cLuaState & a_LuaState, int a_Index) -> bool { AString Page; diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index 62863fea5..ab1d2a093 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -74,8 +74,8 @@ public: virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerDestroyed (cPlayer & a_Player) = 0; virtual bool OnPlayerEating (cPlayer & a_Player) = 0; - virtual bool OnPlayerEditedBook (cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) = 0; - virtual bool OnPlayerEditingBook (cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) = 0; + virtual bool OnPlayerEditedBook (cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned) = 0; + virtual bool OnPlayerEditingBook (cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned) = 0; virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) = 0; virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) = 0; virtual bool OnPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 2a4fb4494..e0dc24f3f 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -595,7 +595,7 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player) -bool cPluginLua::OnPlayerEditedBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) +bool cPluginLua::OnPlayerEditedBook(cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned) { return CallSimpleHooks(cPluginManager::HOOK_PLAYER_EDITED_BOOK, &a_Player, &a_BookContent, a_IsSigned); } @@ -604,7 +604,7 @@ bool cPluginLua::OnPlayerEditedBook(cPlayer & a_Player, cBookContent & a_BookCon -bool cPluginLua::OnPlayerEditingBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) +bool cPluginLua::OnPlayerEditingBook(cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned) { return CallSimpleHooks(cPluginManager::HOOK_PLAYER_EDITING_BOOK, &a_Player, &a_BookContent, a_IsSigned); } @@ -1081,7 +1081,7 @@ const char * cPluginLua::GetHookFnName(int a_HookType) case cPluginManager::HOOK_PLAYER_BROKEN_BLOCK: return "OnPlayerBrokenBlock"; case cPluginManager::HOOK_PLAYER_EATING: return "OnPlayerEating"; case cPluginManager::HOOK_PLAYER_EDITED_BOOK: return "OnPlayerEditedBook"; - case cPluginManager::HOOK_PLAYER_EDITING_BOOK: return "OnPlayerSigningdBook"; + case cPluginManager::HOOK_PLAYER_EDITING_BOOK: return "OnPlayerEditingBook"; case cPluginManager::HOOK_PLAYER_JOINED: return "OnPlayerJoined"; case cPluginManager::HOOK_PLAYER_LEFT_CLICK: return "OnPlayerLeftClick"; case cPluginManager::HOOK_PLAYER_MOVING: return "OnPlayerMoving"; diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index 59266a35a..703e1a945 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -95,8 +95,8 @@ public: virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerDestroyed (cPlayer & a_Player) override; virtual bool OnPlayerEating (cPlayer & a_Player) override; - virtual bool OnPlayerEditedBook (cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) override; - virtual bool OnPlayerEditingBook (cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) override; + virtual bool OnPlayerEditedBook (cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned) override; + virtual bool OnPlayerEditingBook (cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned) override; virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) override; virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) override; virtual bool OnPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 19b337523..8a7b29dcb 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -885,7 +885,7 @@ bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player) -bool cPluginManager::CallHookPlayerEditedBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) +bool cPluginManager::CallHookPlayerEditedBook(cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned) { FIND_HOOK(HOOK_PLAYER_EDITED_BOOK); VERIFY_HOOK; @@ -904,7 +904,7 @@ bool cPluginManager::CallHookPlayerEditedBook(cPlayer & a_Player, cBookContent & -bool cPluginManager::CallHookPlayerEditingBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) +bool cPluginManager::CallHookPlayerEditingBook(cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned) { FIND_HOOK(HOOK_PLAYER_EDITING_BOOK); VERIFY_HOOK; diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 5f765fd03..b3074f061 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -256,8 +256,8 @@ public: bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerDestroyed (cPlayer & a_Player); bool CallHookPlayerEating (cPlayer & a_Player); - bool CallHookPlayerEditedBook (cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned); - bool CallHookPlayerEditingBook (cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned); + bool CallHookPlayerEditedBook (cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned); + bool CallHookPlayerEditingBook (cPlayer & a_Player, const cBookContent & a_BookContent, bool a_IsSigned); bool CallHookPlayerFished (cPlayer & a_Player, const cItems & a_Reward); bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward); bool CallHookPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel); diff --git a/src/BookContent.h b/src/BookContent.h index 67c980c0a..43fd93742 100644 --- a/src/BookContent.h +++ b/src/BookContent.h @@ -39,6 +39,11 @@ public: // tolua_end + void ClearPages(void) + { + m_Pages.clear(); + } + /** Returns a AStringVector ref to the pages. Used in ManualBindings and for saving the book */ const AStringVector & GetPages(void) const { return m_Pages; } |