Fixes a bug caused by assuming a book is in the main hand
This commit is contained in:
parent
c8ac3477bd
commit
240ff0c869
@ -2,6 +2,7 @@ package net.knarcraft.bookswithoutborders.command;
|
|||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.state.EncryptionStyle;
|
import net.knarcraft.bookswithoutborders.state.EncryptionStyle;
|
||||||
|
import net.knarcraft.bookswithoutborders.state.ItemSlot;
|
||||||
import net.knarcraft.bookswithoutborders.utility.EncryptionHelper;
|
import net.knarcraft.bookswithoutborders.utility.EncryptionHelper;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -83,7 +84,8 @@ public class CommandEncrypt implements TabExecutor {
|
|||||||
* @return <p>True if the book was encrypted successfully</p>
|
* @return <p>True if the book was encrypted successfully</p>
|
||||||
*/
|
*/
|
||||||
boolean encryptBook(EncryptionStyle encryptionStyle, Player player, String key, String group) {
|
boolean encryptBook(EncryptionStyle encryptionStyle, Player player, String key, String group) {
|
||||||
ItemStack encryptedBook = EncryptionHelper.encryptBook(player, true, key, encryptionStyle, group);
|
ItemSlot heldSlot = InventoryHelper.getHeldSlotBook(player, false, false, true, true);
|
||||||
|
ItemStack encryptedBook = EncryptionHelper.encryptBook(player, heldSlot == ItemSlot.MAIN_HAND, key, encryptionStyle, group);
|
||||||
|
|
||||||
if (encryptedBook != null) {
|
if (encryptedBook != null) {
|
||||||
InventoryHelper.setHeldWrittenBook(player, encryptedBook);
|
InventoryHelper.setHeldWrittenBook(player, encryptedBook);
|
||||||
|
Loading…
Reference in New Issue
Block a user