Skip to content

Commit

Permalink
Release 1.2.4
Browse files Browse the repository at this point in the history
JavaDoc improvements

FMT update

PLA update
  • Loading branch information
FlowArg committed Oct 16, 2020
1 parent 8bd6f09 commit a82567d
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 44 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ allprojects {

dependencies {
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'fr.flowarg:flowmultitools:1.1.3'
implementation 'com.github.FlowArg:PluginLoaderAPI:c9ae321'
implementation 'fr.flowarg:flowmultitools:1.2.0'
implementation 'com.github.FlowArg:PluginLoaderAPI:871c5910c6'
}
}

version '1.2.3'
version '1.2.4'
archivesBaseName = "flowupdater"

artifacts {
Expand Down
66 changes: 52 additions & 14 deletions src/main/java/fr/flowarg/flowupdater/FlowUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class FlowUpdater
{
/** Vanilla version's object to update/install */
private final VanillaVersion version;

/** Vanilla version's JSON parser */
private final VanillaReader vanillaReader;

Expand All @@ -45,6 +46,7 @@ public class FlowUpdater

/** Forge Version to install, can be null if you want a vanilla/MCP installation */
private final AbstractForgeVersion forgeVersion;

/** Progress callback to notify installation progress */
private final IProgressCallback callback;

Expand All @@ -61,7 +63,6 @@ public class FlowUpdater
private final List<Runnable> postExecutions;

private boolean canPLAShutdown;

private boolean cursePluginLoaded = false;

/** Default callback */
Expand All @@ -84,29 +85,29 @@ public void init(ILogger logger)
public static final ILogger DEFAULT_LOGGER = new Logger("[FlowUpdater]", null);

/**
* Basic constructor to construct a new {@link FlowUpdater}.
* @param version Version to update.
* @param logger Logger used for log information.
* @param updaterOptions options for this updater
* @param callback The callback. If it's null, it will automatically assigned as {@link FlowUpdater#NULL_CALLBACK}.
* @param externalFiles External files are download before postExecutions.
* @param postExecutions Post executions are called after update.
* @param forgeVersion ForgeVersion to install, can be null.
* Basic constructor for {@link FlowUpdater}, use {@link FlowUpdaterBuilder} to instantiate a new {@link FlowUpdater}.
* @param version {@link VanillaVersion} to update.
* @param logger {@link ILogger} used for log information.
* @param updaterOptions {@link UpdaterOptions} for this updater
* @param callback {@link IProgressCallback} used for update progression. If it's null, it will automatically assigned as {@link FlowUpdater#NULL_CALLBACK}.
* @param externalFiles {@link List<ExternalFile>} are downloaded before postExecutions.
* @param postExecutions {@link List<Runnable>} are called after update.
* @param forgeVersion {@link AbstractForgeVersion} to install, can be null.
*/
private FlowUpdater(VanillaVersion version, ILogger logger, UpdaterOptions updaterOptions,
IProgressCallback callback, List<ExternalFile> externalFiles, List<Runnable> postExecutions, AbstractForgeVersion forgeVersion)
{
this.logger = logger;
this.version = version;
this.logger.info(String.format("------------------------- FlowUpdater for Minecraft %s v%s -------------------------", this.version.getName(), "1.2.4"));
this.externalFiles = externalFiles;
this.postExecutions = postExecutions;
this.forgeVersion = forgeVersion;
this.updaterOptions = updaterOptions;
this.downloadInfos = new DownloadInfos();
this.callback = callback;
this.downloadInfos = new DownloadInfos();
this.canPLAShutdown = false;
this.vanillaReader = new VanillaReader(this.version, this.logger, this.updaterOptions.isSilentRead(), this.callback, this.downloadInfos);
this.logger.info(String.format("------------------------- FlowUpdater for Minecraft %s v%s -------------------------", this.version.getName(), "1.2.3"));
this.vanillaReader = new VanillaReader(this.version, this.logger, this.updaterOptions.isSilentRead(), this.callback, this.downloadInfos);
this.callback.init(this.logger);
}

Expand Down Expand Up @@ -306,7 +307,7 @@ private void endUpdate()

/**
* Builder of {@link FlowUpdater}.
* @author FlowArg
* @author Flow Arg (FlowArg)
*/
public static class FlowUpdaterBuilder implements IBuilder<FlowUpdater>
{
Expand All @@ -318,36 +319,66 @@ public static class FlowUpdaterBuilder implements IBuilder<FlowUpdater>
private final BuilderArgument<List<Runnable>> postExecutionsArgument = new BuilderArgument<List<Runnable>>("Post Executions", ArrayList::new).optional();
private final BuilderArgument<AbstractForgeVersion> forgeVersionArgument = new BuilderArgument<AbstractForgeVersion>("ForgeVersion").optional().require(this.versionArgument);

/**
* Append a {@link VanillaVersion} object in the final FlowUpdater instance.
* @param version the {@link VanillaVersion} to append and install.
* @return the builder.
*/
public FlowUpdaterBuilder withVersion(VanillaVersion version)
{
this.versionArgument.set(version);
return this;
}

/**
* Append a {@link ILogger} object in the final FlowUpdater instance.
* @param logger the {@link ILogger} to append and use.
* @return the builder.
*/
public FlowUpdaterBuilder withLogger(ILogger logger)
{
this.loggerArgument.set(logger);
return this;
}

/**
* Append a {@link UpdaterOptions} object in the final FlowUpdater instance.
* @param updaterOptions the {@link UpdaterOptions} to append and propagate.
* @return the builder.
*/
public FlowUpdaterBuilder withUpdaterOptions(UpdaterOptions updaterOptions)
{
this.updaterOptionsArgument.set(updaterOptions);
return this;
}

/**
* Append a {@link IProgressCallback} object in the final FlowUpdater instance.
* @param callback the {@link IProgressCallback} to append and use.
* @return the builder.
*/
public FlowUpdaterBuilder withProgressCallback(IProgressCallback callback)
{
this.progressCallbackArgument.set(callback);
return this;
}

/**
* Append a {@link List<ExternalFile>} object in the final FlowUpdater instance.
* @param externalFiles the {@link List<ExternalFile>} to append and update.
* @return the builder.
*/
public FlowUpdaterBuilder withExternalFiles(List<ExternalFile> externalFiles)
{
this.externalFilesArgument.set(externalFiles);
return this;
}

/**
* Append a {@link List<Runnable>} object in the final FlowUpdater instance.
* @param postExecutions the {@link List<Runnable>} to append and run after the update.
* @return the builder.
*/
public FlowUpdaterBuilder withPostExecutions(List<Runnable> postExecutions)
{
this.postExecutionsArgument.set(postExecutions);
Expand All @@ -356,14 +387,21 @@ public FlowUpdaterBuilder withPostExecutions(List<Runnable> postExecutions)

/**
* Necessary if you want install a Forge version.
* @param forgeVersion Forge version to install.
* Append a {@link AbstractForgeVersion} object in the final FlowUpdater instance.
* @param forgeVersion the {@link AbstractForgeVersion} to append and install.
* @return the builder.
*/
public FlowUpdaterBuilder withForgeVersion(AbstractForgeVersion forgeVersion)
{
this.forgeVersionArgument.set(forgeVersion);
return this;
}

/**
* Build a new {@link FlowUpdater} instance with provided arguments.
* @return the new {@link FlowUpdater} instance.
* @throws BuilderException if an error occurred on FlowUpdater instance building.
*/
@Override
public FlowUpdater build() throws BuilderException
{
Expand Down
29 changes: 10 additions & 19 deletions src/main/java/fr/flowarg/flowupdater/download/DownloadInfos.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import java.util.List;

/**
* Represent information about download status. Used for progress system {@link IProgressCallback}.
* Represent information about download status. Used with {@link IProgressCallback} progress system.
*
* @author FlowArg
*/
public class DownloadInfos
Expand All @@ -21,53 +22,43 @@ public class DownloadInfos
private final List<Object> curseMods = new ArrayList<>();
private int totalToDownload;
private int downloaded;

public void init()
{
this.totalToDownload = this.libraryDownloadables.size() + this.assetDownloadables.size() + this.extFiles.size() + this.mods.size() + this.curseMods.size();
this.downloaded = 0;
}

public void incrementDownloaded()
{
++this.downloaded;
}

public int getTotalToDownload()
{
return this.totalToDownload;
}

public int getDownloaded()
{
return this.downloaded;
}

public void setTotalToDownload(int totalToDownload)
{
this.totalToDownload = totalToDownload;
}

public void setDownloaded(int downloaded)
{
this.downloaded = downloaded;
}


public List<AssetDownloadable> getAssetDownloadables()
{
return this.assetDownloadables;
}

public List<Downloadable> getLibraryDownloadables()
{
return this.libraryDownloadables;
}

public List<ExternalFile> getExtFiles()
{
return this.extFiles;
}

public List<Mod> getMods()
{
return this.mods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ public interface IProgressCallback
{
/**
* This method is called at {@link FlowUpdater} initialization.
* @param logger Logger of FlowUpdater instance.
* @param logger {@link ILogger} of FlowUpdater instance.
*/
void init(ILogger logger);

/**
* This method is called when a step started.
* @param step Actual step.
* @param step Actual {@link Step}.
*/
void step(Step step);

/**
* This method is called when a new file is downloaded.
* @param downloaded Number of downloaded files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public abstract class AbstractForgeVersion
protected URL installerUrl;
protected DownloadInfos downloadInfos;

/**
* Use {@link ForgeVersionBuilder} to instantiate this class.
* @param logger {@link ILogger} used for logging.
* @param mods {@link List<Mod>} to install.
* @param curseMods {@link ArrayList<CurseModInfos>} to install.
* @param forgeVersion to install.
* @param vanilla {@link VanillaVersion}.
* @param callback {@link IProgressCallback} used for update progression.
* @param fileDeleter {@link ModFileDeleter} used to cleanup mods dir.
*/
protected AbstractForgeVersion(ILogger logger, List<Mod> mods, ArrayList<CurseModInfos> curseMods, String forgeVersion, VanillaVersion vanilla, IProgressCallback callback, ModFileDeleter fileDeleter)
{
this.logger = logger;
Expand Down Expand Up @@ -170,32 +180,26 @@ public List<Mod> getMods()
{
return this.mods;
}

public ILogger getLogger()
{
return this.logger;
}

public String getForgeVersion()
{
return this.forgeVersion;
}

public URL getInstallerUrl()
{
return this.installerUrl;
}

public List<Object> getAllCurseMods()
{
return this.allCurseMods;
}

public void setAllCurseMods(List<Object> allCurseMods)
{
this.allCurseMods = allCurseMods;
}

public ArrayList<CurseModInfos> getCurseMods()
{
return this.curseMods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import java.util.ArrayList;
import java.util.List;

/**
* Builder of {@link AbstractForgeVersion}
* @author Flow Arg (FlowArg)
*/
public class ForgeVersionBuilder implements IBuilder<AbstractForgeVersion>
{
private final ForgeVersionType type;
Expand Down

0 comments on commit a82567d

Please sign in to comment.