Skip to content

Commit 94004df

Browse files
committed
Avoid intermediate DataQueries in DataUtil#getSpongeData
1 parent f553923 commit 94004df

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/org/spongepowered/common/data/DataUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ public static void setSpongeData(final DataView allData, final DataQuery dataSto
225225
}
226226

227227
public static Optional<DataView> getSpongeData(final DataView allData, final DataQuery dataStoreKey, final int version) {
228-
return allData.getView(Constants.Sponge.Data.V3.SPONGE_DATA_ROOT
229-
.then(dataStoreKey)
230-
.then(Constants.Sponge.Data.V3.CONTENT));
228+
return allData.getView(Constants.Sponge.Data.V3.SPONGE_DATA_ROOT)
229+
.flatMap(spongeData -> spongeData.getView(dataStoreKey))
230+
.flatMap(dataStore -> dataStore.getView(Constants.Sponge.Data.V3.CONTENT));
231231
}
232232
}

0 commit comments

Comments
 (0)