Class Downloader
java.lang.Object
ua.mcchickenstudio.opencreative.managers.downloader.Downloader
- All Implemented Interfaces:
DownloadManager,Manager,ShutDownable,Startable,Toggleable
Downloader
This class represents a download manager, that will be used to compress and upload planet folders archive by using command: /world download.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all archives from temporary folder.voidclearArchives(@NotNull Planet planet) Removes saved archives of planet, because it was unloaded.@NotNull FilecompressPlanetToArchive(@NotNull Planet planet, @NotNull DownloadSession session) Compresses planet folders to one archive.@NotNull StringgetName()Returns name of manager, that will be displayed by request in the logs.booleanChecks whether manager was started successfully and it currently works.voidshutdown()Shutdowns web world downloader server.voidstart()Does tasks on start.@NotNull CompletableFuture<String> uploadPlanet(@NotNull Planet planet, @NotNull org.bukkit.entity.Player player) Compresses planet folders to archive in temporary folder, then generates unique token and returns link to download world.
-
Constructor Details
-
Downloader
public Downloader()
-
-
Method Details
-
uploadPlanet
@NotNull public @NotNull CompletableFuture<String> uploadPlanet(@NotNull @NotNull Planet planet, @NotNull @NotNull org.bukkit.entity.Player player) Description copied from interface:DownloadManagerCompresses planet folders to archive in temporary folder, then generates unique token and returns link to download world.- Specified by:
uploadPlanetin interfaceDownloadManager- Parameters:
planet- planet, that was requested to download.player- player, who requested.- Returns:
- string of link.
-
compressPlanetToArchive
@NotNull public @NotNull File compressPlanetToArchive(@NotNull @NotNull Planet planet, @NotNull @NotNull DownloadSession session) Description copied from interface:DownloadManagerCompresses planet folders to one archive.- Specified by:
compressPlanetToArchivein interfaceDownloadManager- Parameters:
planet- planet to compress folders.session- download session.- Returns:
- compressed archive.
-
clearArchives
Description copied from interface:DownloadManagerRemoves saved archives of planet, because it was unloaded.- Specified by:
clearArchivesin interfaceDownloadManager- Parameters:
planet- planet to remove archive.
-
clearAllArchives
public void clearAllArchives()Description copied from interface:DownloadManagerClears all archives from temporary folder.- Specified by:
clearAllArchivesin interfaceDownloadManager
-
start
public void start()Description copied from interface:StartableDoes tasks on start. -
shutdown
public void shutdown()Description copied from interface:DownloadManagerShutdowns web world downloader server.- Specified by:
shutdownin interfaceDownloadManager- Specified by:
shutdownin interfaceShutDownable
-
isWorking
public boolean isWorking()Description copied from interface:ToggleableChecks whether manager was started successfully and it currently works.- Specified by:
isWorkingin interfaceToggleable- Returns:
- true - started up, false - shut downed.
-
getName
Description copied from interface:ManagerReturns name of manager, that will be displayed by request in the logs.
-