Skip to content

Commit

Permalink
Fix item book format, item skull_skin for invalid input
Browse files Browse the repository at this point in the history
Don't retain invalid skin data
  • Loading branch information
mcmonkey4eva committed Aug 2, 2020
1 parent 4ce3e1a commit 0123fe7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -180,7 +180,7 @@ public MapTag getBookMap() {
BookMeta bookInfo = (BookMeta) item.getItemMeta();
if (item.getItemStack().getType().equals(Material.WRITTEN_BOOK) && bookInfo.hasAuthor() && bookInfo.hasTitle()) {
outMap.putObject("author", new ElementTag(bookInfo.getAuthor()));
outMap.putObject("author", new ElementTag(bookInfo.getTitle()));
outMap.putObject("title", new ElementTag(bookInfo.getTitle()));
}
if (bookInfo.hasPages()) {
List<BaseComponent[]> pages = bookInfo.spigot().getPages();
Expand Down
Expand Up @@ -172,6 +172,9 @@ public void adjust(Mechanism mechanism) {
if (texture != null) { // Ensure we didn't get overwritten
profile.setTexture(texture);
}
if (profile.getTexture() == null) {
return; // Can't set a skull skin to nothing.
}
item.setItemStack(NMSHandler.getItemHelper().setSkullSkin(item.getItemStack(), profile));
}
}
Expand Down

0 comments on commit 0123fe7

Please sign in to comment.