Skip to content

Commit

Permalink
fix: editUserData methods not working
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Dec 20, 2023
1 parent d021da7 commit 1ea1a44
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ public final void saveUserData(@NotNull SavedUser savedUser) {
* @since 4.0
*/
public final void editUserData(@NotNull String username, @NotNull Consumer<SavedUser> editor) {
plugin.getSavedUsers().stream().findAny().ifPresent(savedUser -> {
if (savedUser.getUsername().equalsIgnoreCase(username)) {
editor.accept(savedUser);
saveUserData(savedUser);
}
});
plugin.getSavedUsers().stream()
.filter(u -> u.getUsername().equalsIgnoreCase(username)).findFirst()
.ifPresent(savedUser -> {
editor.accept(savedUser);
saveUserData(savedUser);
});
}

/**
Expand All @@ -241,12 +241,14 @@ public final void editUserData(@NotNull String username, @NotNull Consumer<Saved
* @since 4.0
*/
public final void editUserData(@NotNull UUID uuid, @NotNull Consumer<SavedUser> editor) {
plugin.getSavedUsers().stream().findAny().ifPresent(savedUser -> {
if (savedUser.getUser().getUuid().equals(uuid)) {
editor.accept(savedUser);
saveUserData(savedUser);
}
});
plugin.getSavedUsers().stream()
.filter(u -> u.getUserUuid().equals(uuid)).findFirst()
.ifPresent(savedUser -> {
if (savedUser.getUser().getUuid().equals(uuid)) {
editor.accept(savedUser);
saveUserData(savedUser);
}
});
}

/**
Expand Down

0 comments on commit 1ea1a44

Please sign in to comment.