Maybe fix usernames not being updated in storage after name changes (#301)

This commit is contained in:
Luck 2017-06-03 16:40:04 +01:00
parent 306e252c31
commit 7b8654339c
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 14 additions and 1 deletions

View File

@ -71,6 +71,15 @@ public class GenericUserManager extends AbstractManager<UserIdentifier, User> im
return true; return true;
} }
@Override
public User getOrMake(UserIdentifier id) {
User ret = super.getOrMake(id);
if (id.getUsername().isPresent()) {
ret.setName(id.getUsername().get(), false);
}
return ret;
}
/** /**
* Check whether the user's state indicates that they should be persisted to storage. * Check whether the user's state indicates that they should be persisted to storage.
* *

View File

@ -134,7 +134,11 @@ public class SpongeUserManager implements UserManager, LPSubjectCollection {
@Override @Override
public SpongeUser getOrMake(UserIdentifier id) { public SpongeUser getOrMake(UserIdentifier id) {
return objects.get(id); SpongeUser ret = objects.get(id);
if (id.getUsername().isPresent()) {
ret.setName(id.getUsername().get(), false);
}
return ret;
} }
@Override @Override