mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-27 12:38:40 +01:00
Return account by normal name if name is longer than 15 cars (DevBukkit-1217)
This commit is contained in:
parent
b3b9e690dd
commit
4a71af39af
@ -93,11 +93,13 @@ public class NameManager {
|
|||||||
* Get account info from a username that might be shortened
|
* Get account info from a username that might be shortened
|
||||||
* @param shortName The name of the player to get the account info
|
* @param shortName The name of the player to get the account info
|
||||||
* @return The account info or <tt>null</tt> if none was found
|
* @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) {
|
public static Account getAccountFromShortName(String shortName) {
|
||||||
Validate.notEmpty(shortName, "shortName cannot be null or empty!");
|
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 {
|
try {
|
||||||
return shortToAccount.get(shortName, () -> {
|
return shortToAccount.get(shortName, () -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user