Fixes an exception when trying to save a book without holding a book
This commit is contained in:
parent
ed54ae84b5
commit
a95d737414
@ -51,9 +51,9 @@ An in-game description of available commands is available through the /bwb comma
|
|||||||
book from your personal directory
|
book from your personal directory
|
||||||
* /givepublicbook <file name or number> <playername> \[# of copies (num)] \[signed (true/false)] - Same as givebook, but
|
* /givepublicbook <file name or number> <playername> \[# of copies (num)] \[signed (true/false)] - Same as givebook, but
|
||||||
uses books from the public directory
|
uses books from the public directory
|
||||||
* /loadbook <file name or number> \[# of copies] \[signed (true/false)] - Creates a book from the specified file and gives
|
* /loadbook <file name or number> \[# of copies] \[signed (true/false)] - Creates a book from the specified file and
|
||||||
it to the player. If no file is specified, a list of available files is returned. If true is specified, the book will
|
gives it to the player. If no file is specified, a list of available files is returned. If true is specified, the book
|
||||||
be signed, if false it will be unsigned
|
will be signed, if false it will be unsigned
|
||||||
* /loadpublicbook <file name or number> \[# of copies] \[signed (true/false)] - Same as loadbook, but views files in the
|
* /loadpublicbook <file name or number> \[# of copies] \[signed (true/false)] - Same as loadbook, but views files in the
|
||||||
public directory
|
public directory
|
||||||
* /reload - Reloads BwB's configuration file
|
* /reload - Reloads BwB's configuration file
|
||||||
|
@ -51,7 +51,7 @@ public class CommandSave implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemSlot holdingSlot = InventoryHelper.getHeldSlotBook(player, false, false, false, false);
|
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);
|
ItemStack holdingItem = InventoryHelper.getHeldItem(player, holdingSlot == ItemSlot.MAIN_HAND);
|
||||||
boolean duplicate = args.length == 1 && Boolean.parseBoolean(args[0]);
|
boolean duplicate = args.length == 1 && Boolean.parseBoolean(args[0]);
|
||||||
saveBook(player, holdingItem, duplicate, savePublic);
|
saveBook(player, holdingItem, duplicate, savePublic);
|
||||||
|
@ -96,7 +96,7 @@ public final class InventoryHelper {
|
|||||||
if (state == BookHoldingState.SIGNED_BOTH_HANDS ||
|
if (state == BookHoldingState.SIGNED_BOTH_HANDS ||
|
||||||
state == BookHoldingState.UNSIGNED_BOTH_HANDS ||
|
state == BookHoldingState.UNSIGNED_BOTH_HANDS ||
|
||||||
state == BookHoldingState.NONE) {
|
state == BookHoldingState.NONE) {
|
||||||
return null;
|
return ItemSlot.NONE;
|
||||||
}
|
}
|
||||||
if (handMatters && typeMatters) {
|
if (handMatters && typeMatters) {
|
||||||
if (mainHand && mainHandItem.getType() == requiredMaterial) {
|
if (mainHand && mainHandItem.getType() == requiredMaterial) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user