Java Code Examples for org.spongepowered.api.service.economy.Currency#getDisplayName()

The following examples show how to use org.spongepowered.api.service.economy.Currency#getDisplayName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VirtualBalanceCommand.java    From EconomyLite with MIT License 6 votes vote down vote up
@Override
public void run(CommandSource src, CommandContext args) {
    Currency currency = currencyService.getCurrentCurrency();
    if (args.getOne("account").isPresent()) {
        if (src.hasPermission("economylite.admin.virtualbalance")) {
            String target = args.<String>getOne("account").get();
            Optional<Account> aOpt = EconomyLite.getEconomyService().getOrCreateAccount(target);
            if (aOpt.isPresent()) {
                BigDecimal bal = aOpt.get().getBalance(currency);
                Text label = currency.getPluralDisplayName();
                if (bal.equals(BigDecimal.ONE)) {
                    label = currency.getDisplayName();
                }
                src.sendMessage(messageStorage.getMessage("command.balanceother", "player", aOpt.get().getDisplayName().toPlain(), "balance",
                        String.format(Locale.ENGLISH, "%,.2f", bal), "label", label.toPlain()));
            } else {
                src.sendMessage(messageStorage.getMessage("command.error"));
            }
        } else {
            src.sendMessage(messageStorage.getMessage("command.noperm"));
        }
    } else {
        src.sendMessage(messageStorage.getMessage("command.error"));
    }
}
 
Example 2
Source File: LoanListener.java    From EconomyLite with MIT License 5 votes vote down vote up
private String getPrefix(double amnt, Currency cur) {
    Text label = cur.getPluralDisplayName();
    if (amnt == 1.0) {
        label = cur.getDisplayName();
    }
    return TextSerializers.FORMATTING_CODE.serialize(label);
}
 
Example 3
Source File: LoanTakeCommand.java    From EconomyLite with MIT License 5 votes vote down vote up
private String getPrefix(double amnt, Currency cur) {
    Text label = cur.getPluralDisplayName();
    if (amnt == 1.0) {
        label = cur.getDisplayName();
    }
    return TextSerializers.FORMATTING_CODE.serialize(label);
}
 
Example 4
Source File: LoanPayCommand.java    From EconomyLite with MIT License 5 votes vote down vote up
private String getPrefix(double amnt, Currency cur) {
    Text label = cur.getPluralDisplayName();
    if (amnt == 1.0) {
        label = cur.getDisplayName();
    }
    return TextSerializers.FORMATTING_CODE.serialize(label);
}
 
Example 5
Source File: LoanBalanceCommand.java    From EconomyLite with MIT License 5 votes vote down vote up
private String getPrefix(double amnt, Currency cur) {
    Text label = cur.getPluralDisplayName();
    if (amnt == 1.0) {
        label = cur.getDisplayName();
    }
    return TextSerializers.FORMATTING_CODE.serialize(label);
}