summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Bindings/ManualBindings.cpp9
-rw-r--r--src/Protocol/Protocol_1_9.cpp5
2 files changed, 8 insertions, 6 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 45fc11ccb..c298170a8 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -3979,7 +3979,9 @@ static int tolua_cBookContent_GetPages(lua_State * tolua_S)
{
return 0;
}
- cBookContent * BookContent = reinterpret_cast<cBookContent *>(tolua_tousertype(tolua_S, 1, nullptr));
+
+ cBookContent * BookContent = nullptr;
+ L.GetStackValue(1, BookContent);
L.Push(BookContent->GetPages());
return 1;
}
@@ -4001,9 +4003,10 @@ static int tolua_cBookContent_SetPages(lua_State * tolua_S)
{
return 0;
}
- cBookContent * BookContent = reinterpret_cast<cBookContent *>(tolua_tousertype(tolua_S, 1, nullptr));
+
+ cBookContent * BookContent = nullptr;
cLuaState::cStackTablePtr Pages;
- L.GetStackValue(2, Pages);
+ L.GetStackValues(1, BookContent, Pages);
Pages->ForEachArrayElement([=](cLuaState & a_LuaState, int a_Index) -> bool
{
AString Page;
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 9879140d4..aba0a9d01 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -2953,6 +2953,7 @@ void cProtocol_1_9_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, con
cParsedNBT NBT(BookData.c_str(), BookData.size());
cItem BookItem;
+ bool IsSigned = true;
if (a_Channel == "MC|BSign")
{
BookItem = cItem(E_ITEM_WRITTEN_BOOK);
@@ -2961,13 +2962,11 @@ void cProtocol_1_9_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, con
}
else
{
+ IsSigned = false;
BookItem = cItem(E_ITEM_BOOK_AND_QUILL);
cBookContent::ParseFromNBT(0, BookItem.m_BookContent, NBT);
}
- // 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))
{
// Plugin denied the editing of the book