Fix bug in baltop and in ecoadmin

This commit is contained in:
AppleDash 2017-08-26 01:16:29 -04:00
parent 5ac6ba1407
commit 1f0df591fd
3 changed files with 5 additions and 5 deletions

View File

@ -65,6 +65,6 @@ public class BalanceTopCommand extends SaneCommand {
AtomicInteger index = new AtomicInteger(offset + 1); /* I know it's stupid, but you can't do some_int++ from within the lambda. */
this.saneEconomy.getMessenger().sendMessage(sender, "Top {1} players on page {2}:", topBalances.size(), page);
topBalances.forEach((player, balance) -> this.saneEconomy.getMessenger().sendMessage(sender, "[{1:02d}] {2} - {3}", index.getAndIncrement(), player.getName(), this.saneEconomy.getEconomyManager().getCurrency().formatAmount(balance)));
topBalances.forEach((player, balance) -> this.saneEconomy.getMessenger().sendMessage(sender, "[{1:02d}] {2} - {3}", index.getAndIncrement(), player == null ? "<unknown>" : player.getName(), this.saneEconomy.getEconomyManager().getCurrency().formatAmount(balance)));
}
}

View File

@ -75,7 +75,7 @@ public class EconomyAdminCommand extends SaneCommand {
double amount = NumberUtils.parseAndFilter(ecoMan.getCurrency(), sAmount);
if (amount <= 0) {
if (!(subCommand.equalsIgnoreCase("set") && amount == 0) && amount <= 0) { // If they're setting it to 0 it's fine, otherwise reject numbers under 1.
this.saneEconomy.getMessenger().sendMessage(sender, "{1} is not a positive number.", ((amount == -1) ? sAmount : String.valueOf(amount)));
return;
}
@ -117,7 +117,7 @@ public class EconomyAdminCommand extends SaneCommand {
// FIXME: This is a silly hack to get it to log.
if (oldBal > 0.0) {
logger.logTransaction(new Transaction(
economable, Economable.CONSOLE, oldBal, TransactionReason.ADMIN_GIVE
economable, Economable.CONSOLE, oldBal, TransactionReason.ADMIN_TAKE
));
}

View File

@ -108,7 +108,7 @@ public class InteractListener implements Listener {
player.getInventory().addItem(stack);
this.plugin.getMessenger().sendMessage(player, "You have bought {1} {2} for {3}.", quantity, shop.getItemStack().getType().name(), ecoMan.getCurrency().formatAmount(shopTransaction.getPrice()));
LOGGER.info(String.format("%s just bought %s for %s.", player.getName(), shop.getItemStack(), ecoMan.getCurrency().formatAmount(shopTransaction.getPrice())));
LOGGER.info(String.format("%s just bought %d %s for %s.", player.getName(), quantity, shop.getItemStack().getType().name(), ecoMan.getCurrency().formatAmount(shopTransaction.getPrice())));
}
private void doSell(SignShop shop, Player player) { // TODO: Selling enchanted items
@ -138,7 +138,7 @@ public class InteractListener implements Listener {
ecoMan.transact(shopTransaction.makeEconomyTransaction());
this.plugin.getMessenger().sendMessage(player, "You have sold {1} {2} for {3}.", quantity, shop.getItemStack().getType().name(), ecoMan.getCurrency().formatAmount(price));
LOGGER.info(String.format("%s just sold %s for %s.", player.getName(), shop.getItemStack(), ecoMan.getCurrency().formatAmount(price)));
LOGGER.info(String.format("%s just sold %d %s for %s.", player.getName(), quantity, shop.getItemStack().getType().name(), ecoMan.getCurrency().formatAmount(price)));
}
}