diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/User.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 04a27e469..f4ded533c 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -4,6 +4,8 @@ import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.register.payment.Method; import java.util.Calendar; import java.util.GregorianCalendar; +import java.util.logging.Level; +import java.util.logging.Logger; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.command.CommandSender; @@ -20,6 +22,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser private transient long lastActivity = System.currentTimeMillis(); private boolean hidden = false; private transient Location afkPosition; + private static final Logger logger = Logger.getLogger("Minecraft"); User(final Player base, final IEssentials ess) { @@ -284,7 +287,18 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser public void setDisplayNick(String name) { setDisplayName(name); - setPlayerListName(name.length() > 16 ? name.substring(0, 16) : name); + if (name.length() > 16) + { + name = name.substring(0, name.charAt(15) == 'ยง' ? 15 : 16); + } + try + { + setPlayerListName(name); + } + catch (IllegalArgumentException e) + { + logger.log(Level.INFO, "Playerlist for " + name + " was not updated. Use a shorter displayname prefix."); + } } @Override |