diff --git a/README.md b/README.md index 8dbf084..bc8ac35 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,9 @@ An in-game description of available commands is available through the /bwb comma book from your personal directory * /givepublicbook \[# of copies (num)] \[signed (true/false)] - Same as givebook, but uses books from the public directory -* /loadbook \[# of copies] \[signed (true/false)] - Creates a book from the specified file and gives - it to the player. If no file is specified, a list of available files is returned. If true is specified, the book will - be signed, if false it will be unsigned +* /loadbook \[# of copies] \[signed (true/false)] - Creates a book from the specified file and + gives it to the player. If no file is specified, a list of available files is returned. If true is specified, the book + will be signed, if false it will be unsigned * /loadpublicbook \[# of copies] \[signed (true/false)] - Same as loadbook, but views files in the public directory * /reload - Reloads BwB's configuration file diff --git a/src/main/java/net/knarcraft/bookswithoutborders/command/CommandSave.java b/src/main/java/net/knarcraft/bookswithoutborders/command/CommandSave.java index 5ecfb44..e98796f 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/command/CommandSave.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/command/CommandSave.java @@ -51,7 +51,7 @@ public class CommandSave implements TabExecutor { } ItemSlot holdingSlot = InventoryHelper.getHeldSlotBook(player, false, false, false, false); - if (holdingSlot != ItemSlot.NONE) { + if (holdingSlot != null && holdingSlot != ItemSlot.NONE) { ItemStack holdingItem = InventoryHelper.getHeldItem(player, holdingSlot == ItemSlot.MAIN_HAND); boolean duplicate = args.length == 1 && Boolean.parseBoolean(args[0]); saveBook(player, holdingItem, duplicate, savePublic); diff --git a/src/main/java/net/knarcraft/bookswithoutborders/utility/InventoryHelper.java b/src/main/java/net/knarcraft/bookswithoutborders/utility/InventoryHelper.java index bd52ab4..fd2bc1e 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/utility/InventoryHelper.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/utility/InventoryHelper.java @@ -96,7 +96,7 @@ public final class InventoryHelper { if (state == BookHoldingState.SIGNED_BOTH_HANDS || state == BookHoldingState.UNSIGNED_BOTH_HANDS || state == BookHoldingState.NONE) { - return null; + return ItemSlot.NONE; } if (handMatters && typeMatters) { if (mainHand && mainHandItem.getType() == requiredMaterial) {