Splits translatable strings to make them more manageable
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
This commit is contained in:
36
README.md
36
README.md
@@ -71,7 +71,7 @@ An in-game description of available commands is available through the /bwb comma
|
|||||||
| /deletebook | bwbdelete | \<file name or number> | bookswithoutborders.delete | Deletes the specified file in the player's directory |
|
| /deletebook | bwbdelete | \<file name or number> | bookswithoutborders.delete | Deletes the specified file in the player's directory |
|
||||||
| /deleteBookPage | bwbdeletepage | \<page> | bookswithoutborders.deletepage | Deletes one page from a book |
|
| /deleteBookPage | bwbdeletepage | \<page> | bookswithoutborders.deletepage | Deletes one page from a book |
|
||||||
| /deletepublicbook | bwbdeletep | \<file name or number> | bookswithoutborders.admin | Same as deletebook, but deletes files in the public directory |
|
| /deletepublicbook | bwbdeletep | \<file name or number> | bookswithoutborders.admin | Same as deletebook, but deletes files in the public directory |
|
||||||
| /encryptbook | bwbencrypt | \<key> \[encryption style] | bookswithoutborders.encrypt | Encrypts the book the player is holding. "key" is required and can be any phrase or number excluding spaces. "style" is not required. Possible values are "DNA" or "" |
|
| /encryptbook | bwbencrypt | \<key> \[encryption style] | bookswithoutborders.encrypt | Encrypts the book the player is holding. "key" is required and can be any phrase or number excluding spaces. "style" is not required. Possible values are "dna", "substitution", "aes", "onetimepad" and "magic", unless real encryption is enabled, which limits available algorithms. |
|
||||||
| /formatbook | bwbformat | None | bookswithoutborders.format | Formats the held written book (converts color and formatting codes to the corresponding formatted text) |
|
| /formatbook | bwbformat | None | bookswithoutborders.format | Formats the held written book (converts color and formatting codes to the corresponding formatted text) |
|
||||||
| /givebook | bwbgive | \<file name or number> \<playername> \[# of copies (num)] \[signed (true/false)] | bookswithoutborders.give | Gives the selected player a book from your personal directory |
|
| /givebook | bwbgive | \<file name or number> \<playername> \[# of copies (num)] \[signed (true/false)] | bookswithoutborders.give | Gives the selected player a book from your personal directory |
|
||||||
| /givepublicbook | bwbgivep | \<file name or number> \<playername> \[# of copies (num)] \[signed (true/false)] | bookswithoutborders.givepublic | Same as givebook, but uses books from the public directory |
|
| /givepublicbook | bwbgivep | \<file name or number> \<playername> \[# of copies (num)] \[signed (true/false)] | bookswithoutborders.givepublic | Same as givebook, but uses books from the public directory |
|
||||||
@@ -158,20 +158,20 @@ The **_decrypt_** sign must have **\[Decrypt]** on its second line. The third li
|
|||||||
|
|
||||||
### Configuration options:
|
### Configuration options:
|
||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
|----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| Max_Number_of_Duplicates | The maximum number of duplicates of a saved book allowed |
|
| Max_Number_of_Duplicates | The maximum number of duplicates of a saved book allowed |
|
||||||
| Author_Separator | The separator used to separate the book title and the book author |
|
| Author_Separator | The separator used to separate the book title and the book author |
|
||||||
| Lore_line_separator | The separator used to denote a new line in the book/item lore |
|
| Lore_line_separator | The separator used to denote a new line in the book/item lore |
|
||||||
| Books_for_new_players | A list of books given to new players the first time they join the server |
|
| Books_for_new_players | A list of books given to new players the first time they join the server |
|
||||||
| Message_for_new_players | An optional message displayed to new players the first time they join the server |
|
| Message_for_new_players | An optional message displayed to new players the first time they join the server |
|
||||||
| Price_to_create_book.Item_type | The item type used as currency for copying books. Use "Economy" to use money instead of items |
|
| Price_to_create_book.Item_type | The item type used as currency for copying books. Use "Economy" to use money instead of items |
|
||||||
| Price_to_create_book.Required_quantity | The quantity of currency required to pay for each book produced |
|
| Price_to_create_book.Required_quantity | The quantity of currency required to pay for each book produced |
|
||||||
| Admin_Auto_Decrypt | Whether any admin can decrypt any book regardless of the group it was encrypted for |
|
| Admin_Auto_Decrypt | Whether any admin can decrypt any book regardless of the group it was encrypted for |
|
||||||
| Author_Only_Copy | Whether to only allow the author of a book to create copies |
|
| Author_Only_Copy | Whether to only allow the author of a book to create copies |
|
||||||
| Author_Only_Unsign | Whether to only allow the author of a book to unsign it |
|
| Author_Only_Unsign | Whether to only allow the author of a book to unsign it |
|
||||||
| Author_Only_Save | Whether to only allow saving a player's own books with /savebook |
|
| Author_Only_Save | Whether to only allow saving a player's own books with /savebook |
|
||||||
| Format_Book_After_Signing | Whether to automatically format every book when it's signed |
|
| Format_Book_After_Signing | Whether to automatically format every book when it's signed |
|
||||||
| Change_Generation_On_Copy | Whether to display "COPY" or "COPY_OF_COPY" instead of "ORIGINAL" when a book is copied. This also uses the vanilla behavior where a copy of a copy or tattered book cannot be copied further. |
|
| Change_Generation_On_Copy | Whether to display "COPY" or "COPY_OF_COPY" instead of "ORIGINAL" when a book is copied. This also uses the vanilla behavior where a copy of a copy or tattered book cannot be copied further. |
|
||||||
| Enable_Book_Peeking | Whether to enable hitting a chiseled bookshelf while sneaking to see the shelf's contents. |
|
| Enable_Book_Peeking | Whether to enable hitting a chiseled bookshelf while sneaking to see the shelf's contents. |
|
||||||
| Use_Real_Encryption | Enables true AES encryption instead of the very fake legacy encryption. The encryption key is stored in the book file to allow admin decryption, but looking at the encrypted book in the file system, only reveals the encrypted pages. |
|
| Use_Real_Encryption | Enables true AES encryption instead of the very fake legacy encryption. The encryption key is stored in the book file to allow admin decryption, but looking at the encrypted book in the file system, only reveals the encrypted pages. Note that real encryption might alter, corrupt or lose a book's contents, so don't use real encryption with books that have no backup in in-game book form or saved book form. |
|
@@ -29,7 +29,12 @@ import net.knarcraft.bookswithoutborders.command.CommandUnSign;
|
|||||||
import net.knarcraft.bookswithoutborders.config.BwBCommand;
|
import net.knarcraft.bookswithoutborders.config.BwBCommand;
|
||||||
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
||||||
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.BookshelfMessage;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.CostMessage;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.GiveMessage;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.SaveMessage;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.container.MigrationRequest;
|
import net.knarcraft.bookswithoutborders.container.MigrationRequest;
|
||||||
import net.knarcraft.bookswithoutborders.handler.BookshelfHandler;
|
import net.knarcraft.bookswithoutborders.handler.BookshelfHandler;
|
||||||
import net.knarcraft.bookswithoutborders.listener.BookEventListener;
|
import net.knarcraft.bookswithoutborders.listener.BookEventListener;
|
||||||
@@ -207,6 +212,12 @@ public class BooksWithoutBorders extends JavaPlugin {
|
|||||||
|
|
||||||
Translator translator = new Translator();
|
Translator translator = new Translator();
|
||||||
translator.registerMessageCategory(Translatable.SUCCESS_COPY);
|
translator.registerMessageCategory(Translatable.SUCCESS_COPY);
|
||||||
|
translator.registerMessageCategory(GiveMessage.SUCCESS_GIVE_SENT);
|
||||||
|
translator.registerMessageCategory(BookshelfMessage.SUCCESS_BOOKSHELF_TITLE_SET);
|
||||||
|
translator.registerMessageCategory(Formatting.ACTION_COPY);
|
||||||
|
translator.registerMessageCategory(CostMessage.SUCCESS_COST_ITEM_SET);
|
||||||
|
translator.registerMessageCategory(SaveMessage.SUCCESS_SAVED);
|
||||||
|
|
||||||
stringFormatter = new StringFormatter(this.getDescription().getName(), translator);
|
stringFormatter = new StringFormatter(this.getDescription().getName(), translator);
|
||||||
stringFormatter.setColorConversion(ColorConversion.RGB);
|
stringFormatter.setColorConversion(ColorConversion.RGB);
|
||||||
stringFormatter.setSuccessColor(ChatColor.of("#A9FF84"));
|
stringFormatter.setSuccessColor(ChatColor.of("#A9FF84"));
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookFormatter;
|
import net.knarcraft.bookswithoutborders.utility.BookFormatter;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookHelper;
|
import net.knarcraft.bookswithoutborders.utility.BookHelper;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||||
@@ -44,9 +45,9 @@ public class CommandAddTitlePage implements TabExecutor {
|
|||||||
if (arguments.length < 1) {
|
if (arguments.length < 1) {
|
||||||
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_ADD_TITLE_AUTHOR_PAGE)),
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_ADD_TITLE_AUTHOR_PAGE)),
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_ADD_TITLE_AUTHOR_PAGE)))) {
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_ADD_TITLE_AUTHOR_PAGE)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ public class CommandAddTitlePage implements TabExecutor {
|
|||||||
if (title == null && heldBook.getType() == Material.WRITTEN_BOOK) {
|
if (title == null && heldBook.getType() == Material.WRITTEN_BOOK) {
|
||||||
// Add a page with the book title and book author
|
// Add a page with the book title and book author
|
||||||
String loreSeparator = BooksWithoutBorders.getConfiguration().getLoreSeparator();
|
String loreSeparator = BooksWithoutBorders.getConfiguration().getLoreSeparator();
|
||||||
String pageText = formatTitle(stringFormatter.replacePlaceholders(Translatable.NEUTRAL_TITLE_PAGE_TITLE_AUTHOR_FORMAT,
|
String pageText = formatTitle(stringFormatter.replacePlaceholders(Formatting.NEUTRAL_TITLE_PAGE_TITLE_AUTHOR_FORMAT,
|
||||||
List.of("{title}", "{separator}", "{author}"), List.of(BookHelper.getBookTitle(bookMeta),
|
List.of("{title}", "{separator}", "{author}"), List.of(BookHelper.getBookTitle(bookMeta),
|
||||||
loreSeparator, BookHelper.getBookAuthor(bookMeta, null))));
|
loreSeparator, BookHelper.getBookAuthor(bookMeta, null))));
|
||||||
|
|
||||||
@@ -128,11 +129,11 @@ public class CommandAddTitlePage implements TabExecutor {
|
|||||||
if (input.contains(loreSeparator)) {
|
if (input.contains(loreSeparator)) {
|
||||||
String[] parts = input.split(loreSeparator);
|
String[] parts = input.split(loreSeparator);
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
output.append(stringFormatter.replacePlaceholder(Translatable.NEUTRAL_TITLE_PAGE_HEADER_FORMAT,
|
output.append(stringFormatter.replacePlaceholder(Formatting.NEUTRAL_TITLE_PAGE_HEADER_FORMAT,
|
||||||
"{header}", BookFormatter.stripColor(parts[0])));
|
"{header}", BookFormatter.stripColor(parts[0])));
|
||||||
|
|
||||||
for (int i = 1; i < parts.length; i++) {
|
for (int i = 1; i < parts.length; i++) {
|
||||||
output.append(stringFormatter.replacePlaceholder(Translatable.NEUTRAL_TITLE_PAGE_TEXT_FORMAT,
|
output.append(stringFormatter.replacePlaceholder(Formatting.NEUTRAL_TITLE_PAGE_TEXT_FORMAT,
|
||||||
"{text}", BookFormatter.stripColor(parts[i])));
|
"{text}", BookFormatter.stripColor(parts[i])));
|
||||||
}
|
}
|
||||||
return output.toString();
|
return output.toString();
|
||||||
|
@@ -5,7 +5,9 @@ import net.knarcraft.bookswithoutborders.config.BwBCommand;
|
|||||||
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
||||||
import net.knarcraft.bookswithoutborders.config.Permission;
|
import net.knarcraft.bookswithoutborders.config.Permission;
|
||||||
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.CostMessage;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.manager.EconomyManager;
|
import net.knarcraft.bookswithoutborders.manager.EconomyManager;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import net.knarcraft.knarlib.util.TabCompletionHelper;
|
import net.knarcraft.knarlib.util.TabCompletionHelper;
|
||||||
@@ -50,7 +52,7 @@ public class CommandBooksWithoutBorders implements TabExecutor {
|
|||||||
commandExplanation = getCommandExplanation(true);
|
commandExplanation = getCommandExplanation(true);
|
||||||
}
|
}
|
||||||
stringFormatter.displaySuccessMessage(sender, stringFormatter.replacePlaceholders(
|
stringFormatter.displaySuccessMessage(sender, stringFormatter.replacePlaceholders(
|
||||||
Translatable.NEUTRAL_COMMANDS_HEADER, List.of("{bookPrice}", "{commands}", "{commandExplanation}"),
|
Formatting.NEUTRAL_COMMANDS_HEADER, List.of("{bookPrice}", "{commands}", "{commandExplanation}"),
|
||||||
List.of(getBookPrice(), commands, commandExplanation)));
|
List.of(getBookPrice(), commands, commandExplanation)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -87,15 +89,15 @@ public class CommandBooksWithoutBorders implements TabExecutor {
|
|||||||
Material bookPriceType = config.getBookPriceType();
|
Material bookPriceType = config.getBookPriceType();
|
||||||
double bookPriceQuantity = config.getBookPriceQuantity();
|
double bookPriceQuantity = config.getBookPriceQuantity();
|
||||||
if (bookPriceType != Material.AIR) {
|
if (bookPriceType != Material.AIR) {
|
||||||
return stringFormatter.replacePlaceholders(Translatable.NEUTRAL_COMMANDS_BOOK_PRICE_ITEM,
|
return stringFormatter.replacePlaceholders(Formatting.NEUTRAL_COMMANDS_BOOK_PRICE_ITEM,
|
||||||
List.of("{quantity}", "{type}"),
|
List.of("{quantity}", "{type}"),
|
||||||
List.of(String.valueOf((int) bookPriceQuantity), bookPriceType.toString()));
|
List.of(String.valueOf((int) bookPriceQuantity), bookPriceType.toString()));
|
||||||
} else {
|
} else {
|
||||||
EconomyManager economyManager = BooksWithoutBorders.getConfiguration().getEconomyManager();
|
EconomyManager economyManager = BooksWithoutBorders.getConfiguration().getEconomyManager();
|
||||||
if (economyManager.getEconomy() == null) {
|
if (economyManager.getEconomy() == null) {
|
||||||
return BooksWithoutBorders.getStringFormatter().getUnFormattedColoredMessage(Translatable.ERROR_VAULT_COST_BUT_UNAVAILABLE) + "\n";
|
return BooksWithoutBorders.getStringFormatter().getUnFormattedColoredMessage(CostMessage.ERROR_VAULT_COST_BUT_UNAVAILABLE) + "\n";
|
||||||
} else {
|
} else {
|
||||||
return stringFormatter.replacePlaceholder(Translatable.NEUTRAL_COMMANDS_BOOK_PRICE_ECO,
|
return stringFormatter.replacePlaceholder(Formatting.NEUTRAL_COMMANDS_BOOK_PRICE_ECO,
|
||||||
"{price}", economyManager.getEconomy().format(bookPriceQuantity));
|
"{price}", economyManager.getEconomy().format(bookPriceQuantity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,18 +166,18 @@ public class CommandBooksWithoutBorders implements TabExecutor {
|
|||||||
} else {
|
} else {
|
||||||
commandUsage = pluginCommand.getUsage().replace("<command>", pluginCommand.getName());
|
commandUsage = pluginCommand.getUsage().replace("<command>", pluginCommand.getName());
|
||||||
description = pluginCommand.getDescription();
|
description = pluginCommand.getDescription();
|
||||||
aliases = stringFormatter.replacePlaceholder(Translatable.NEUTRAL_COMMANDS_ALIASES, "{aliases}",
|
aliases = stringFormatter.replacePlaceholder(Formatting.NEUTRAL_COMMANDS_ALIASES, "{aliases}",
|
||||||
String.join(",", pluginCommand.getAliases()));
|
String.join(",", pluginCommand.getAliases()));
|
||||||
}
|
}
|
||||||
|
|
||||||
String commandDescription = stringFormatter.replacePlaceholders(Translatable.NEUTRAL_COMMANDS_COMMAND,
|
String commandDescription = stringFormatter.replacePlaceholders(Formatting.NEUTRAL_COMMANDS_COMMAND,
|
||||||
List.of("{usage}", "{description}", "{aliases}"), List.of(commandUsage, description, aliases));
|
List.of("{usage}", "{description}", "{aliases}"), List.of(commandUsage, description, aliases));
|
||||||
|
|
||||||
if (!summary && sender.hasPermission(Permission.ADMIN.toString())) {
|
if (!summary && sender.hasPermission(Permission.ADMIN.toString())) {
|
||||||
if (permission == null) {
|
if (permission == null) {
|
||||||
permission = stringFormatter.getUnFormattedColoredMessage(Translatable.NEUTRAL_COMMANDS_COMMAND_NO_PERMISSION_REQUIRED);
|
permission = stringFormatter.getUnFormattedColoredMessage(Formatting.NEUTRAL_COMMANDS_COMMAND_NO_PERMISSION_REQUIRED);
|
||||||
}
|
}
|
||||||
commandDescription += stringFormatter.replacePlaceholder(Translatable.NEUTRAL_COMMANDS_COMMAND_PERMISSION, "{permission}", permission);
|
commandDescription += stringFormatter.replacePlaceholder(Formatting.NEUTRAL_COMMANDS_COMMAND_PERMISSION, "{permission}", permission);
|
||||||
}
|
}
|
||||||
return commandDescription;
|
return commandDescription;
|
||||||
}
|
}
|
||||||
@@ -190,13 +192,13 @@ public class CommandBooksWithoutBorders implements TabExecutor {
|
|||||||
private String getCommandExplanation(boolean summary) {
|
private String getCommandExplanation(boolean summary) {
|
||||||
StringFormatter stringFormatter = BooksWithoutBorders.getStringFormatter();
|
StringFormatter stringFormatter = BooksWithoutBorders.getStringFormatter();
|
||||||
if (summary) {
|
if (summary) {
|
||||||
return stringFormatter.replacePlaceholders(Translatable.NEUTRAL_COMMANDS_COMMAND,
|
return stringFormatter.replacePlaceholders(Formatting.NEUTRAL_COMMANDS_COMMAND,
|
||||||
List.of("{usage}", "{description}", "{aliases}"), List.of("Command", "Usage summary", ""));
|
List.of("{usage}", "{description}", "{aliases}"), List.of("Command", "Usage summary", ""));
|
||||||
} else {
|
} else {
|
||||||
return stringFormatter.replacePlaceholders(Translatable.NEUTRAL_COMMANDS_COMMAND,
|
return stringFormatter.replacePlaceholders(Formatting.NEUTRAL_COMMANDS_COMMAND,
|
||||||
List.of("{usage}", "{description}", "{aliases}"), List.of("Command and arguments", "Full description",
|
List.of("{usage}", "{description}", "{aliases}"), List.of("Command and arguments", "Full description",
|
||||||
stringFormatter.replacePlaceholder(Translatable.NEUTRAL_COMMANDS_ALIASES, "{aliases}", "Alias list"))) +
|
stringFormatter.replacePlaceholder(Formatting.NEUTRAL_COMMANDS_ALIASES, "{aliases}", "Alias list"))) +
|
||||||
stringFormatter.replacePlaceholder(Translatable.NEUTRAL_COMMANDS_COMMAND_PERMISSION, "{permission}", "Required permission");
|
stringFormatter.replacePlaceholder(Formatting.NEUTRAL_COMMANDS_COMMAND_PERMISSION, "{permission}", "Required permission");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@@ -34,9 +35,9 @@ public class CommandClear implements TabExecutor {
|
|||||||
|
|
||||||
if (InventoryHelper.notHoldingOneWritableBookCheck(player,
|
if (InventoryHelper.notHoldingOneWritableBookCheck(player,
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITABLE_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITABLE_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_CLEAR)),
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_CLEAR)),
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_CLEAR)))) {
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_CLEAR)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,7 +3,8 @@ package net.knarcraft.bookswithoutborders.command;
|
|||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
||||||
import net.knarcraft.bookswithoutborders.config.Permission;
|
import net.knarcraft.bookswithoutborders.config.Permission;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookHelper;
|
import net.knarcraft.bookswithoutborders.utility.BookHelper;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||||
import net.knarcraft.bookswithoutborders.utility.TabCompletionTypeHelper;
|
import net.knarcraft.bookswithoutborders.utility.TabCompletionTypeHelper;
|
||||||
@@ -39,9 +40,9 @@ public class CommandCopy implements TabExecutor {
|
|||||||
|
|
||||||
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_COPY)),
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_COPY)),
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_COPY)))) {
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_COPY)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,8 @@ package net.knarcraft.bookswithoutborders.command;
|
|||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Permission;
|
import net.knarcraft.bookswithoutborders.config.Permission;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookHelper;
|
import net.knarcraft.bookswithoutborders.utility.BookHelper;
|
||||||
import net.knarcraft.bookswithoutborders.utility.EncryptionHelper;
|
import net.knarcraft.bookswithoutborders.utility.EncryptionHelper;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||||
@@ -36,9 +37,9 @@ public class CommandDecrypt implements TabExecutor {
|
|||||||
|
|
||||||
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_DECRYPT)),
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_DECRYPT)),
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_DECRYPT)))) {
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_DECRYPT)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.gui.PagedBookIndex;
|
import net.knarcraft.bookswithoutborders.gui.PagedBookIndex;
|
||||||
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookFileHelper;
|
import net.knarcraft.bookswithoutborders.utility.BookFileHelper;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.encryption.EncryptionStyle;
|
import net.knarcraft.bookswithoutborders.encryption.EncryptionStyle;
|
||||||
import net.knarcraft.bookswithoutborders.state.ItemSlot;
|
import net.knarcraft.bookswithoutborders.state.ItemSlot;
|
||||||
import net.knarcraft.bookswithoutborders.utility.EncryptionHelper;
|
import net.knarcraft.bookswithoutborders.utility.EncryptionHelper;
|
||||||
@@ -64,9 +65,9 @@ public class CommandEncrypt implements TabExecutor {
|
|||||||
|
|
||||||
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_ENCRYPT)),
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_ENCRYPT)),
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_ENCRYPT)))) {
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_ENCRYPT)))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookFormatter;
|
import net.knarcraft.bookswithoutborders.utility.BookFormatter;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.GiveMessage;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.gui.PagedBookIndex;
|
import net.knarcraft.bookswithoutborders.gui.PagedBookIndex;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookLoader;
|
import net.knarcraft.bookswithoutborders.utility.BookLoader;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InputCleaningHelper;
|
import net.knarcraft.bookswithoutborders.utility.InputCleaningHelper;
|
||||||
@@ -59,7 +60,7 @@ public class CommandGive implements TabExecutor {
|
|||||||
|
|
||||||
StringFormatter stringFormatter = BooksWithoutBorders.getStringFormatter();
|
StringFormatter stringFormatter = BooksWithoutBorders.getStringFormatter();
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_GIVE_NO_RECIPIENT);
|
stringFormatter.displayErrorMessage(sender, GiveMessage.ERROR_GIVE_NO_RECIPIENT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,13 +92,13 @@ public class CommandGive implements TabExecutor {
|
|||||||
//Try and find the target player
|
//Try and find the target player
|
||||||
Player receivingPlayer = booksWithoutBorders.getServer().getPlayerExact(receivingPlayerName);
|
Player receivingPlayer = booksWithoutBorders.getServer().getPlayerExact(receivingPlayerName);
|
||||||
if (receivingPlayer == null) {
|
if (receivingPlayer == null) {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_GIVE_RECIPIENT_UNKNOWN);
|
stringFormatter.displayErrorMessage(sender, GiveMessage.ERROR_GIVE_RECIPIENT_UNKNOWN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Make sure the receiver is able to fit the book
|
//Make sure the receiver is able to fit the book
|
||||||
if (receivingPlayer.getInventory().firstEmpty() == -1) {
|
if (receivingPlayer.getInventory().firstEmpty() == -1) {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_GIVE_RECIPIENT_FULL);
|
stringFormatter.displayErrorMessage(sender, GiveMessage.ERROR_GIVE_RECIPIENT_FULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,11 +192,11 @@ public class CommandGive implements TabExecutor {
|
|||||||
if (newBook != null) {
|
if (newBook != null) {
|
||||||
//NOTE: As this method bypasses cost, it should also bypass the generation change
|
//NOTE: As this method bypasses cost, it should also bypass the generation change
|
||||||
receivingPlayer.getInventory().addItem(newBook);
|
receivingPlayer.getInventory().addItem(newBook);
|
||||||
stringFormatter.displaySuccessMessage(sender, Translatable.SUCCESS_GIVE_SENT);
|
stringFormatter.displaySuccessMessage(sender, GiveMessage.SUCCESS_GIVE_SENT);
|
||||||
stringFormatter.displaySuccessMessage(receivingPlayer, Translatable.SUCCESS_GIVE_RECEIVED);
|
stringFormatter.displaySuccessMessage(receivingPlayer, GiveMessage.SUCCESS_GIVE_RECEIVED);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_GIVE_LOAD_FAILED);
|
stringFormatter.displayErrorMessage(sender, GiveMessage.ERROR_GIVE_LOAD_FAILED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.encryption.EncryptionStyle;
|
import net.knarcraft.bookswithoutborders.encryption.EncryptionStyle;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.gui.PagedBookIndex;
|
import net.knarcraft.bookswithoutborders.gui.PagedBookIndex;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookLoader;
|
import net.knarcraft.bookswithoutborders.utility.BookLoader;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InputCleaningHelper;
|
import net.knarcraft.bookswithoutborders.utility.InputCleaningHelper;
|
||||||
|
@@ -2,7 +2,7 @@ package net.knarcraft.bookswithoutborders.command;
|
|||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.container.MigrationRequest;
|
import net.knarcraft.bookswithoutborders.container.MigrationRequest;
|
||||||
import net.knarcraft.bookswithoutborders.thread.MigrationQueueThread;
|
import net.knarcraft.bookswithoutborders.thread.MigrationQueueThread;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@@ -4,7 +4,9 @@ import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
|||||||
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
||||||
import net.knarcraft.bookswithoutborders.config.Permission;
|
import net.knarcraft.bookswithoutborders.config.Permission;
|
||||||
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.SaveMessage;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookFileHelper;
|
import net.knarcraft.bookswithoutborders.utility.BookFileHelper;
|
||||||
import net.knarcraft.bookswithoutborders.utility.BookHelper;
|
import net.knarcraft.bookswithoutborders.utility.BookHelper;
|
||||||
@@ -94,7 +96,7 @@ public class CommandSave implements TabExecutor {
|
|||||||
String savePath = BookHelper.getBookDirectoryPathString(saveToPublicFolder ?
|
String savePath = BookHelper.getBookDirectoryPathString(saveToPublicFolder ?
|
||||||
BookDirectory.PUBLIC : BookDirectory.PLAYER, player);
|
BookDirectory.PUBLIC : BookDirectory.PLAYER, player);
|
||||||
if (savePath == null) {
|
if (savePath == null) {
|
||||||
stringFormatter.displayErrorMessage(player, Translatable.ERROR_SAVE_INVALID_PATH);
|
stringFormatter.displayErrorMessage(player, SaveMessage.ERROR_SAVE_INVALID_PATH);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +112,7 @@ public class CommandSave implements TabExecutor {
|
|||||||
//Make sure the used folders exist
|
//Make sure the used folders exist
|
||||||
File file = new File(savePath);
|
File file = new File(savePath);
|
||||||
if (!file.exists() && !file.mkdir()) {
|
if (!file.exists() && !file.mkdir()) {
|
||||||
stringFormatter.displayErrorMessage(player, Translatable.ERROR_SAVE_FILE_SYSTEM_ERROR);
|
stringFormatter.displayErrorMessage(player, SaveMessage.ERROR_SAVE_FILE_SYSTEM_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +129,7 @@ public class CommandSave implements TabExecutor {
|
|||||||
//Update the relevant book list
|
//Update the relevant book list
|
||||||
BooksWithoutBorders.updateBooks(player, saveToPublicFolder);
|
BooksWithoutBorders.updateBooks(player, saveToPublicFolder);
|
||||||
stringFormatter.displaySuccessMessage(player,
|
stringFormatter.displaySuccessMessage(player,
|
||||||
stringFormatter.replacePlaceholder(Translatable.SUCCESS_SAVED, "{fileName}", newName));
|
stringFormatter.replacePlaceholder(SaveMessage.SUCCESS_SAVED, "{fileName}", newName));
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
BooksWithoutBorders.log(Level.SEVERE, StaticMessage.EXCEPTION_SAVE_BOOK_FAILED.toString());
|
BooksWithoutBorders.log(Level.SEVERE, StaticMessage.EXCEPTION_SAVE_BOOK_FAILED.toString());
|
||||||
}
|
}
|
||||||
@@ -162,7 +164,7 @@ public class CommandSave implements TabExecutor {
|
|||||||
StringFormatter stringFormatter = BooksWithoutBorders.getStringFormatter();
|
StringFormatter stringFormatter = BooksWithoutBorders.getStringFormatter();
|
||||||
File[] foundFiles = directory.listFiles();
|
File[] foundFiles = directory.listFiles();
|
||||||
if (foundFiles == null) {
|
if (foundFiles == null) {
|
||||||
stringFormatter.displayErrorMessage(player, Translatable.ERROR_SAVE_FILE_SYSTEM_ERROR);
|
stringFormatter.displayErrorMessage(player, SaveMessage.ERROR_SAVE_FILE_SYSTEM_ERROR);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,22 +179,22 @@ public class CommandSave implements TabExecutor {
|
|||||||
String fullCommand = "/" + command + " true";
|
String fullCommand = "/" + command + " true";
|
||||||
|
|
||||||
boolean isUnnamed = fileName.contains(stringFormatter.getUnFormattedColoredMessage(
|
boolean isUnnamed = fileName.contains(stringFormatter.getUnFormattedColoredMessage(
|
||||||
Translatable.NEUTRAL_UNKNOWN_TITLE) + separator);
|
Formatting.NEUTRAL_UNKNOWN_TITLE) + separator);
|
||||||
|
|
||||||
// Skip duplicate unnamed book saving
|
// Skip duplicate unnamed book saving
|
||||||
if (!isUnnamed && !overwrite) {
|
if (!isUnnamed && !overwrite) {
|
||||||
stringFormatter.displayErrorMessage(player, Translatable.ERROR_SAVE_DUPLICATE_NAMED);
|
stringFormatter.displayErrorMessage(player, SaveMessage.ERROR_SAVE_DUPLICATE_NAMED);
|
||||||
stringFormatter.displayErrorMessage(player, stringFormatter.replacePlaceholder(
|
stringFormatter.displayErrorMessage(player, stringFormatter.replacePlaceholder(
|
||||||
Translatable.ERROR_SAVE_OVERWRITE_REQUIRED, "{command}", fullCommand));
|
SaveMessage.ERROR_SAVE_OVERWRITE_REQUIRED, "{command}", fullCommand));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip if duplicate limit is reached
|
// Skip if duplicate limit is reached
|
||||||
if (foundDuplicates > duplicateLimit) {
|
if (foundDuplicates > duplicateLimit) {
|
||||||
stringFormatter.displayErrorMessage(player, stringFormatter.replacePlaceholder(
|
stringFormatter.displayErrorMessage(player, stringFormatter.replacePlaceholder(
|
||||||
Translatable.ERROR_SAVE_DUPLICATE_UNNAMED, "{fileName}", fileName));
|
SaveMessage.ERROR_SAVE_DUPLICATE_UNNAMED, "{fileName}", fileName));
|
||||||
stringFormatter.displayErrorMessage(player, stringFormatter.replacePlaceholder(
|
stringFormatter.displayErrorMessage(player, stringFormatter.replacePlaceholder(
|
||||||
Translatable.ERROR_SAVE_OVERWRITE_REQUIRED, "{command}", fullCommand));
|
SaveMessage.ERROR_SAVE_OVERWRITE_REQUIRED, "{command}", fullCommand));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.state.ItemSlot;
|
import net.knarcraft.bookswithoutborders.state.ItemSlot;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
@@ -40,9 +41,9 @@ public class CommandSetAuthor implements TabExecutor {
|
|||||||
|
|
||||||
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
if (InventoryHelper.notHoldingOneWrittenBookCheck(player,
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_NOT_HOLDING_WRITTEN_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_SET_AUTHOR)),
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_SET_AUTHOR)),
|
||||||
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
stringFormatter.replacePlaceholder(Translatable.ERROR_ONLY_ONE_BOOK, "{action}",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.ACTION_SET_AUTHOR)))) {
|
stringFormatter.getUnFormattedColoredMessage(Formatting.ACTION_SET_AUTHOR)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,8 @@ import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
|||||||
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
||||||
import net.knarcraft.bookswithoutborders.config.ConfigOption;
|
import net.knarcraft.bookswithoutborders.config.ConfigOption;
|
||||||
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
import net.knarcraft.bookswithoutborders.config.StaticMessage;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.CostMessage;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.manager.EconomyManager;
|
import net.knarcraft.bookswithoutborders.manager.EconomyManager;
|
||||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||||
import net.knarcraft.bookswithoutborders.utility.TabCompletionTypeHelper;
|
import net.knarcraft.bookswithoutborders.utility.TabCompletionTypeHelper;
|
||||||
@@ -41,7 +42,7 @@ public class CommandSetBookPrice implements TabExecutor {
|
|||||||
|
|
||||||
//Warn about missing arguments
|
//Warn about missing arguments
|
||||||
if (arguments.length < 2) {
|
if (arguments.length < 2) {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_COST_NOT_SPECIFIED);
|
stringFormatter.displayErrorMessage(sender, CostMessage.ERROR_COST_NOT_SPECIFIED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,11 +50,11 @@ public class CommandSetBookPrice implements TabExecutor {
|
|||||||
try {
|
try {
|
||||||
price = Double.parseDouble(arguments[1]);
|
price = Double.parseDouble(arguments[1]);
|
||||||
if (price <= 0) {
|
if (price <= 0) {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_COST_INVALID_QUANTITY);
|
stringFormatter.displayErrorMessage(sender, CostMessage.ERROR_COST_INVALID_QUANTITY);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_COST_INVALID_QUANTITY);
|
stringFormatter.displayErrorMessage(sender, CostMessage.ERROR_COST_INVALID_QUANTITY);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ public class CommandSetBookPrice implements TabExecutor {
|
|||||||
case "item" -> setItemPrice(sender, price);
|
case "item" -> setItemPrice(sender, price);
|
||||||
case "economy" -> setEconomyPrice(sender, price);
|
case "economy" -> setEconomyPrice(sender, price);
|
||||||
default -> {
|
default -> {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_COST_INVALID_TYPE);
|
stringFormatter.displayErrorMessage(sender, CostMessage.ERROR_COST_INVALID_TYPE);
|
||||||
yield false;
|
yield false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -80,7 +81,7 @@ public class CommandSetBookPrice implements TabExecutor {
|
|||||||
booksWithoutBorders.getConfig().set(ConfigOption.PRICE_QUANTITY.getConfigNode(), config.getBookPriceQuantity());
|
booksWithoutBorders.getConfig().set(ConfigOption.PRICE_QUANTITY.getConfigNode(), config.getBookPriceQuantity());
|
||||||
booksWithoutBorders.saveConfig();
|
booksWithoutBorders.saveConfig();
|
||||||
|
|
||||||
BooksWithoutBorders.getStringFormatter().displaySuccessMessage(sender, Translatable.SUCCESS_COST_REMOVED);
|
BooksWithoutBorders.getStringFormatter().displaySuccessMessage(sender, CostMessage.SUCCESS_COST_REMOVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,7 +100,7 @@ public class CommandSetBookPrice implements TabExecutor {
|
|||||||
|
|
||||||
ItemStack heldItem = InventoryHelper.getHeldItem(player, true);
|
ItemStack heldItem = InventoryHelper.getHeldItem(player, true);
|
||||||
if (heldItem.getType() == Material.AIR) {
|
if (heldItem.getType() == Material.AIR) {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_COST_ITEM_MISSING);
|
stringFormatter.displayErrorMessage(sender, CostMessage.ERROR_COST_ITEM_MISSING);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ public class CommandSetBookPrice implements TabExecutor {
|
|||||||
booksWithoutBorders.saveConfig();
|
booksWithoutBorders.saveConfig();
|
||||||
|
|
||||||
stringFormatter.displaySuccessMessage(sender, stringFormatter.replacePlaceholders(
|
stringFormatter.displaySuccessMessage(sender, stringFormatter.replacePlaceholders(
|
||||||
Translatable.SUCCESS_COST_ITEM_SET, List.of("{quantity}", "{price}"),
|
CostMessage.SUCCESS_COST_ITEM_SET, List.of("{quantity}", "{price}"),
|
||||||
List.of(String.valueOf((int) newPriceQuantity), newPriceType)));
|
List.of(String.valueOf((int) newPriceQuantity), newPriceType)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -138,7 +139,7 @@ public class CommandSetBookPrice implements TabExecutor {
|
|||||||
booksWithoutBorders.saveConfig();
|
booksWithoutBorders.saveConfig();
|
||||||
|
|
||||||
stringFormatter.displaySuccessMessage(sender, stringFormatter.replacePlaceholder(
|
stringFormatter.displaySuccessMessage(sender, stringFormatter.replacePlaceholder(
|
||||||
Translatable.SUCCESS_COST_ECONOMY_SET, "{cost}", economyManager.getEconomy().format(newPriceQuantity)));
|
CostMessage.SUCCESS_COST_ECONOMY_SET, "{cost}", economyManager.getEconomy().format(newPriceQuantity)));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, StaticMessage.EXCEPTION_VAULT_PRICE_NOT_CHANGED.toString());
|
BooksWithoutBorders.sendErrorMessage(sender, StaticMessage.EXCEPTION_VAULT_PRICE_NOT_CHANGED.toString());
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package net.knarcraft.bookswithoutborders.command;
|
package net.knarcraft.bookswithoutborders.command;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.BookshelfMessage;
|
||||||
|
import net.knarcraft.bookswithoutborders.config.translation.Translatable;
|
||||||
import net.knarcraft.bookswithoutborders.container.Bookshelf;
|
import net.knarcraft.bookswithoutborders.container.Bookshelf;
|
||||||
import net.knarcraft.bookswithoutborders.handler.BookshelfHandler;
|
import net.knarcraft.bookswithoutborders.handler.BookshelfHandler;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
@@ -35,7 +36,7 @@ public class CommandSetBookshelfData implements TabExecutor {
|
|||||||
|
|
||||||
Block targetBlock = player.getTargetBlockExact(7);
|
Block targetBlock = player.getTargetBlockExact(7);
|
||||||
if (targetBlock == null || targetBlock.getType() != Material.CHISELED_BOOKSHELF) {
|
if (targetBlock == null || targetBlock.getType() != Material.CHISELED_BOOKSHELF) {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_BOOKSHELF_NOT_FOUND);
|
stringFormatter.displayErrorMessage(sender, BookshelfMessage.ERROR_BOOKSHELF_NOT_FOUND);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,9 +48,9 @@ public class CommandSetBookshelfData implements TabExecutor {
|
|||||||
if (bookshelf != null) {
|
if (bookshelf != null) {
|
||||||
shelfHandler.unregisterBookshelf(bookshelf);
|
shelfHandler.unregisterBookshelf(bookshelf);
|
||||||
shelfHandler.save();
|
shelfHandler.save();
|
||||||
stringFormatter.displaySuccessMessage(sender, Translatable.SUCCESS_BOOKSHELF_DATA_DELETED);
|
stringFormatter.displaySuccessMessage(sender, BookshelfMessage.SUCCESS_BOOKSHELF_DATA_DELETED);
|
||||||
} else {
|
} else {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_BOOKSHELF_NOT_REGISTERED);
|
stringFormatter.displayErrorMessage(sender, BookshelfMessage.ERROR_BOOKSHELF_NOT_REGISTERED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -72,16 +73,16 @@ public class CommandSetBookshelfData implements TabExecutor {
|
|||||||
bookshelf.setTitle(builder.toString());
|
bookshelf.setTitle(builder.toString());
|
||||||
}
|
}
|
||||||
shelfHandler.save();
|
shelfHandler.save();
|
||||||
stringFormatter.displaySuccessMessage(sender, Translatable.SUCCESS_BOOKSHELF_TITLE_SET);
|
stringFormatter.displaySuccessMessage(sender, BookshelfMessage.SUCCESS_BOOKSHELF_TITLE_SET);
|
||||||
return true;
|
return true;
|
||||||
case "lore":
|
case "lore":
|
||||||
if (bookshelf == null) {
|
if (bookshelf == null) {
|
||||||
stringFormatter.displayErrorMessage(sender, Translatable.ERROR_BOOKSHELF_NAME_REQUIRED);
|
stringFormatter.displayErrorMessage(sender, BookshelfMessage.ERROR_BOOKSHELF_NAME_REQUIRED);
|
||||||
} else {
|
} else {
|
||||||
List<String> loreParts = Arrays.asList(builder.toString().split(BooksWithoutBorders.getConfiguration().getLoreSeparator()));
|
List<String> loreParts = Arrays.asList(builder.toString().split(BooksWithoutBorders.getConfiguration().getLoreSeparator()));
|
||||||
bookshelf.setLore(loreParts);
|
bookshelf.setLore(loreParts);
|
||||||
shelfHandler.save();
|
shelfHandler.save();
|
||||||
stringFormatter.displaySuccessMessage(sender, Translatable.SUCCESS_BOOKSHELF_LORE_SET);
|
stringFormatter.displaySuccessMessage(sender, BookshelfMessage.SUCCESS_BOOKSHELF_LORE_SET);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,47 @@
|
|||||||
|
package net.knarcraft.bookswithoutborders.config.translation;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.TranslatableMessage;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translatable messages related to the set bookshelf data command
|
||||||
|
*/
|
||||||
|
public enum BookshelfMessage implements TranslatableMessage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message displayed when a bookshelf's data has been successfully removed
|
||||||
|
*/
|
||||||
|
SUCCESS_BOOKSHELF_DATA_DELETED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message displayed when a bookshelf's title is successfully set
|
||||||
|
*/
|
||||||
|
SUCCESS_BOOKSHELF_TITLE_SET,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message displayed when a bookshelf's lore is successfully set
|
||||||
|
*/
|
||||||
|
SUCCESS_BOOKSHELF_LORE_SET,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when attempting to alter bookshelf data while not looking at a bookshelf
|
||||||
|
*/
|
||||||
|
ERROR_BOOKSHELF_NOT_FOUND,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when attempting to deleting a bookshelf while looking at a non-registered bookshelf
|
||||||
|
*/
|
||||||
|
ERROR_BOOKSHELF_NOT_REGISTERED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when attempting to set other bookshelf data before setting the name
|
||||||
|
*/
|
||||||
|
ERROR_BOOKSHELF_NAME_REQUIRED,
|
||||||
|
;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull TranslatableMessage[] getAllMessages() {
|
||||||
|
return Translatable.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,57 @@
|
|||||||
|
package net.knarcraft.bookswithoutborders.config.translation;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.TranslatableMessage;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Messages related to book cost
|
||||||
|
*/
|
||||||
|
public enum CostMessage implements TranslatableMessage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message displayed when the book creation cost is successfully removed
|
||||||
|
*/
|
||||||
|
SUCCESS_COST_REMOVED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message displayed when the book creation cost is successfully set to an item
|
||||||
|
*/
|
||||||
|
SUCCESS_COST_ITEM_SET,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message displayed when the book creation cost is successfully set to an economy cost
|
||||||
|
*/
|
||||||
|
SUCCESS_COST_ECONOMY_SET,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when trying to do a Vault transaction while Vault is unavailable
|
||||||
|
*/
|
||||||
|
ERROR_VAULT_COST_BUT_UNAVAILABLE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when attempting to specify a cost without necessary arguments
|
||||||
|
*/
|
||||||
|
ERROR_COST_NOT_SPECIFIED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when specifying an invalid cost quantity when setting a cost
|
||||||
|
*/
|
||||||
|
ERROR_COST_INVALID_QUANTITY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when specifying an invalid cost type when setting a cost
|
||||||
|
*/
|
||||||
|
ERROR_COST_INVALID_TYPE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when attempting to set an item cost without providing an item
|
||||||
|
*/
|
||||||
|
ERROR_COST_ITEM_MISSING,
|
||||||
|
;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull TranslatableMessage[] getAllMessages() {
|
||||||
|
return Translatable.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,107 @@
|
|||||||
|
package net.knarcraft.bookswithoutborders.config.translation;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.TranslatableMessage;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Customizable formatting
|
||||||
|
*/
|
||||||
|
public enum Formatting implements TranslatableMessage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The header displayed before printing all commands
|
||||||
|
*/
|
||||||
|
NEUTRAL_COMMANDS_HEADER,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The format used when displaying a book's economy price
|
||||||
|
*/
|
||||||
|
NEUTRAL_COMMANDS_BOOK_PRICE_ECO,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The format used when displaying a book's item price
|
||||||
|
*/
|
||||||
|
NEUTRAL_COMMANDS_BOOK_PRICE_ITEM,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The format used when displaying one command entry
|
||||||
|
*/
|
||||||
|
NEUTRAL_COMMANDS_COMMAND,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The string used when displaying that a command requires no permission
|
||||||
|
*/
|
||||||
|
NEUTRAL_COMMANDS_COMMAND_NO_PERMISSION_REQUIRED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The format used when displaying a command's required permission
|
||||||
|
*/
|
||||||
|
NEUTRAL_COMMANDS_COMMAND_PERMISSION,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The format used when printing aliases
|
||||||
|
*/
|
||||||
|
NEUTRAL_COMMANDS_ALIASES,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The translation of unknown author for a book
|
||||||
|
*/
|
||||||
|
NEUTRAL_UNKNOWN_AUTHOR,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The translation of unknown title for a book
|
||||||
|
*/
|
||||||
|
NEUTRAL_UNKNOWN_TITLE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The format used when generating a title + author title page
|
||||||
|
*/
|
||||||
|
NEUTRAL_TITLE_PAGE_TITLE_AUTHOR_FORMAT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The formatting used when formatting the header on a title page
|
||||||
|
*/
|
||||||
|
NEUTRAL_TITLE_PAGE_HEADER_FORMAT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The format used when formatting text on a title page
|
||||||
|
*/
|
||||||
|
NEUTRAL_TITLE_PAGE_TEXT_FORMAT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The translation of the copy action
|
||||||
|
*/
|
||||||
|
ACTION_COPY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The translation of the clear action
|
||||||
|
*/
|
||||||
|
ACTION_CLEAR,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The translation of the decrypt action
|
||||||
|
*/
|
||||||
|
ACTION_DECRYPT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The translation of the encrypt action
|
||||||
|
*/
|
||||||
|
ACTION_ENCRYPT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The translation of the add title page action
|
||||||
|
*/
|
||||||
|
ACTION_ADD_TITLE_AUTHOR_PAGE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The translation of the set author action
|
||||||
|
*/
|
||||||
|
ACTION_SET_AUTHOR,
|
||||||
|
;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull TranslatableMessage[] getAllMessages() {
|
||||||
|
return Translatable.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,47 @@
|
|||||||
|
package net.knarcraft.bookswithoutborders.config.translation;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.TranslatableMessage;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translatable messages related to the give command
|
||||||
|
*/
|
||||||
|
public enum GiveMessage implements TranslatableMessage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message displayed when a book is successfully sent
|
||||||
|
*/
|
||||||
|
SUCCESS_GIVE_SENT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message displayed when a book is successfully received
|
||||||
|
*/
|
||||||
|
SUCCESS_GIVE_RECEIVED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed after using the give command without specifying a recipient
|
||||||
|
*/
|
||||||
|
ERROR_GIVE_NO_RECIPIENT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when using the give command with an invalid recipient
|
||||||
|
*/
|
||||||
|
ERROR_GIVE_RECIPIENT_UNKNOWN,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when using the give command with a recipient with a full inventory
|
||||||
|
*/
|
||||||
|
ERROR_GIVE_RECIPIENT_FULL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when a book is not properly loaded when using the give command
|
||||||
|
*/
|
||||||
|
ERROR_GIVE_LOAD_FAILED,
|
||||||
|
;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull TranslatableMessage[] getAllMessages() {
|
||||||
|
return Translatable.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,47 @@
|
|||||||
|
package net.knarcraft.bookswithoutborders.config.translation;
|
||||||
|
|
||||||
|
import net.knarcraft.knarlib.formatting.TranslatableMessage;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translatable messages related to saving
|
||||||
|
*/
|
||||||
|
public enum SaveMessage implements TranslatableMessage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message displayed when a book is successfully saved
|
||||||
|
*/
|
||||||
|
SUCCESS_SAVED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when unable to generate a valid save path for a book
|
||||||
|
*/
|
||||||
|
ERROR_SAVE_INVALID_PATH,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when unable to create necessary folders for saving a book
|
||||||
|
*/
|
||||||
|
ERROR_SAVE_FILE_SYSTEM_ERROR,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when enabling overwriting is necessary to save a book
|
||||||
|
*/
|
||||||
|
ERROR_SAVE_OVERWRITE_REQUIRED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when attempting to save a duplicate unnamed book
|
||||||
|
*/
|
||||||
|
ERROR_SAVE_DUPLICATE_NAMED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error displayed when attempting to save a duplicate named book exceeding the duplicate limit
|
||||||
|
*/
|
||||||
|
ERROR_SAVE_DUPLICATE_UNNAMED,
|
||||||
|
;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull TranslatableMessage[] getAllMessages() {
|
||||||
|
return Translatable.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package net.knarcraft.bookswithoutborders.config;
|
package net.knarcraft.bookswithoutborders.config.translation;
|
||||||
|
|
||||||
import net.knarcraft.knarlib.formatting.TranslatableMessage;
|
import net.knarcraft.knarlib.formatting.TranslatableMessage;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -38,16 +38,6 @@ public enum Translatable implements TranslatableMessage {
|
|||||||
*/
|
*/
|
||||||
SUCCESS_FORMATTED,
|
SUCCESS_FORMATTED,
|
||||||
|
|
||||||
/**
|
|
||||||
* The success message displayed when a book is successfully sent
|
|
||||||
*/
|
|
||||||
SUCCESS_GIVE_SENT,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The success message displayed when a book is successfully received
|
|
||||||
*/
|
|
||||||
SUCCESS_GIVE_RECEIVED,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The success message displayed when a title page is successfully added
|
* The success message displayed when a title page is successfully added
|
||||||
*/
|
*/
|
||||||
@@ -73,46 +63,11 @@ public enum Translatable implements TranslatableMessage {
|
|||||||
*/
|
*/
|
||||||
SUCCESS_RELOADED,
|
SUCCESS_RELOADED,
|
||||||
|
|
||||||
/**
|
|
||||||
* The success message displayed when a book is successfully saved
|
|
||||||
*/
|
|
||||||
SUCCESS_SAVED,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The success message displayed when a book author is successfully set
|
* The success message displayed when a book author is successfully set
|
||||||
*/
|
*/
|
||||||
SUCCESS_SET_AUTHOR,
|
SUCCESS_SET_AUTHOR,
|
||||||
|
|
||||||
/**
|
|
||||||
* The success message displayed when the book creation cost is successfully removed
|
|
||||||
*/
|
|
||||||
SUCCESS_COST_REMOVED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The success message displayed when the book creation cost is successfully set to an item
|
|
||||||
*/
|
|
||||||
SUCCESS_COST_ITEM_SET,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The success message displayed when the book creation cost is successfully set to an economy cost
|
|
||||||
*/
|
|
||||||
SUCCESS_COST_ECONOMY_SET,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The success message displayed when a bookshelf's data has been successfully removed
|
|
||||||
*/
|
|
||||||
SUCCESS_BOOKSHELF_DATA_DELETED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The success message displayed when a bookshelf's title is successfully set
|
|
||||||
*/
|
|
||||||
SUCCESS_BOOKSHELF_TITLE_SET,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The success message displayed when a bookshelf's lore is successfully set
|
|
||||||
*/
|
|
||||||
SUCCESS_BOOKSHELF_LORE_SET,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The error to display when the console attempts to run a player-only command
|
* The error to display when the console attempts to run a player-only command
|
||||||
*/
|
*/
|
||||||
@@ -163,11 +118,6 @@ public enum Translatable implements TranslatableMessage {
|
|||||||
*/
|
*/
|
||||||
ERROR_INVENTORY_FULL,
|
ERROR_INVENTORY_FULL,
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when trying to do a Vault transaction while Vault is unavailable
|
|
||||||
*/
|
|
||||||
ERROR_VAULT_COST_BUT_UNAVAILABLE,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The error displayed when trying to decrypt a book without displaying the key
|
* The error displayed when trying to decrypt a book without displaying the key
|
||||||
*/
|
*/
|
||||||
@@ -223,31 +173,11 @@ public enum Translatable implements TranslatableMessage {
|
|||||||
*/
|
*/
|
||||||
ERROR_ENCRYPT_EMPTY,
|
ERROR_ENCRYPT_EMPTY,
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed after using the give command without specifying a recipient
|
|
||||||
*/
|
|
||||||
ERROR_GIVE_NO_RECIPIENT,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when using the give command with an invalid recipient
|
|
||||||
*/
|
|
||||||
ERROR_GIVE_RECIPIENT_UNKNOWN,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when using the give command with a recipient with a full inventory
|
|
||||||
*/
|
|
||||||
ERROR_GIVE_RECIPIENT_FULL,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The error displayed when using the give command with an invalid number of copies (unlikely to ever happen)
|
* The error displayed when using the give command with an invalid number of copies (unlikely to ever happen)
|
||||||
*/
|
*/
|
||||||
ERROR_INVALID_COPIES_AMOUNT,
|
ERROR_INVALID_COPIES_AMOUNT,
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when a book is not properly loaded when using the give command
|
|
||||||
*/
|
|
||||||
ERROR_GIVE_LOAD_FAILED,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The error displayed when running a command without holding any book in the main hand
|
* The error displayed when running a command without holding any book in the main hand
|
||||||
*/
|
*/
|
||||||
@@ -288,31 +218,6 @@ public enum Translatable implements TranslatableMessage {
|
|||||||
*/
|
*/
|
||||||
ERROR_RELOAD_FAILED,
|
ERROR_RELOAD_FAILED,
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when unable to generate a valid save path for a book
|
|
||||||
*/
|
|
||||||
ERROR_SAVE_INVALID_PATH,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when unable to create necessary folders for saving a book
|
|
||||||
*/
|
|
||||||
ERROR_SAVE_FILE_SYSTEM_ERROR,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when enabling overwriting is necessary to save a book
|
|
||||||
*/
|
|
||||||
ERROR_SAVE_OVERWRITE_REQUIRED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when attempting to save a duplicate unnamed book
|
|
||||||
*/
|
|
||||||
ERROR_SAVE_DUPLICATE_NAMED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when attempting to save a duplicate named book exceeding the duplicate limit
|
|
||||||
*/
|
|
||||||
ERROR_SAVE_DUPLICATE_UNNAMED,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The error displayed when specifying a command, but the command is unknown
|
* The error displayed when specifying a command, but the command is unknown
|
||||||
*/
|
*/
|
||||||
@@ -322,136 +227,6 @@ public enum Translatable implements TranslatableMessage {
|
|||||||
* The error displayed when changing a book's author without providing the new author
|
* The error displayed when changing a book's author without providing the new author
|
||||||
*/
|
*/
|
||||||
ERROR_AUTHOR_BLANK,
|
ERROR_AUTHOR_BLANK,
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when attempting to specify a cost without necessary arguments
|
|
||||||
*/
|
|
||||||
ERROR_COST_NOT_SPECIFIED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when specifying an invalid cost quantity when setting a cost
|
|
||||||
*/
|
|
||||||
ERROR_COST_INVALID_QUANTITY,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when specifying an invalid cost type when setting a cost
|
|
||||||
*/
|
|
||||||
ERROR_COST_INVALID_TYPE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when attempting to set an item cost without providing an item
|
|
||||||
*/
|
|
||||||
ERROR_COST_ITEM_MISSING,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when attempting to alter bookshelf data while not looking at a bookshelf
|
|
||||||
*/
|
|
||||||
ERROR_BOOKSHELF_NOT_FOUND,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when attempting to deleting a bookshelf while looking at a non-registered bookshelf
|
|
||||||
*/
|
|
||||||
ERROR_BOOKSHELF_NOT_REGISTERED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error displayed when attempting to set other bookshelf data before setting the name
|
|
||||||
*/
|
|
||||||
ERROR_BOOKSHELF_NAME_REQUIRED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The header displayed before printing all commands
|
|
||||||
*/
|
|
||||||
NEUTRAL_COMMANDS_HEADER,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The format used when displaying a book's economy price
|
|
||||||
*/
|
|
||||||
NEUTRAL_COMMANDS_BOOK_PRICE_ECO,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The format used when displaying a book's item price
|
|
||||||
*/
|
|
||||||
NEUTRAL_COMMANDS_BOOK_PRICE_ITEM,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The format used when displaying one command entry
|
|
||||||
*/
|
|
||||||
NEUTRAL_COMMANDS_COMMAND,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The string used when displaying that a command requires no permission
|
|
||||||
*/
|
|
||||||
NEUTRAL_COMMANDS_COMMAND_NO_PERMISSION_REQUIRED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The format used when displaying a command's required permission
|
|
||||||
*/
|
|
||||||
NEUTRAL_COMMANDS_COMMAND_PERMISSION,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The format used when printing aliases
|
|
||||||
*/
|
|
||||||
NEUTRAL_COMMANDS_ALIASES,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation of unknown author for a book
|
|
||||||
*/
|
|
||||||
NEUTRAL_UNKNOWN_AUTHOR,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation of unknown title for a book
|
|
||||||
*/
|
|
||||||
NEUTRAL_UNKNOWN_TITLE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The format used when generating a title + author title page
|
|
||||||
*/
|
|
||||||
NEUTRAL_TITLE_PAGE_TITLE_AUTHOR_FORMAT,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The formatting used when formatting the header on a title page
|
|
||||||
*/
|
|
||||||
NEUTRAL_TITLE_PAGE_HEADER_FORMAT,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The format used when formatting text on a title page
|
|
||||||
*/
|
|
||||||
NEUTRAL_TITLE_PAGE_TEXT_FORMAT,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation of the copy action
|
|
||||||
*/
|
|
||||||
ACTION_COPY,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation of the clear action
|
|
||||||
*/
|
|
||||||
ACTION_CLEAR,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation of the decrypt action
|
|
||||||
*/
|
|
||||||
ACTION_DECRYPT,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation of the encrypt action
|
|
||||||
*/
|
|
||||||
ACTION_ENCRYPT,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation of the format action
|
|
||||||
*/
|
|
||||||
ACTION_FORMAT,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation of the add title page action
|
|
||||||
*/
|
|
||||||
ACTION_ADD_TITLE_AUTHOR_PAGE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation of the set author action
|
|
||||||
*/
|
|
||||||
ACTION_SET_AUTHOR,
|
|
||||||
;
|
;
|
||||||
|
|
||||||
@Override
|
@Override
|
@@ -2,7 +2,7 @@ package net.knarcraft.bookswithoutborders.manager;
|
|||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.CostMessage;
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -167,7 +167,7 @@ public class EconomyManager {
|
|||||||
*/
|
*/
|
||||||
private boolean payForBookPrintingEconomy(@NotNull Player player, double cost, int numCopies) {
|
private boolean payForBookPrintingEconomy(@NotNull Player player, double cost, int numCopies) {
|
||||||
if (economy == null) {
|
if (economy == null) {
|
||||||
BooksWithoutBorders.getStringFormatter().displayErrorMessage(player, Translatable.ERROR_VAULT_COST_BUT_UNAVAILABLE);
|
BooksWithoutBorders.getStringFormatter().displayErrorMessage(player, CostMessage.ERROR_VAULT_COST_BUT_UNAVAILABLE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package net.knarcraft.bookswithoutborders.utility;
|
package net.knarcraft.bookswithoutborders.utility;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -216,7 +216,7 @@ public final class BookFileHelper {
|
|||||||
if (stripped.contains(separator)) {
|
if (stripped.contains(separator)) {
|
||||||
return stripped.split(separator)[1];
|
return stripped.split(separator)[1];
|
||||||
} else {
|
} else {
|
||||||
return BooksWithoutBorders.getStringFormatter().getUnFormattedColoredMessage(Translatable.NEUTRAL_UNKNOWN_AUTHOR);
|
return BooksWithoutBorders.getStringFormatter().getUnFormattedColoredMessage(Formatting.NEUTRAL_UNKNOWN_AUTHOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@ package net.knarcraft.bookswithoutborders.utility;
|
|||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
import net.knarcraft.bookswithoutborders.config.BwBConfig;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -193,7 +193,7 @@ public final class BookHelper {
|
|||||||
} else {
|
} else {
|
||||||
authorName = book.getAuthor();
|
authorName = book.getAuthor();
|
||||||
if (authorName == null) {
|
if (authorName == null) {
|
||||||
authorName = BooksWithoutBorders.getStringFormatter().getUnFormattedColoredMessage(Translatable.NEUTRAL_UNKNOWN_AUTHOR);
|
authorName = BooksWithoutBorders.getStringFormatter().getUnFormattedColoredMessage(Formatting.NEUTRAL_UNKNOWN_AUTHOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return authorName;
|
return authorName;
|
||||||
@@ -211,7 +211,7 @@ public final class BookHelper {
|
|||||||
bookName = book.getTitle();
|
bookName = book.getTitle();
|
||||||
}
|
}
|
||||||
if (bookName == null) {
|
if (bookName == null) {
|
||||||
bookName = BooksWithoutBorders.getStringFormatter().getUnFormattedColoredMessage(Translatable.NEUTRAL_UNKNOWN_TITLE);
|
bookName = BooksWithoutBorders.getStringFormatter().getUnFormattedColoredMessage(Formatting.NEUTRAL_UNKNOWN_TITLE);
|
||||||
}
|
}
|
||||||
return bookName;
|
return bookName;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package net.knarcraft.bookswithoutborders.utility;
|
package net.knarcraft.bookswithoutborders.utility;
|
||||||
|
|
||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.Translatable;
|
import net.knarcraft.bookswithoutborders.config.translation.Formatting;
|
||||||
import net.knarcraft.bookswithoutborders.encryption.AESConfiguration;
|
import net.knarcraft.bookswithoutborders.encryption.AESConfiguration;
|
||||||
import net.knarcraft.bookswithoutborders.encryption.EncryptionStyle;
|
import net.knarcraft.bookswithoutborders.encryption.EncryptionStyle;
|
||||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||||
@@ -207,9 +207,9 @@ public final class BookToFromTextHelper {
|
|||||||
|
|
||||||
bookMetadata.setGeneration(BookMeta.Generation.valueOf(bookYml.getString("Generation", "ORIGINAL")));
|
bookMetadata.setGeneration(BookMeta.Generation.valueOf(bookYml.getString("Generation", "ORIGINAL")));
|
||||||
bookMetadata.setTitle(bookYml.getString("Title",
|
bookMetadata.setTitle(bookYml.getString("Title",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.NEUTRAL_UNKNOWN_TITLE)));
|
stringFormatter.getUnFormattedColoredMessage(Formatting.NEUTRAL_UNKNOWN_TITLE)));
|
||||||
bookMetadata.setAuthor(authorFromUUID(bookYml.getString("Author",
|
bookMetadata.setAuthor(authorFromUUID(bookYml.getString("Author",
|
||||||
stringFormatter.getUnFormattedColoredMessage(Translatable.NEUTRAL_UNKNOWN_AUTHOR))));
|
stringFormatter.getUnFormattedColoredMessage(Formatting.NEUTRAL_UNKNOWN_AUTHOR))));
|
||||||
bookMetadata.setPages(bookYml.getStringList("Pages"));
|
bookMetadata.setPages(bookYml.getStringList("Pages"));
|
||||||
bookMetadata.setLore(bookYml.getStringList("Lore"));
|
bookMetadata.setLore(bookYml.getStringList("Lore"));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
@@ -55,6 +55,8 @@ commands:
|
|||||||
Encrypts book so that only players with the bookswithoutborders.decrypt.<groupName> permission may decrypt the
|
Encrypts book so that only players with the bookswithoutborders.decrypt.<groupName> permission may decrypt the
|
||||||
book by holding and interacting with the book in their hand. The key isn't necessary for decryption, it's only
|
book by holding and interacting with the book in their hand. The key isn't necessary for decryption, it's only
|
||||||
used for properly scrambling the book's contents.
|
used for properly scrambling the book's contents.
|
||||||
|
"style" is not required. Possible values are "dna", "substitution", "aes", "onetimepad" and "magic".
|
||||||
|
If real encryption is enabled, possible methods are restricted.
|
||||||
aliases:
|
aliases:
|
||||||
- bwbgencrypt
|
- bwbgencrypt
|
||||||
usage: /<command> <group name> <key> [encryption style]
|
usage: /<command> <group name> <key> [encryption style]
|
||||||
|
@@ -25,7 +25,6 @@ en:
|
|||||||
ACTION_CLEAR: "clear"
|
ACTION_CLEAR: "clear"
|
||||||
ACTION_DECRYPT: "decrypt"
|
ACTION_DECRYPT: "decrypt"
|
||||||
ACTION_ENCRYPT: "encrypt"
|
ACTION_ENCRYPT: "encrypt"
|
||||||
ACTION_FORMAT: "format"
|
|
||||||
ACTION_ADD_TITLE_AUTHOR_PAGE: "add an author title page to"
|
ACTION_ADD_TITLE_AUTHOR_PAGE: "add an author title page to"
|
||||||
ACTION_SET_AUTHOR: "set author"
|
ACTION_SET_AUTHOR: "set author"
|
||||||
ERROR_PLAYER_ONLY: "This command can only be used by a player!"
|
ERROR_PLAYER_ONLY: "This command can only be used by a player!"
|
||||||
|
Reference in New Issue
Block a user