Various small fixes

This commit is contained in:
crschnick
2024-01-16 13:05:21 +00:00
parent dd54dccec7
commit bd2acc6574
9 changed files with 39 additions and 25 deletions
@@ -9,7 +9,9 @@ import java.util.UUID;
public interface SelfReferentialStore extends DataStore {
default DataStoreEntry getSelfEntry() {
return DataStorage.get().getStoreEntries().stream().filter(dataStoreEntry -> dataStoreEntry.getStore() == this).findFirst().orElseGet(() -> {
return DataStorage.get().getStoreEntryIfPresent(this).or(() -> {
return DataStorage.get().getStoreEntryInProgressIfPresent(this);
}).orElseGet(() -> {
return DataStoreEntry.createNew(UUID.randomUUID(),DataStorage.DEFAULT_CATEGORY_UUID, "Invalid", this);
});
}