Skip to content

Commit

Permalink
Fix bug in baltop and in ecoadmin
Browse files Browse the repository at this point in the history
  • Loading branch information
AppleDash committed Aug 26, 2017
1 parent 5ac6ba1 commit 1f0df59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ public void onCommand(CommandSender sender, String[] args) throws CommandExcepti
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)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void onCommand(CommandSender sender, String[] args) throws CommandExcepti

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;
}
Expand Down Expand Up @@ -117,7 +117,7 @@ public void onCommand(CommandSender sender, String[] args) throws CommandExcepti
// 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
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void doBuy(SignShop shop, Player player) {
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
Expand Down Expand Up @@ -138,7 +138,7 @@ private void doSell(SignShop shop, Player player) { // TODO: Selling enchanted i
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)));
}

}

0 comments on commit 1f0df59

Please sign in to comment.