Skip to content

Commit 7c7a15e

Browse files
committed
Update AccountManager to handle name changes when fetching accounts
1 parent aa3eae1 commit 7c7a15e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

eternaleconomy-core/src/main/java/com/eternalcode/economy/account/AccountManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ public Account getOrCreate(UUID uuid, String name) {
6666
Account byUniqueId = this.accountByUniqueId.get(uuid);
6767

6868
if (byUniqueId != null) {
69+
if (!byUniqueId.name().equals(name)) {
70+
Account updated = new Account(uuid, name, byUniqueId.balance());
71+
this.save(updated);
72+
return updated;
73+
}
6974
return byUniqueId;
7075
}
7176

0 commit comments

Comments
 (0)