mirror of
https://github.com/AppleDash/SaneEconomy.git
synced 2024-11-22 18:16:11 +01:00
Fix more paging weirdness and bump version to 0.9.2
This commit is contained in:
parent
2442261496
commit
d825c54238
@ -6,10 +6,10 @@
|
||||
<parent>
|
||||
<groupId>org.appledash</groupId>
|
||||
<artifactId>SaneEconomy</artifactId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<version>0.9.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>SaneEconomyCore</artifactId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<version>0.9.2-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -44,10 +44,7 @@ public class BalanceTopCommand extends SaneEconomyCommand {
|
||||
if (args.length == 1) {
|
||||
try {
|
||||
int page = Math.abs(Integer.parseInt(args[0]));
|
||||
if (page > 1) {
|
||||
page--;
|
||||
}
|
||||
offset = 10 * page;
|
||||
offset = 10 * (page - 1);
|
||||
} catch (NumberFormatException e) {
|
||||
MessageUtils.sendMessage(sender, "%s is not a valid number.");
|
||||
return;
|
||||
@ -55,9 +52,15 @@ public class BalanceTopCommand extends SaneEconomyCommand {
|
||||
}
|
||||
|
||||
Map<OfflinePlayer, Double> topBalances = saneEconomy.getEconomyManager().getTopPlayerBalances(10, offset);
|
||||
|
||||
if (topBalances.isEmpty()) {
|
||||
MessageUtils.sendMessage(sender, "There aren't enough players to display that page.");
|
||||
return;
|
||||
}
|
||||
|
||||
AtomicInteger index = new AtomicInteger(1); /* I know it's stupid, but you can't do some_int++ from within the lambda. */
|
||||
|
||||
MessageUtils.sendMessage(sender, "Top %d players (page %s):", topBalances.size(), args.length == 1 ? args[0] : "1");
|
||||
MessageUtils.sendMessage(sender, "Top %d players (page %s):", topBalances.size(), (args.length == 1) ? args[0] : "1");
|
||||
topBalances.forEach((player, balance) -> MessageUtils.sendMessage(sender, "[%02d] %s - %s", index.getAndIncrement(), player.getName(), SaneEconomy.getInstance().getEconomyManager().getCurrency().formatAmount(balance)));
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>SaneEconomy</artifactId>
|
||||
<groupId>org.appledash</groupId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<version>0.9.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>org.appledash</groupId>
|
||||
<artifactId>SaneEconomyCore</artifactId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<version>0.9.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user