Fix issue when creating sign with own name without existing account

This was only an issue if the autofill functionality for the own name wasn't used.
Now if there is no account with a certain name then the player can use it if it matches their user name
This commit is contained in:
Phoenix616 2022-07-06 20:05:21 +01:00
parent e3cd50cf75
commit d0af977212
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
1 changed files with 5 additions and 0 deletions

View File

@ -287,6 +287,11 @@ public class NameManager implements Listener {
ChestShop.callEvent(queryEvent);
Account account = queryEvent.getAccount();
if (account == null) {
// There is no account by the provided name, but it matches the player name
// Return true as they specified their own name and a new account should get created
if (player.getName().equalsIgnoreCase(name)) {
return true;
}
ChestShop.logDebug(player.getName() + " cannot use the name " + name + " for a shop as no account with that name exists");
return false;
}