@Override public final Optional<T> build(DataView container) throws InvalidDataException { if (container.contains(Queries.CONTENT_VERSION)) { final int contentVersion = container.getInt(Queries.CONTENT_VERSION).get(); if (contentVersion < this.supportedVersion) { Optional<DataContentUpdater> updater = Sponge.getDataManager().getWrappedContentUpdater(this.requiredClass, contentVersion, this.supportedVersion); if (!updater.isPresent()) { throw new InvalidDataException("Could not get an updater for " + this.requiredClass.getName() + " data from the version: " + contentVersion + " to " + this.supportedVersion + ". Please notify the SpongePowered developers of this issue!"); } container = updater.get().update(container); } } try { return buildContent(container); } catch (Exception e) { throw new InvalidDataException("Could not deserialize something correctly, likely due to bad type data.", e); } } }
@Override public final Optional<T> build(DataView container) throws InvalidDataException { if (container.contains(Queries.CONTENT_VERSION)) { final int contentVersion = container.getInt(Queries.CONTENT_VERSION).get(); if (contentVersion < this.supportedVersion) { Optional<DataContentUpdater> updater = Sponge.getDataManager().getWrappedContentUpdater(this.requiredClass, contentVersion, this.supportedVersion); if (!updater.isPresent()) { throw new InvalidDataException("Could not get an updater for ItemEnchantment data from the version: " + contentVersion + " to " + this.supportedVersion + ". Please notify the SpongePowered developers of this issue!"); } container = updater.get().update(container); } } try { return buildContent(container); } catch (Exception e) { throw new InvalidDataException("Could not deserialize something correctly, likely due to bad type data.", e); } } }