diff options
author | Lukas Pioch <lukas@zgow.de> | 2017-08-23 18:09:47 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-08-27 17:49:08 +0200 |
commit | a5bae9f2f37921bfcf6203282155a8779c818120 (patch) | |
tree | b51bcc42cdc65fd7d0d76fd312216ec0720c706a /src/BookContent.cpp | |
parent | Added a new param to OnPlayerEditingBook and changed the names (diff) | |
download | cuberite-books.tar cuberite-books.tar.gz cuberite-books.tar.bz2 cuberite-books.tar.lz cuberite-books.tar.xz cuberite-books.tar.zst cuberite-books.zip |
Diffstat (limited to 'src/BookContent.cpp')
-rw-r--r-- | src/BookContent.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/BookContent.cpp b/src/BookContent.cpp index 4163d77d1..40819316b 100644 --- a/src/BookContent.cpp +++ b/src/BookContent.cpp @@ -80,8 +80,16 @@ void cBookContent::WriteToNBTCompound(const cBookContent & a_BookContent, cFastN return; } - a_Writer.AddString("author", a_BookContent.GetAuthor()); - a_Writer.AddString("title", a_BookContent.GetTitle()); + if (!a_BookContent.GetAuthor().empty()) + { + a_Writer.AddString("author", a_BookContent.GetAuthor()); + + } + if (!a_BookContent.GetTitle().empty()) + { + a_Writer.AddString("title", a_BookContent.GetTitle()); + + } a_Writer.BeginList("pages", TAG_String); for (const auto & Page : a_BookContent.GetPages()) { |