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)
    Copies any file to the BlueMap asset folder of a specific map.
    If the resource already exists, it will be overwritten.
    Do not use this method for copying scripts or styles, as those need to be installed in the webapp.
    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)
    Copies any file to the BlueMap asset folder.
    If the resource already exists, it will be overwritten.
    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
    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
    fileToWebApp(@NotNull BlueMapAPI blueMapAPI, @NotNull Path from, @NotNull String toAsset, boolean overwrite, boolean register)
    Copies any file to the BlueMap asset folder.
    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)
    Copies a resource from the jar to the BlueMap asset folder of a specific map.
    If the resource already exists, it will be overwritten.
    Do not use this method for copying scripts or styles, as those need to be installed in the webapp.
    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)
    Copies a resource from the jar to the BlueMap asset folder.
    If the resource already exists, it will be overwritten.
    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
    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
    jarResourceToWebApp(@NotNull BlueMapAPI blueMapAPI, @NotNull ClassLoader classLoader, @NotNull String fromResource, @NotNull String toAsset, boolean overwrite, boolean register)
    Copies a resource from the jar to the BlueMap asset folder.
    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)
    Copies any stream to the BlueMap asset folder of a specific map.
    If the resource already exists, it will be overwritten.
    Do not use this method for copying scripts or styles, as those need to be installed in the webapp.
    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)
    Copies any stream to the BlueMap asset folder.
    If the resource already exists, it will be overwritten.
    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
    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.
    static void
    streamToWebApp(@NotNull BlueMapAPI blueMapAPI, @NotNull InputStream in, @NotNull String toAsset, boolean overwrite, boolean register)
    Copies any stream to the BlueMap asset folder.
    This function should be called directly inside BlueMapAPI.onEnable(Consumer), not in a separate thread.

    Methods inherited from class 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) throws IOException
      Copies any stream to the BlueMap asset folder.
      If the resource already exists, it will be overwritten.
      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)
      Throws:
      IOException - If the resource could not be copied
      See Also:
    • 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
      See Also:
    • streamToWebApp

      public static void streamToWebApp(@NotNull @NotNull BlueMapAPI blueMapAPI, @NotNull @NotNull InputStream in, @NotNull @NotNull String toAsset, boolean overwrite, boolean register) throws IOException
      Copies any stream to the BlueMap asset folder.
      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
      register - Whether to register the asset with BlueMap, in case it is a registerable script or style
      Throws:
      IOException - If the resource could not be copied
      See Also:
    • streamToMap

      public static void streamToMap(@NotNull @NotNull BlueMapMap map, @NotNull @NotNull InputStream in, @NotNull @NotNull String toAsset) throws IOException
      Copies any stream to the BlueMap asset folder of a specific map.
      If the resource already exists, it will be overwritten.
      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/)
      Throws:
      IOException - If the resource could not be copied
      See Also:
    • 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
      See Also:
    • fileToWebApp

      public static void fileToWebApp(@NotNull @NotNull BlueMapAPI blueMapAPI, @NotNull @NotNull Path from, @NotNull @NotNull String toAsset) throws IOException
      Copies any file to the BlueMap asset folder.
      If the resource already exists, it will be overwritten.
      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)
      Throws:
      IOException - If the resource could not be found or copied
      See Also:
    • 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
      See Also:
    • fileToWebApp

      public static void fileToWebApp(@NotNull @NotNull BlueMapAPI blueMapAPI, @NotNull @NotNull Path from, @NotNull @NotNull String toAsset, boolean overwrite, boolean register) throws IOException
      Copies any file to the BlueMap asset folder.
      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
      register - Whether to register the asset with BlueMap, in case it is a registerable script or style
      Throws:
      IOException - If the resource could not be found or copied
      See Also:
    • fileToMap

      public static void fileToMap(@NotNull @NotNull BlueMapMap map, @NotNull @NotNull Path from, @NotNull @NotNull String toAsset) throws IOException
      Copies any file to the BlueMap asset folder of a specific map.
      If the resource already exists, it will be overwritten.
      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/)
      Throws:
      IOException - If the resource could not be found or copied
      See Also:
    • 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
      See Also:
    • jarResourceToWebApp

      public static void jarResourceToWebApp(@NotNull @NotNull BlueMapAPI blueMapAPI, @NotNull @NotNull ClassLoader classLoader, @NotNull @NotNull String fromResource, @NotNull @NotNull String toAsset) throws IOException
      Copies a resource from the jar to the BlueMap asset folder.
      If the resource already exists, it will be overwritten.
      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)
      Throws:
      IOException - If the resource could not be found or copied
      See Also:
    • 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
      See Also:
    • jarResourceToWebApp

      public static void jarResourceToWebApp(@NotNull @NotNull BlueMapAPI blueMapAPI, @NotNull @NotNull ClassLoader classLoader, @NotNull @NotNull String fromResource, @NotNull @NotNull String toAsset, boolean overwrite, boolean register) throws IOException
      Copies a resource from the jar to the BlueMap asset folder.
      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
      register - Whether to register the asset with BlueMap, in case it is a registerable script or style
      Throws:
      IOException - If the resource could not be found or copied
      See Also:
    • jarResourceToMap

      public static void jarResourceToMap(@NotNull @NotNull BlueMapMap map, @NotNull @NotNull ClassLoader classLoader, @NotNull @NotNull String fromResource, @NotNull @NotNull String toAsset) throws IOException
      Copies a resource from the jar to the BlueMap asset folder of a specific map.
      If the resource already exists, it will be overwritten.
      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/)
      Throws:
      IOException - If the resource could not be found or copied
      See Also:
    • 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
      See Also: