Package com.technicjelle.BMUtils
Class BMCopy
java.lang.Object
com.technicjelle.BMUtils.BMCopy
Utility functions for copying stuff to BlueMap
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 insideBlueMapAPI.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 insideBlueMapAPI.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 insideBlueMapAPI.onEnable(Consumer)
, not in a separate thread.
-
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 insideBlueMapAPI.onEnable(Consumer)
, not in a separate thread.- Parameters:
blueMapAPI
- The BlueMapAPI instancein
- The input stream to copy fromtoAsset
- 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 toin
- The input stream to copy fromtoAsset
- 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 insideBlueMapAPI.onEnable(Consumer)
, not in a separate thread.- Parameters:
blueMapAPI
- The BlueMapAPI instancefrom
- The file to copytoAsset
- 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 tofrom
- The file to copytoAsset
- 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 insideBlueMapAPI.onEnable(Consumer)
, not in a separate thread.- Parameters:
blueMapAPI
- The BlueMapAPI instanceclassLoader
- The class loader to get the resource from the correct jarfromResource
- The resource to copy from the jartoAsset
- 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 toclassLoader
- The class loader to get the resource from the correct jarfromResource
- The resource to copy from the jartoAsset
- 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
-