diff --git a/api/src/main/java/me/lucko/luckperms/api/PlayerSaveResult.java b/api/src/main/java/me/lucko/luckperms/api/PlayerSaveResult.java index 95128358..cb63dab2 100644 --- a/api/src/main/java/me/lucko/luckperms/api/PlayerSaveResult.java +++ b/api/src/main/java/me/lucko/luckperms/api/PlayerSaveResult.java @@ -30,6 +30,7 @@ import me.lucko.luckperms.api.manager.UserManager; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import java.util.Objects; import java.util.Set; import java.util.UUID; @@ -56,10 +57,16 @@ public interface PlayerSaveResult { * @param status the status to check for * @return if the result includes the status */ - boolean includes(@NonNull Status status); + default boolean includes(@NonNull Status status) { + Objects.requireNonNull(status, "status"); + return getStatus().contains(status); + } /** - * Gets the old username involved in the result + * Gets the old username involved in the result. + * + *
Returns null when the result doesn't {@link #includes(Status) include} the + * {@link Status#USERNAME_UPDATED} status.
* * @return the old username * @see Status#USERNAME_UPDATED @@ -67,7 +74,10 @@ public interface PlayerSaveResult { @Nullable String getOldUsername(); /** - * Gets the other uuids involved in the result + * Gets the other uuids involved in the result. + * + *Returns null when the result doesn't {@link #includes(Status) include} the + * {@link Status#OTHER_UUIDS_PRESENT_FOR_USERNAME} status.
* * @return the other uuids * @see Status#OTHER_UUIDS_PRESENT_FOR_USERNAME diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/misc/PlayerSaveResultImpl.java b/common/src/main/java/me/lucko/luckperms/common/storage/misc/PlayerSaveResultImpl.java index 6f344a8e..94185405 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/misc/PlayerSaveResultImpl.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/misc/PlayerSaveResultImpl.java @@ -100,11 +100,6 @@ public final class PlayerSaveResultImpl implements PlayerSaveResult { return this.status; } - @Override - public boolean includes(@NonNull Status status) { - return this.status.contains(status); - } - @Override public @Nullable String getOldUsername() { return this.oldUsername;