Untitled
unknown
plain_text
a year ago
1.4 kB
19
Indexable
@Usage
@Async
public void addCurrency(final BukkitSource source, final OfflinePlayer player, @Optional Currency currency, final BigDecimal amount, @Optional @Switch("boosted") final boolean boosted, @Optional @Switch("silent") final boolean silent) {
if (player == null) {
return;
}
final CommandsModule commandsModule = moduleManager.getModule(CommandsModule.class);
if (currency == null) {
currency = commandsModule.getCoreModule().getConfig().getDefaultCurrency();
}
BigDecimal boostAmount = null;
if (boosted) {
final LegacyModule legacyModule = moduleManager.getModule(LegacyModule.class);
boostAmount = legacyModule != null ? legacyModule.getBoosterManager().getBoostAmount(currency, player.getUniqueId()) : null;
}
commandsModule.getCoreModule().getTransactionManager().addBalance(player.getUniqueId(), currency, amount, boostAmount);
if(!silent) {
source.reply(ComponentUtil.deserialize(commandsModule.getConfig().getCurrencyAddMessage(), player,
"%target%", player.getName(),
"%currency%", currency.getName(),
"%amount%", NumberAbbreviator.format(amount)));
}
}Editor is loading...
Leave a Comment