Return account by normal name if name is longer than 15 cars (DevBukkit-1217)

This commit is contained in:
Phoenix616 2017-07-09 17:30:26 +01:00
parent b3b9e690dd
commit 4a71af39af
1 changed files with 4 additions and 2 deletions

View File

@ -93,11 +93,13 @@ public class NameManager {
* Get account info from a username that might be shortened
* @param shortName The name of the player to get the account info
* @return The account info or <tt>null</tt> if none was found
* @throws IllegalArgumentException if the username is not a shortened name and longer than 15 chars
* @throws IllegalArgumentException if the username is empty
*/
public static Account getAccountFromShortName(String shortName) {
Validate.notEmpty(shortName, "shortName cannot be null or empty!");
Validate.isTrue(shortName.length() < 16, "Username is not a shortened name and longer than 15 chars!");
if (shortName.length() > 15) {
return getAccount(shortName);
}
try {
return shortToAccount.get(shortName, () -> {