Adds info about the encrypt and decrypt signs, and fixes a bug in group decryption

This commit is contained in:
Kristian Knarvik 2021-09-02 22:18:15 +02:00
parent 931be7a61b
commit 1d3c50aab1
3 changed files with 17 additions and 2 deletions

View File

@ -36,4 +36,15 @@ Each plugin sign must have [BwB] on its first line.
The **_give_** sign must have **[Give]** on its second line.
The third and fourth line contains the book to be loaded.
This can either be a numerical id pointing to a publicly saved book,
or the full text identifier of the book (book name, author).
or the full text identifier of the book (book name, author).
#### Encrypt sign
The **_encrypt_** sign must have **[Encrypt]** on its second line.
The third line must contain the encryption key
The fourth line can be empty or contain "dna" for dna-based encryption.
#### Decrypt sign
The **_decrypt_** sign must have **[Decrypt]** on its second line.
The third line must contain the decryption key

View File

@ -388,7 +388,7 @@ public class BooksWithoutBorders extends JavaPlugin {
file = FileHelper.getBookFile(getBookFolder() + fileName);
} else if (dir.equalsIgnoreCase("player")) {
file = FileHelper.getBookFile(getBookFolder() + cleanString(sender.getName()) + getSlash() + fileName);
} else if (dir.trim().isEmpty()) {
} else if (!dir.trim().isEmpty()) {
file = FileHelper.getBookFile(getBookFolder() + "Encrypted" + getSlash() + dir + getSlash() + fileName);
} else {
file = null;

View File

@ -254,6 +254,10 @@ public class SignEventListener implements Listener {
}
newBook = BooksWithoutBorders.getInstance().loadBook(player, fileName, "true", groupName, heldItem.getAmount());
if (newBook == null) {
return;
}
player.getInventory().setItem(hand, newBook);
player.closeInventory();
player.sendMessage(ChatColor.GREEN + "Book auto-decrypted!");