From 5d61a43fe181f0f8fb43d1e445fd3d8b5ae45a54 Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Fri, 25 Sep 2020 22:16:12 -0400 Subject: [PATCH] Add balanceTopLine i18n translation string (#3626) --- .../essentials/commands/Commandbalancetop.java | 2 +- .../essentials/textreader/TextPager.java | 18 +++++++++--------- Essentials/src/messages.properties | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java index def927c93..1344b679f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java @@ -117,7 +117,7 @@ public class Commandbalancetop extends EssentialsCommand { cache.getLines().add(tl("serverTotal", NumberUtil.displayCurrency(totalMoney, ess))); int pos = 1; for (Map.Entry entry : sortedEntries) { - cache.getLines().add(pos + ". " + entry.getKey() + ", " + NumberUtil.displayCurrency(entry.getValue(), ess)); + cache.getLines().add(tl("balanceTopLine", pos, entry.getKey(), NumberUtil.displayCurrency(entry.getValue(), ess))); pos++; } cacheage = System.currentTimeMillis(); diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java index 408698fcb..901c937f2 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java @@ -51,13 +51,14 @@ public class TextPager { return; } else { int page = 1; - try { - page = Integer.parseInt(pageStr); - } catch (NumberFormatException ex) { - page = 1; - } - if (page < 1) { - page = 1; + if (pageStr != null) { + try { + page = Integer.parseInt(pageStr); + } catch (NumberFormatException ignored) { + } + if (page < 1) { + page = 1; + } } int start = onePage ? 0 : (page - 1) * 9; @@ -101,8 +102,7 @@ public class TextPager { if (chapterPageStr != null) { try { chapterpage = Integer.parseInt(chapterPageStr) - 1; - } catch (NumberFormatException ex) { - chapterpage = 0; + } catch (NumberFormatException ignored) { } if (chapterpage < 0) { chapterpage = 0; diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 2f818e18c..314a6c3f2 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -42,6 +42,7 @@ balanceCommandDescription=States the current balance of a player. balanceCommandUsage=/ [player] balanceOther=\u00a7aBalance of {0}\u00a7a\:\u00a7c {1} balanceTop=\u00a76Top balances ({0}) +balanceTopLine={0}. {1}, {2} balancetopCommandDescription=Gets the top balance values. balancetopCommandUsage=/ banCommandDescription=Bans a player.