Updates KnarLib, and removes unnecessary String.valueOf calls
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -125,7 +125,7 @@
|
||||
<dependency>
|
||||
<groupId>net.knarcraft</groupId>
|
||||
<artifactId>knarlib</artifactId>
|
||||
<version>1.2.14-SNAPSHOT</version>
|
||||
<version>1.2.15-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@@ -88,7 +88,7 @@ public class CommandBooksWithoutBorders implements TabExecutor {
|
||||
double bookPriceQuantity = config.getBookPriceQuantity();
|
||||
if (bookPriceType != Material.AIR) {
|
||||
return new FormatBuilder(Formatting.NEUTRAL_COMMANDS_BOOK_PRICE_ITEM).replace(Placeholder.QUANTITY,
|
||||
String.valueOf((int) bookPriceQuantity)).replace(Placeholder.TYPE, bookPriceType.toString()).toString();
|
||||
(int) bookPriceQuantity).replace(Placeholder.TYPE, bookPriceType).toString();
|
||||
} else {
|
||||
EconomyManager economyManager = BooksWithoutBorders.getConfiguration().getEconomyManager();
|
||||
if (economyManager.getEconomy() == null) {
|
||||
@@ -163,7 +163,7 @@ public class CommandBooksWithoutBorders implements TabExecutor {
|
||||
commandUsage = pluginCommand.getUsage().replace("<command>", pluginCommand.getName());
|
||||
description = pluginCommand.getDescription();
|
||||
aliases = new FormatBuilder(Formatting.NEUTRAL_COMMANDS_ALIASES).replace(Placeholder.ALIASES,
|
||||
String.join(",", pluginCommand.getAliases())).toString();
|
||||
pluginCommand.getAliases()).toString();
|
||||
}
|
||||
|
||||
String commandDescription = new FormatBuilder(Formatting.NEUTRAL_COMMANDS_COMMAND).replace(Placeholder.USAGE,
|
||||
|
@@ -168,15 +168,15 @@ public class CommandEditConfig implements TabExecutor {
|
||||
FileConfiguration configuration = BooksWithoutBorders.getInstance().getConfig();
|
||||
if (option == ConfigOption.PRICE_QUANTITY || option == ConfigOption.PRICE_ITEM_TYPE) {
|
||||
new FormatBuilder(Translatable.SUCCESS_CONFIGURATION_PRICE_CURRENT_VALUE).
|
||||
replace(Placeholder.QUANTITY, String.valueOf(configuration.getDouble(ConfigOption.PRICE_QUANTITY.getConfigNode()))).
|
||||
replace(Placeholder.QUANTITY, configuration.getDouble(ConfigOption.PRICE_QUANTITY.getConfigNode())).
|
||||
replace(Placeholder.TYPE, configuration.getString(ConfigOption.PRICE_ITEM_TYPE.getConfigNode(), "")).
|
||||
replace(Placeholder.DEFAULT_COST, String.valueOf(ConfigOption.PRICE_ITEM_TYPE.getDefaultValue())).
|
||||
replace(Placeholder.DEFAULT_QUANTITY, String.valueOf(ConfigOption.PRICE_QUANTITY.getDefaultValue())).success(sender);
|
||||
replace(Placeholder.DEFAULT_COST, ConfigOption.PRICE_ITEM_TYPE.getDefaultValue()).
|
||||
replace(Placeholder.DEFAULT_QUANTITY, ConfigOption.PRICE_QUANTITY.getDefaultValue()).success(sender);
|
||||
} else {
|
||||
String node = option.getConfigNode();
|
||||
new FormatBuilder(Translatable.SUCCESS_CONFIGURATION_CURRENT_VALUE).replace(Placeholder.OPTION, node).
|
||||
replace(Placeholder.VALUE, String.valueOf(configuration.get(node))).
|
||||
replace(Placeholder.DEFAULT, String.valueOf(option.getDefaultValue())).success(sender);
|
||||
replace(Placeholder.VALUE, configuration.get(node, "")).
|
||||
replace(Placeholder.DEFAULT, option.getDefaultValue()).success(sender);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ public class CommandEditConfig implements TabExecutor {
|
||||
updateValueAndReload(ConfigOption.PRICE_ITEM_TYPE, heldItem.getType(), false);
|
||||
updateValueAndReload(ConfigOption.PRICE_QUANTITY, price, true);
|
||||
new FormatBuilder(CostMessage.SUCCESS_COST_ITEM_SET).replace(Placeholder.QUANTITY,
|
||||
String.valueOf((int) price)).replace(Placeholder.COST, heldItem.getType().toString()).success(sender);
|
||||
(int) price).replace(Placeholder.COST, heldItem.getType().toString()).success(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -86,7 +86,7 @@ public abstract class BookIndex {
|
||||
protected static void displayTotalPages(@NotNull ComponentBuilder componentBuilder, @NotNull String command,
|
||||
int page, int totalPages) {
|
||||
String pageDisplay = new FormatBuilder(Formatting.NEUTRAL_BOOK_LIST_TOTAL_PAGES).replace(Placeholder.CURRENT,
|
||||
String.valueOf(page)).replace(Placeholder.TOTAL, String.valueOf(totalPages)).color().toString();
|
||||
page).replace(Placeholder.TOTAL, totalPages).color().toString();
|
||||
componentBuilder.append(pageDisplay,
|
||||
ComponentBuilder.FormatRetention.NONE).color(interactColor).event(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT, new Text("/" + command + " page" + page))).event(
|
||||
@@ -133,7 +133,7 @@ public abstract class BookIndex {
|
||||
if (page > 1) {
|
||||
String fullCommand = "/" + command + " page" + (page - 1);
|
||||
HoverEvent prevPagePreview = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
|
||||
new FormatBuilder(Formatting.NEUTRAL_BOOK_LIST_TO_PAGE).replace(Placeholder.PAGE, String.valueOf(page - 1)).color().toString()));
|
||||
new FormatBuilder(Formatting.NEUTRAL_BOOK_LIST_TO_PAGE).replace(Placeholder.PAGE, page - 1).color().toString()));
|
||||
ClickEvent prevPageClick = new ClickEvent(ClickEvent.Action.RUN_COMMAND, fullCommand);
|
||||
componentBuilder.append(previousPage, ComponentBuilder.FormatRetention.NONE).color(interactColor).
|
||||
event(prevPagePreview).event(prevPageClick);
|
||||
@@ -156,7 +156,7 @@ public abstract class BookIndex {
|
||||
if (page < totalPages) {
|
||||
String fullCommand = "/" + command + " page" + (page + 1);
|
||||
HoverEvent nextPagePreview = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
|
||||
new FormatBuilder(Formatting.NEUTRAL_BOOK_LIST_TO_PAGE).replace(Placeholder.PAGE, String.valueOf(page + 1)).color().toString()));
|
||||
new FormatBuilder(Formatting.NEUTRAL_BOOK_LIST_TO_PAGE).replace(Placeholder.PAGE, page + 1).color().toString()));
|
||||
ClickEvent nextPageClick = new ClickEvent(ClickEvent.Action.RUN_COMMAND, fullCommand);
|
||||
componentBuilder.append(nextPage, ComponentBuilder.FormatRetention.NONE).color(interactColor)
|
||||
.event(nextPagePreview).event(nextPageClick);
|
||||
|
@@ -107,7 +107,7 @@ public class PagedBookIndex extends BookIndex {
|
||||
new Text(new FormatBuilder(Formatting.NEUTRAL_BOOK_LIST_AUTHOR_HOVER).replace(Placeholder.AUTHOR, InputCleaningUtil.stripColor(author)).color().toString()));
|
||||
|
||||
componentBuilder.append(new FormatBuilder(Formatting.NEUTRAL_BOOK_LIST_BOOK_INDEX_NUMBER).replace(Placeholder.INDEX,
|
||||
String.valueOf(bookIndex + 1)).color().toString()).color(interactColor).event(indexClick).event(indexHover);
|
||||
bookIndex + 1).color().toString()).color(interactColor).event(indexClick).event(indexHover);
|
||||
componentBuilder.append(" ", ComponentBuilder.FormatRetention.NONE);
|
||||
componentBuilder.append(title).color(ChatColor.WHITE).event(pathClick).event(pathHover);
|
||||
componentBuilder.append(new FormatBuilder(Formatting.NEUTRAL_BOOK_LIST_AUTHOR_SEPARATOR).color().toString(),
|
||||
|
@@ -126,7 +126,7 @@ public class BookshelfListener implements Listener {
|
||||
builder.append(new FormatBuilder(Formatting.NEUTRAL_BOOKSHELF_HEADER_BOTTOM));
|
||||
}
|
||||
|
||||
builder.append(new FormatBuilder(Formatting.NEUTRAL_BOOKSHELF_ENTRY_INDEX).replace(Placeholder.INDEX, String.valueOf(index)));
|
||||
builder.append(new FormatBuilder(Formatting.NEUTRAL_BOOKSHELF_ENTRY_INDEX).replace(Placeholder.INDEX, index));
|
||||
|
||||
ItemStack itemStack = bookshelfInventory.getItem(counter);
|
||||
if (itemStack == null) {
|
||||
|
@@ -85,7 +85,7 @@ public class EconomyManager {
|
||||
return false;
|
||||
} else {
|
||||
new FormatBuilder(CostMessage.ERROR_COST_INSUFFICIENT_AMOUNT).replace(Placeholder.COST,
|
||||
String.valueOf(itemCost)).replace(Placeholder.CURRENCY, bookCurrency.toString()).error(player);
|
||||
itemCost).replace(Placeholder.CURRENCY, bookCurrency.toString()).error(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class EconomyManager {
|
||||
List<ItemStack> books = getPlayersEmptyBooks(player);
|
||||
if (countItems(books) < itemCost) {
|
||||
new FormatBuilder(CostMessage.ERROR_COST_INSUFFICIENT_WRITABLE_BOOK).
|
||||
replace(Placeholder.COST, String.valueOf(itemCost)).error(player);
|
||||
replace(Placeholder.COST, itemCost).error(player);
|
||||
return false;
|
||||
} else {
|
||||
int clearedAmount = 0;
|
||||
@@ -175,11 +175,12 @@ public class EconomyManager {
|
||||
if ((economy.getBalance(player) - cost) >= 0) {
|
||||
economy.withdrawPlayer(player, cost);
|
||||
new FormatBuilder(CostMessage.SUCCESS_COST_PAID).replace(Placeholder.COST, economy.format(cost)).
|
||||
replace(Placeholder.COPIES, String.valueOf(numCopies)).
|
||||
replace(Placeholder.BALANCE, economy.format(economy.getBalance(player))).success(player);
|
||||
replace(Placeholder.COPIES, numCopies).replace(Placeholder.BALANCE, economy.
|
||||
format(economy.getBalance(player))).success(player);
|
||||
return true;
|
||||
} else {
|
||||
new FormatBuilder(CostMessage.ERROR_COST_INSUFFICIENT_ECONOMY).replace(Placeholder.COST, economy.format(cost)).error(player);
|
||||
new FormatBuilder(CostMessage.ERROR_COST_INSUFFICIENT_ECONOMY).
|
||||
replace(Placeholder.COST, economy.format(cost)).error(player);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
*/
|
||||
public final class EncryptionUtil {
|
||||
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
private static final byte[] HEX_ARRAY = "0123456789ABCDEF".getBytes(StandardCharsets.US_ASCII);
|
||||
|
||||
private EncryptionUtil() {
|
||||
|
@@ -6,6 +6,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public class AESTest {
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user