mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-02-03 12:01:22 +01:00
Add method to get the last account information from a shortened name
This commit is contained in:
parent
29ef7f25aa
commit
1276c6f031
@ -122,6 +122,20 @@ public class NameManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Get the UUID from a player's (non-shortened) username
|
||||||
@ -179,12 +193,9 @@ public class NameManager {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static String getFullUsername(String shortName) {
|
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) {
|
if (account != null) {
|
||||||
account = getAccount(account.getUuid()); // then get the last account that was online with that UUID
|
return account.getName();
|
||||||
if (account != null) {
|
|
||||||
return account.getName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user