Search in sources :

Example 1 with SpongeDataStoreBuilder

use of org.spongepowered.common.data.persistence.datastore.SpongeDataStoreBuilder in project SpongeCommon by SpongePowered.

the class DataProviderRegistrator method spongeDataStore.

public void spongeDataStore(final ResourceKey datastoreKey, final int version, final DataContentUpdater[] contentUpdater, final Class dataHolder, final Key<? extends Value<?>>... dataKeys) {
    final SpongeDataStoreBuilder builder = ((SpongeDataStoreBuilder) DataStore.builder()).pluginData(datastoreKey, version);
    builder.updater(contentUpdater);
    builder.holder(dataHolder);
    for (Key dataKey : dataKeys) {
        builder.key(dataKey, dataKey.key().value());
    }
    SpongeDataManager.getDatastoreRegistry().register(builder.build(), Arrays.asList(dataKeys));
}
Also used : SpongeDataStoreBuilder(org.spongepowered.common.data.persistence.datastore.SpongeDataStoreBuilder) ResourceKey(org.spongepowered.api.ResourceKey) Key(org.spongepowered.api.data.Key)

Aggregations

ResourceKey (org.spongepowered.api.ResourceKey)1 Key (org.spongepowered.api.data.Key)1 SpongeDataStoreBuilder (org.spongepowered.common.data.persistence.datastore.SpongeDataStoreBuilder)1