Search in sources :

Example 1 with AssetId

use of org.spongepowered.api.asset.AssetId in project LanternServer by LanternPowered.

the class PluginAssetProvider method get.

@Override
public Asset get() {
    final AssetId assetId = this.point.getAnnotation(AssetId.class);
    String name;
    if (assetId != null) {
        name = assetId.value();
    } else {
        name = provideName(this.point).orElseThrow(() -> new IllegalStateException("Missing @AssetId or @Named annotation."));
    }
    if (name.indexOf(':') == -1) {
        name = this.container.getId() + ':' + name;
    }
    final String name1 = name;
    return this.assetManager.getAsset(name).orElseThrow(() -> new NoSuchElementException("Cannot find asset " + name1));
}
Also used : AssetId(org.spongepowered.api.asset.AssetId) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

NoSuchElementException (java.util.NoSuchElementException)1 AssetId (org.spongepowered.api.asset.AssetId)1