From 5a651d3cc78b1e9cc6f76dde1d1aae6d1cbc4678 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Sat, 1 Jun 2019 23:40:55 +0200 Subject: [PATCH] Sign char limit is 16, #443 We do not need to short the player name to 8 character to look nicely on sign, for now if the name reach 15+ chars then write "~" after the name to short --- .../java/com/gamingmesh/jobs/Signs/SignUtil.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java index 5d9e1daf..59e16b13 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java @@ -157,8 +157,8 @@ public class SignUtil { break; String PlayerName = PlayerList.get(i + number).getPlayerName(); - if (PlayerName != null && PlayerName.length() > 8) { - String PlayerNameStrip = PlayerName.split("(?<=\\G.{7})")[0]; + if (PlayerName != null && PlayerName.length() > 15) { + String PlayerNameStrip = PlayerName.split("(?<=\\G.{15})")[0]; PlayerName = PlayerNameStrip + "~"; } @@ -181,10 +181,14 @@ public class SignUtil { TopList pl = PlayerList.get(one.getNumber() - 1); String PlayerName = pl.getPlayerName(); - if (PlayerName.length() > 8) { - String PlayerNameStrip = PlayerName.split("(?<=\\G.{7})")[0]; + if (PlayerName != null && PlayerName.length() > 15) { + String PlayerNameStrip = PlayerName.split("(?<=\\G.{15})")[0]; PlayerName = PlayerNameStrip + "~"; } + + if (PlayerName == null) + PlayerName = "Unknown"; + String line1 = Jobs.getLanguage().getMessage("signs.SpecialList.p" + one.getNumber(), "[number]", one.getNumber() + number + 1, "[player]", PlayerName,