use of com.henryfabio.minecraft.inventoryapi.item.supplier.InventoryItemSupplier in project NextEconomy by NextPlugins.
the class HistoricBankView method createPageItems.
@Override
protected List<InventoryItemSupplier> createPageItems(PagedViewer viewer) {
val player = viewer.getPlayer();
val account = accountStorage.findAccount(player);
List<InventoryItemSupplier> items = new LinkedList<>();
for (AccountBankHistoric transaction : account.getTransactions()) {
items.add(() -> {
val targetName = transaction.getTarget();
val date = DateFormatUtil.of(transaction.getMilli());
val transactionMessage = (transaction.getType() == TransactionType.WITHDRAW ? InventoryValue.get(InventoryValue::withdrawMessage) : InventoryValue.get(InventoryValue::depositMessage)).replace("@target", targetName);
val item = InventoryButton.builder().materialData(new MaterialData(Material.AIR)).displayName(InventoryValue.get(InventoryValue::historicDisplayName).replace("@message", transactionMessage)).nickname(InventoryValue.get(InventoryValue::historicSkullName)).lore(InventoryValue.get(InventoryValue::historicLore).stream().map(line -> line.replace("@target", targetName).replace("@date", date).replace("@action", transaction.getType().getMessage()).replace("@message", transactionMessage).replace("@amount", NumberUtils.format(transaction.getAmount()))).collect(Collectors.toList())).build();
String target = transaction.getTarget();
if (target.equalsIgnoreCase("Banco"))
target = "MrSnowDK";
if (target.equalsIgnoreCase("Cheque"))
target = "Tom25W";
return InventoryItem.of(item.getItemStack(target));
});
}
return items;
}
Aggregations