diff options
author | Lukas Pioch <lukas@zgow.de> | 2017-07-31 10:06:36 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-08-27 14:54:41 +0200 |
commit | e5758e8be3720893d9c42b6cffc1a84bedced71b (patch) | |
tree | 2d2e4cf5c59012f2ee1b0c932cba571fc2b1e88f | |
parent | APIDoc: Corrected Note for AddPage (diff) | |
download | cuberite-e5758e8be3720893d9c42b6cffc1a84bedced71b.tar cuberite-e5758e8be3720893d9c42b6cffc1a84bedced71b.tar.gz cuberite-e5758e8be3720893d9c42b6cffc1a84bedced71b.tar.bz2 cuberite-e5758e8be3720893d9c42b6cffc1a84bedced71b.tar.lz cuberite-e5758e8be3720893d9c42b6cffc1a84bedced71b.tar.xz cuberite-e5758e8be3720893d9c42b6cffc1a84bedced71b.tar.zst cuberite-e5758e8be3720893d9c42b6cffc1a84bedced71b.zip |
-rw-r--r-- | Server/Plugins/APIDump/APIDesc.lua | 10 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Hooks/OnPlayerEditedBook.lua | 1 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Hooks/OnPlayerEditingBook.lua | 1 | ||||
-rw-r--r-- | src/Bindings/Plugin.h | 4 | ||||
-rw-r--r-- | src/Bindings/PluginLua.cpp | 36 | ||||
-rw-r--r-- | src/Bindings/PluginLua.h | 4 | ||||
-rw-r--r-- | src/Bindings/PluginManager.cpp | 72 | ||||
-rw-r--r-- | src/Bindings/PluginManager.h | 4 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 10 |
9 files changed, 72 insertions, 70 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index cfe595f17..251c2e4fb 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -6936,6 +6936,11 @@ These ItemGrids are available in the API and can be manipulated by the plugins, }, Variables = { + 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", + }, m_CustomName = { Type = "string", @@ -6971,11 +6976,6 @@ 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 = { diff --git a/Server/Plugins/APIDump/Hooks/OnPlayerEditedBook.lua b/Server/Plugins/APIDump/Hooks/OnPlayerEditedBook.lua index 275bd129d..11e8dcea1 100644 --- a/Server/Plugins/APIDump/Hooks/OnPlayerEditedBook.lua +++ b/Server/Plugins/APIDump/Hooks/OnPlayerEditedBook.lua @@ -13,6 +13,7 @@ return { { 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" }, + { Name = "IsSigned", Type = "boolean", Notes = "Player has signed the book" }, }, Returns = [[ If the function returns false or no value, Cuberite calls other plugins with this event. If the diff --git a/Server/Plugins/APIDump/Hooks/OnPlayerEditingBook.lua b/Server/Plugins/APIDump/Hooks/OnPlayerEditingBook.lua index 96521c361..b911aaa54 100644 --- a/Server/Plugins/APIDump/Hooks/OnPlayerEditingBook.lua +++ b/Server/Plugins/APIDump/Hooks/OnPlayerEditingBook.lua @@ -13,6 +13,7 @@ return { { 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" }, + { Name = "IsSigned", Type = "boolean", Notes = "Player is signing the book" }, }, Returns = [[ If the function returns false or no value, Cuberite calls other plugins with this event. If the function returns true, diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index f7de4768f..62863fea5 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -74,6 +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 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; @@ -85,8 +87,6 @@ public: virtual bool OnPlayerPlacingBlock (cPlayer & a_Player, const sSetBlock & a_BlockChange) = 0; virtual bool OnPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) = 0; virtual bool OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) = 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 OnPlayerShooting (cPlayer & a_Player) = 0; virtual bool OnPlayerSpawned (cPlayer & a_Player) = 0; virtual bool OnPlayerTossingItem (cPlayer & a_Player) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 1d8024334..7d00b9fcf 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -595,6 +595,24 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player) +bool cPluginLua::OnPlayerEditedBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) +{ + return CallSimpleHooks(cPluginManager::HOOK_PLAYER_EDITED_BOOK, &a_Player, &a_BookContent, a_IsSigned); +} + + + + + +bool cPluginLua::OnPlayerEditingBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) +{ + return CallSimpleHooks(cPluginManager::HOOK_PLAYER_EDITING_BOOK, &a_Player, &a_BookContent, a_IsSigned); +} + + + + + bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int a_NewFoodLevel) { return CallSimpleHooks(cPluginManager::HOOK_PLAYER_FOOD_LEVEL_CHANGE, &a_Player, a_NewFoodLevel); @@ -712,24 +730,6 @@ bool cPluginLua::OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Ent -bool cPluginLua::OnPlayerEditedBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) -{ - return CallSimpleHooks(cPluginManager::HOOK_PLAYER_EDITED_BOOK, &a_Player, &a_BookContent, a_IsSigned); -} - - - - - -bool cPluginLua::OnPlayerEditingBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) -{ - return CallSimpleHooks(cPluginManager::HOOK_PLAYER_EDITING_BOOK, &a_Player, &a_BookContent, a_IsSigned); -} - - - - - bool cPluginLua::OnPlayerShooting(cPlayer & a_Player) { return CallSimpleHooks(cPluginManager::HOOK_PLAYER_SHOOTING, &a_Player); diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index 82b78cbe0..59266a35a 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -95,6 +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 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; @@ -106,8 +108,6 @@ public: virtual bool OnPlayerPlacingBlock (cPlayer & a_Player, const sSetBlock & a_BlockChange) override; virtual bool OnPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override; virtual bool OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) 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 OnPlayerShooting (cPlayer & a_Player) override; virtual bool OnPlayerSpawned (cPlayer & a_Player) override; virtual bool OnEntityTeleport (cEntity & a_Entity, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 125a6bfc8..19b337523 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -885,14 +885,14 @@ bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player) -bool cPluginManager::CallHookPlayerFoodLevelChange(cPlayer & a_Player, int a_NewFoodLevel) +bool cPluginManager::CallHookPlayerEditedBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) { - FIND_HOOK(HOOK_PLAYER_FOOD_LEVEL_CHANGE); + FIND_HOOK(HOOK_PLAYER_EDITED_BOOK); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerFoodLevelChange(a_Player, a_NewFoodLevel)) + if ((*itr)->OnPlayerEditedBook(a_Player, a_BookContent, a_IsSigned)) { return true; } @@ -904,14 +904,14 @@ bool cPluginManager::CallHookPlayerFoodLevelChange(cPlayer & a_Player, int a_New -bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, const cItems & a_Reward) +bool cPluginManager::CallHookPlayerEditingBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) { - FIND_HOOK(HOOK_PLAYER_FISHED); + FIND_HOOK(HOOK_PLAYER_EDITING_BOOK); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerFished(a_Player, a_Reward)) + if ((*itr)->OnPlayerEditingBook(a_Player, a_BookContent, a_IsSigned)) { return true; } @@ -923,14 +923,14 @@ bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, const cItems & a_R -bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, cItems a_Reward) +bool cPluginManager::CallHookPlayerFoodLevelChange(cPlayer & a_Player, int a_NewFoodLevel) { - FIND_HOOK(HOOK_PLAYER_FISHING); + FIND_HOOK(HOOK_PLAYER_FOOD_LEVEL_CHANGE); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerFishing(a_Player, a_Reward)) + if ((*itr)->OnPlayerFoodLevelChange(a_Player, a_NewFoodLevel)) { return true; } @@ -942,14 +942,14 @@ bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, cItems a_Reward) -bool cPluginManager::CallHookPlayerJoined(cPlayer & a_Player) +bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, const cItems & a_Reward) { - FIND_HOOK(HOOK_PLAYER_JOINED); + FIND_HOOK(HOOK_PLAYER_FISHED); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerJoined(a_Player)) + if ((*itr)->OnPlayerFished(a_Player, a_Reward)) { return true; } @@ -961,14 +961,14 @@ bool cPluginManager::CallHookPlayerJoined(cPlayer & a_Player) -bool cPluginManager::CallHookPlayerLeftClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) +bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, cItems a_Reward) { - FIND_HOOK(HOOK_PLAYER_LEFT_CLICK); + FIND_HOOK(HOOK_PLAYER_FISHING); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerLeftClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status)) + if ((*itr)->OnPlayerFishing(a_Player, a_Reward)) { return true; } @@ -980,14 +980,14 @@ bool cPluginManager::CallHookPlayerLeftClick(cPlayer & a_Player, int a_BlockX, i -bool cPluginManager::CallHookPlayerMoving(cPlayer & a_Player, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition) +bool cPluginManager::CallHookPlayerJoined(cPlayer & a_Player) { - FIND_HOOK(HOOK_PLAYER_MOVING); + FIND_HOOK(HOOK_PLAYER_JOINED); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerMoving(a_Player, a_OldPosition, a_NewPosition)) + if ((*itr)->OnPlayerJoined(a_Player)) { return true; } @@ -1018,14 +1018,14 @@ bool cPluginManager::CallHookPlayerOpeningWindow(cPlayer & a_Player, cWindow & a -bool cPluginManager::CallHookPlayerPlacedBlock(cPlayer & a_Player, const sSetBlock & a_BlockChange) +bool cPluginManager::CallHookPlayerLeftClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) { - FIND_HOOK(HOOK_PLAYER_PLACED_BLOCK); + FIND_HOOK(HOOK_PLAYER_LEFT_CLICK); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerPlacedBlock(a_Player, a_BlockChange)) + if ((*itr)->OnPlayerLeftClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status)) { return true; } @@ -1037,14 +1037,14 @@ bool cPluginManager::CallHookPlayerPlacedBlock(cPlayer & a_Player, const sSetBlo -bool cPluginManager::CallHookPlayerPlacingBlock(cPlayer & a_Player, const sSetBlock & a_BlockChange) +bool cPluginManager::CallHookPlayerMoving(cPlayer & a_Player, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition) { - FIND_HOOK(HOOK_PLAYER_PLACING_BLOCK); + FIND_HOOK(HOOK_PLAYER_MOVING); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerPlacingBlock(a_Player, a_BlockChange)) + if ((*itr)->OnPlayerMoving(a_Player, a_OldPosition, a_NewPosition)) { return true; } @@ -1056,14 +1056,14 @@ bool cPluginManager::CallHookPlayerPlacingBlock(cPlayer & a_Player, const sSetBl -bool cPluginManager::CallHookPlayerRightClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) +bool cPluginManager::CallHookPlayerPlacedBlock(cPlayer & a_Player, const sSetBlock & a_BlockChange) { - FIND_HOOK(HOOK_PLAYER_RIGHT_CLICK); + FIND_HOOK(HOOK_PLAYER_PLACED_BLOCK); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerRightClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)) + if ((*itr)->OnPlayerPlacedBlock(a_Player, a_BlockChange)) { return true; } @@ -1075,14 +1075,14 @@ bool cPluginManager::CallHookPlayerRightClick(cPlayer & a_Player, int a_BlockX, -bool cPluginManager::CallHookPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) +bool cPluginManager::CallHookPlayerPlacingBlock(cPlayer & a_Player, const sSetBlock & a_BlockChange) { - FIND_HOOK(HOOK_PLAYER_RIGHT_CLICKING_ENTITY); + FIND_HOOK(HOOK_PLAYER_PLACING_BLOCK); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerRightClickingEntity(a_Player, a_Entity)) + if ((*itr)->OnPlayerPlacingBlock(a_Player, a_BlockChange)) { return true; } @@ -1094,14 +1094,14 @@ bool cPluginManager::CallHookPlayerRightClickingEntity(cPlayer & a_Player, cEnti -bool cPluginManager::CallHookPlayerEditedBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) +bool cPluginManager::CallHookPlayerRightClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) { - FIND_HOOK(HOOK_PLAYER_EDITED_BOOK); + FIND_HOOK(HOOK_PLAYER_RIGHT_CLICK); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerEditedBook(a_Player, a_BookContent, a_IsSigned)) + if ((*itr)->OnPlayerRightClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)) { return true; } @@ -1113,14 +1113,14 @@ bool cPluginManager::CallHookPlayerEditedBook(cPlayer & a_Player, cBookContent & -bool cPluginManager::CallHookPlayerEditingBook(cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned) +bool cPluginManager::CallHookPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) { - FIND_HOOK(HOOK_PLAYER_EDITING_BOOK); + FIND_HOOK(HOOK_PLAYER_RIGHT_CLICKING_ENTITY); VERIFY_HOOK; for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerEditingBook(a_Player, a_BookContent, a_IsSigned)) + if ((*itr)->OnPlayerRightClickingEntity(a_Player, a_Entity)) { return true; } diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 204a70e67..9552f3f86 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -256,6 +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 CallHookPlayerFished (cPlayer & a_Player, const cItems & a_Reward); bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward); bool CallHookPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel); @@ -267,8 +269,6 @@ public: bool CallHookPlayerPlacingBlock (cPlayer & a_Player, const sSetBlock & a_BlockChange); bool CallHookPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ); bool CallHookPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity); - bool CallHookPlayerEditedBook (cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned); - bool CallHookPlayerEditingBook (cPlayer & a_Player, cBookContent & a_BookContent, bool a_IsSigned); bool CallHookPlayerShooting (cPlayer & a_Player); bool CallHookPlayerSpawned (cPlayer & a_Player); bool CallHookPlayerTossingItem (cPlayer & a_Player); diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index f49a942b8..257484086 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -2958,23 +2958,23 @@ void cProtocol_1_9_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, con cBookContent::ParseFromNBT(0, BookItem.m_BookContent, NBT); } - cPlayer * Player = m_Client->GetPlayer(); + cPlayer & Player = *m_Client->GetPlayer(); // If true, player has clicked on the sign button bool IsSigned = (BookItem.m_ItemType == E_ITEM_WRITTEN_BOOK) ? true : false; - if (cRoot::Get()->GetPluginManager()->CallHookPlayerEditingBook(*Player, BookItem.m_BookContent, IsSigned)) + if (cRoot::Get()->GetPluginManager()->CallHookPlayerEditingBook(Player, BookItem.m_BookContent, IsSigned)) { // Plugin denied the editing of the book return; } // Book has been edited, inform plugins - cRoot::Get()->GetPluginManager()->CallHookPlayerEditedBook(*Player, BookItem.m_BookContent, IsSigned); + cRoot::Get()->GetPluginManager()->CallHookPlayerEditedBook(Player, BookItem.m_BookContent, IsSigned); - cInventory & inv = Player->GetInventory(); + cInventory & inv = Player.GetInventory(); inv.SetHotbarSlot(inv.GetEquippedSlotNum(), BookItem); - SendWholeInventory(*Player->GetWindow()); // TODO: Use SendSlot + SendWholeInventory(*Player.GetWindow()); // TODO: Use SendSlot return; } LOG("Unhandled vanilla plugin channel: \"%s\".", a_Channel.c_str()); |