/** * Gets the {@link AssetManager}. * * @return The asset manager */ default AssetManager getAssetManager() { return Sponge.getAssetManager(); }
/** * Retrieves the {@link Asset} of the specified name from the * {@link AssetManager} for this {@link Plugin}. * * @param name Name of asset * @return Asset if present, empty otherwise */ default Optional<Asset> getAsset(String name) { return Sponge.getAssetManager().getAsset(this, name); }
/** * Retrieves the {@link Asset} of the specified name from the * {@link AssetManager} for this {@link Plugin}. * * @param name Name of asset * @return Asset if present, empty otherwise */ default Optional<Asset> getAsset(String name) { return Sponge.getAssetManager().getAsset(this, name); }
public AssetHandler(String folderPath) { Optional<Asset> asset = Sponge.getAssetManager().getAsset(WebAPI.getInstance(), folderPath); if (folderPath.contains(".") && asset.isPresent()) { try { this.assetString = asset.get().readString(); this.contentType = guessContentType(folderPath); } catch (IOException e) { e.printStackTrace(); WebAPI.sentryCapture(e); } } else { this.folderPath = folderPath; } } public AssetHandler(String folderPath, Function<String, Function<byte[], byte[]>> processAssets) {
Optional<Asset> asset = Sponge.getAssetManager().getAsset(WebAPI.getInstance(), path); if (asset.isPresent()) { byte[] data = asset.get().readBytes();
String mgrPw = config.customKeyStoreManagerPassword; if (loc == null || loc.isEmpty()) { loc = Sponge.getAssetManager().getAsset(WebAPI.getInstance(), "keystore.jks") .map(a -> a.getUrl().toString()).orElse(""); pw = "mX4z%&uJ2E6VN#5f";