mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-01-24 15:51:23 +01:00
Add method to get the last account information from a shortened name
This commit is contained in:
parent
29ef7f25aa
commit
1276c6f031
@ -123,6 +123,20 @@ public class NameManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the information from the last time a player logged in that previously used the shortened name
|
||||
* @param shortName The name of the player to get the last account for
|
||||
* @return The last account or <tt>null</tt> if none was found
|
||||
* @throws IllegalArgumentException if the username is not a shortened name and longer than 15 chars
|
||||
*/
|
||||
public static Account getLastAccountFromShortName(String shortName) {
|
||||
Account account = getAccountFromShortName(shortName); // first get the account associated with the short name
|
||||
if (account != null) {
|
||||
return getAccount(account.getUuid()); // then get the last account that was online with that UUID
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UUID from a player's (non-shortened) username
|
||||
* @param username The player's username
|
||||
@ -179,12 +193,9 @@ public class NameManager {
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getFullUsername(String shortName) {
|
||||
Account account = getAccountFromShortName(shortName); // first get the account associated with the short name
|
||||
Account account = getLastAccountFromShortName(shortName);
|
||||
if (account != null) {
|
||||
account = getAccount(account.getUuid()); // then get the last account that was online with that UUID
|
||||
if (account != null) {
|
||||
return account.getName();
|
||||
}
|
||||
return account.getName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user