Class BMCopy

java.lang.Object
com.technicjelle.BMUtils.BMCopy

public class BMCopy extends Object
Utility functions for copying stuff to BlueMap
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    fileToMap(@NotNull BlueMapMap map, @NotNull Path from, @NotNull String toAsset, boolean overwrite)
    Copies any file to the BlueMap asset folder of a specific map.
    Do not use this method for copying scripts or styles, as those need to be installed in the webapp.
    static void
    fileToWebApp(@NotNull BlueMapAPI blueMapAPI, @NotNull Path from, @NotNull String toAsset, boolean overwrite)
    Copies any file to the BlueMap asset folder.
    If the resource is a script or style, it will be registered with BlueMap.
    This function should be called directly inside BlueMapAPI.onEnable(Consumer), not in a separate thread.
    static void
    jarResourceToMap(@NotNull BlueMapMap map, @NotNull ClassLoader classLoader, @NotNull String fromResource, @NotNull String toAsset, boolean overwrite)
    Copies a resource from the jar to the BlueMap asset folder of a specific map.
    Do not use this method for copying scripts or styles, as those need to be installed in the webapp.
    static void
    jarResourceToWebApp(@NotNull BlueMapAPI blueMapAPI, @NotNull ClassLoader classLoader, @NotNull String fromResource, @NotNull String toAsset, boolean overwrite)
    Copies a resource from the jar to the BlueMap asset folder.
    If the resource is a script or style, it will be registered with BlueMap.
    This function should be called directly inside BlueMapAPI.onEnable(Consumer), not in a separate thread.
    static void
    streamToMap(@NotNull BlueMapMap map, @NotNull InputStream in, @NotNull String toAsset, boolean overwrite)
    Copies any stream to the BlueMap asset folder of a specific map.
    Do not use this method for copying scripts or styles, as those need to be installed in the webapp.
    static void
    streamToWebApp(@NotNull BlueMapAPI blueMapAPI, @NotNull InputStream in, @NotNull String toAsset, boolean overwrite)
    Copies any stream to the BlueMap asset folder.
    If the resource is a script or style, it will be registered with BlueMap.
    This function should be called directly inside BlueMapAPI.onEnable(Consumer), not in a separate thread.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • streamToWebApp

      public static void streamToWebApp(@NotNull @NotNull BlueMapAPI blueMapAPI, @NotNull @NotNull InputStream in, @NotNull @NotNull String toAsset, boolean overwrite) throws IOException
      Copies any stream to the BlueMap asset folder.
      If the resource is a script or style, it will be registered with BlueMap.
      This function should be called directly inside BlueMapAPI.onEnable(Consumer), not in a separate thread.
      Parameters:
      blueMapAPI - The BlueMapAPI instance
      in - The input stream to copy from
      toAsset - The asset to copy to, relative to BlueMap's asset folder (bluemap/web/assets)
      overwrite - Whether to overwrite the asset if it already exists
      Throws:
      IOException - If the resource could not be copied
    • streamToMap

      public static void streamToMap(@NotNull @NotNull BlueMapMap map, @NotNull @NotNull InputStream in, @NotNull @NotNull String toAsset, boolean overwrite) throws IOException
      Copies any stream to the BlueMap asset folder of a specific map.
      Do not use this method for copying scripts or styles, as those need to be installed in the webapp.
      Parameters:
      map - The map to copy the stream to
      in - The input stream to copy from
      toAsset - The map's asset to copy to, relative to the map's asset folder (bluemap/web/maps/{map}/assets/)
      overwrite - Whether to overwrite the asset if it already exists
      Throws:
      IOException - If the resource could not be copied
    • fileToWebApp

      public static void fileToWebApp(@NotNull @NotNull BlueMapAPI blueMapAPI, @NotNull @NotNull Path from, @NotNull @NotNull String toAsset, boolean overwrite) throws IOException
      Copies any file to the BlueMap asset folder.
      If the resource is a script or style, it will be registered with BlueMap.
      This function should be called directly inside BlueMapAPI.onEnable(Consumer), not in a separate thread.
      Parameters:
      blueMapAPI - The BlueMapAPI instance
      from - The file to copy
      toAsset - The asset to copy to, relative to BlueMap's asset folder (bluemap/web/assets)
      overwrite - Whether to overwrite the asset if it already exists
      Throws:
      IOException - If the resource could not be found or copied
    • fileToMap

      public static void fileToMap(@NotNull @NotNull BlueMapMap map, @NotNull @NotNull Path from, @NotNull @NotNull String toAsset, boolean overwrite) throws IOException
      Copies any file to the BlueMap asset folder of a specific map.
      Do not use this method for copying scripts or styles, as those need to be installed in the webapp.
      Parameters:
      map - The map to copy the file to
      from - The file to copy
      toAsset - The map's asset to copy to, relative to the map's asset folder (bluemap/web/maps/{map}/assets/)
      overwrite - Whether to overwrite the asset if it already exists
      Throws:
      IOException - If the resource could not be found or copied
    • jarResourceToWebApp

      public static void jarResourceToWebApp(@NotNull @NotNull BlueMapAPI blueMapAPI, @NotNull @NotNull ClassLoader classLoader, @NotNull @NotNull String fromResource, @NotNull @NotNull String toAsset, boolean overwrite) throws IOException
      Copies a resource from the jar to the BlueMap asset folder.
      If the resource is a script or style, it will be registered with BlueMap.
      This function should be called directly inside BlueMapAPI.onEnable(Consumer), not in a separate thread.
      Parameters:
      blueMapAPI - The BlueMapAPI instance
      classLoader - The class loader to get the resource from the correct jar
      fromResource - The resource to copy from the jar
      toAsset - The asset to copy to, relative to BlueMap's asset folder (bluemap/web/assets)
      overwrite - Whether to overwrite the asset if it already exists
      Throws:
      IOException - If the resource could not be found or copied
    • jarResourceToMap

      public static void jarResourceToMap(@NotNull @NotNull BlueMapMap map, @NotNull @NotNull ClassLoader classLoader, @NotNull @NotNull String fromResource, @NotNull @NotNull String toAsset, boolean overwrite) throws IOException
      Copies a resource from the jar to the BlueMap asset folder of a specific map.
      Do not use this method for copying scripts or styles, as those need to be installed in the webapp.
      Parameters:
      map - The map to copy the resource to
      classLoader - The class loader to get the resource from the correct jar
      fromResource - The resource to copy from the jar
      toAsset - The asset to copy to, relative to the map's asset folder (bluemap/web/maps/{map}/assets/)
      overwrite - Whether to overwrite the asset if it already exists
      Throws:
      IOException - If the resource could not be found or copied