mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-17 07:35:02 +00:00
Annotate all the things
This commit is contained in:
63 files changed
+623
-369
No files matched your search
@@ -29,14 +29,19 @@ import org.apache.logging.log4j.Logger;
|
||||
@StableAPI(since = "0.8.0")
|
||||
public class ModUpdateInfo {
|
||||
@NonNull
|
||||
@StableAPI.Expose
|
||||
public final String modID;
|
||||
@NonNull
|
||||
@StableAPI.Expose
|
||||
public final String currentVersion;
|
||||
@NonNull
|
||||
@StableAPI.Expose
|
||||
public final String latestVersion;
|
||||
@NonNull
|
||||
@StableAPI.Expose
|
||||
public final String updateURL;
|
||||
|
||||
@StableAPI.Expose
|
||||
public void log(Logger logger) {
|
||||
logger.info("Updates are available for mod {}: Currently installed version is {}, " +
|
||||
"latest available version is {}. Update URL: {}", modID, currentVersion, latestVersion,
|
||||
|
||||
@@ -24,18 +24,22 @@ import com.falsepattern.lib.StableAPI;
|
||||
|
||||
@StableAPI(since = "0.8.3")
|
||||
public class UpdateCheckException extends Exception {
|
||||
@StableAPI.Expose
|
||||
public UpdateCheckException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public UpdateCheckException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public UpdateCheckException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
protected UpdateCheckException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ public class UpdateChecker {
|
||||
*
|
||||
* @return A list of mods that were both available on the URL and installed
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static CompletableFuture<List<ModUpdateInfo>> fetchUpdatesAsync(String url) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
if (!LibraryConfig.ENABLE_UPDATE_CHECKER) {
|
||||
@@ -168,6 +169,7 @@ public class UpdateChecker {
|
||||
*
|
||||
* @throws UpdateCheckException If the update checker is disabled in config, the URL is invalid, or
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static List<ModUpdateInfo> fetchUpdates(String url) throws UpdateCheckException {
|
||||
try {
|
||||
return fetchUpdatesAsync(url).join();
|
||||
@@ -190,6 +192,7 @@ public class UpdateChecker {
|
||||
*
|
||||
* @return A list of chat messages that can be sent to players
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static List<IChatComponent> updateListToChatMessages(String initiator, List<ModUpdateInfo> updates) {
|
||||
if (updates == null || updates.size() == 0) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user