Class AddonContext

java.lang.Object
cloud.lumenvm.api.AddonContext

public class AddonContext extends Object
Used to create addon datafolder and extract resources from itself
  • Constructor Details

    • AddonContext

      public AddonContext(File dataFolder, File jarFile) throws IOException
      Sets addonFolder and jar
      Parameters:
      dataFolder - addon's folder
      jarFile - addon jar
      Throws:
      IOException - if setting the jar fails
  • Method Details

    • getDataFolder

      public File getDataFolder()
      Returns:
      addon's folder
    • getResource

      public InputStream getResource(String path) throws IOException
      Parameters:
      path - path of the resource
      Returns:
      InputStream of addon's resource
      Throws:
      IOException - if getting the InputStream fails
    • saveResource

      public void saveResource(String path, String destination) throws IOException
      Saves resource in a destination
      Parameters:
      path - path of the resource
      destination - destination path of the resource
      Throws:
      IOException - if saving the resource fails
    • close

      public void close() throws IOException
      Closes the jar file
      Throws:
      IOException - if closing the jar fails