Fixes an exception when trying to save a book without holding a book
This commit is contained in:
@ -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);
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user