summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_9.cpp
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2017-07-31 10:45:52 +0200
committerLukas Pioch <lukas@zgow.de>2017-08-27 14:54:41 +0200
commite58dd789b552f3c9bc520e04259594137f5a0c56 (patch)
tree49d94353fe3c88f08b6f8eac5775904d80be2674 /src/Protocol/Protocol_1_9.cpp
parentAlpha sorted and added missing param IsSigned (diff)
downloadcuberite-e58dd789b552f3c9bc520e04259594137f5a0c56.tar
cuberite-e58dd789b552f3c9bc520e04259594137f5a0c56.tar.gz
cuberite-e58dd789b552f3c9bc520e04259594137f5a0c56.tar.bz2
cuberite-e58dd789b552f3c9bc520e04259594137f5a0c56.tar.lz
cuberite-e58dd789b552f3c9bc520e04259594137f5a0c56.tar.xz
cuberite-e58dd789b552f3c9bc520e04259594137f5a0c56.tar.zst
cuberite-e58dd789b552f3c9bc520e04259594137f5a0c56.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol_1_9.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 257484086..9879140d4 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -2937,6 +2937,13 @@ void cProtocol_1_9_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, con
return;
}
+ cPlayer & Player = *m_Client->GetPlayer();
+ if (Player.GetEquippedItem().m_ItemType != E_ITEM_BOOK_AND_QUILL)
+ {
+ // Equipped item is not a writeable book
+ return;
+ }
+
// Skip item count (1 byte) and item damage (2 bytes)
a_ByteBuffer.SkipRead(3);
@@ -2958,8 +2965,6 @@ void cProtocol_1_9_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, con
cBookContent::ParseFromNBT(0, BookItem.m_BookContent, NBT);
}
- 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;
@@ -2974,7 +2979,7 @@ void cProtocol_1_9_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, con
cInventory & inv = Player.GetInventory();
inv.SetHotbarSlot(inv.GetEquippedSlotNum(), BookItem);
- SendWholeInventory(*Player.GetWindow()); // TODO: Use SendSlot
+ Player.GetInventory().SendEquippedSlot();
return;
}
LOG("Unhandled vanilla plugin channel: \"%s\".", a_Channel.c_str());