Moves book to text code to its own class, and moves lots of encryption code to the encryption helper
This commit is contained in:
@@ -71,7 +71,7 @@ public class CommandDecrypt implements CommandExecutor {
|
||||
|
||||
if (!key.equalsIgnoreCase("")) {
|
||||
//Decrypt the book
|
||||
ItemStack book = booksWithoutBorders.loadEncryptedBook(player, key, false);
|
||||
ItemStack book = EncryptionHelper.loadEncryptedBook(player, key, false);
|
||||
if (book != null) {
|
||||
InventoryHelper.setHeldWrittenBook(player, book);
|
||||
BooksWithoutBorders.sendSuccessMessage(player, "Book auto-decrypted!");
|
||||
@@ -91,7 +91,7 @@ public class CommandDecrypt implements CommandExecutor {
|
||||
String key = EncryptionHelper.getNumberKeyFromStringKey(args[0]);
|
||||
|
||||
//Decrypt the book
|
||||
ItemStack book = booksWithoutBorders.loadEncryptedBook(player, key, true);
|
||||
ItemStack book = EncryptionHelper.loadEncryptedBook(player, key, true);
|
||||
if (book != null) {
|
||||
InventoryHelper.setHeldWrittenBook(player, book);
|
||||
BooksWithoutBorders.sendSuccessMessage(player, "Book decrypted!");
|
||||
|
@@ -2,6 +2,7 @@ package net.knarcraft.bookswithoutborders.command;
|
||||
|
||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||
import net.knarcraft.bookswithoutborders.state.EncryptionStyle;
|
||||
import net.knarcraft.bookswithoutborders.utility.EncryptionHelper;
|
||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -83,7 +84,7 @@ public class CommandEncrypt implements CommandExecutor {
|
||||
* @return <p>True if the book was encrypted successfully</p>
|
||||
*/
|
||||
boolean encryptBook(EncryptionStyle encryptionStyle, Player player, String key, String group) {
|
||||
ItemStack encryptedBook = booksWithoutBorders.encryptBook(player, true, key, encryptionStyle, group);
|
||||
ItemStack encryptedBook = EncryptionHelper.encryptBook(player, true, key, encryptionStyle, group);
|
||||
|
||||
if (encryptedBook != null) {
|
||||
InventoryHelper.setHeldWrittenBook(player, encryptedBook);
|
||||
|
Reference in New Issue
Block a user