9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-23 16:49:19 +00:00

Update DesertWell to 2.0.2, improve adventure API usage

This commit is contained in:
William
2023-05-07 23:15:50 +01:00
parent 1afbd3753a
commit 6bd12dc000
12 changed files with 127 additions and 98 deletions

View File

@@ -13,8 +13,8 @@
package net.william278.husksync;
import net.william278.desertwell.UpdateChecker;
import net.william278.desertwell.Version;
import net.william278.desertwell.util.UpdateChecker;
import net.william278.desertwell.util.Version;
import net.william278.husksync.config.Locales;
import net.william278.husksync.config.Settings;
import net.william278.husksync.data.DataAdapter;
@@ -166,14 +166,14 @@ public interface HuskSync {
* @return a {@link CompletableFuture} returning the latest {@link Version} if the current one is out-of-date
*/
default CompletableFuture<Optional<Version>> getLatestVersionIfOutdated() {
final UpdateChecker updateChecker = UpdateChecker.create(getPluginVersion(), SPIGOT_RESOURCE_ID);
return updateChecker.isUpToDate().thenApply(upToDate -> {
if (upToDate) {
return Optional.empty();
} else {
return Optional.of(updateChecker.getLatestVersion().join());
}
});
return UpdateChecker.builder()
.currentVersion(getPluginVersion())
.endpoint(UpdateChecker.Endpoint.SPIGOT)
.resource(Integer.toString(SPIGOT_RESOURCE_ID)).build()
.check()
.thenApply(checked -> checked.isUpToDate()
? Optional.empty()
: Optional.of(checked.getLatestVersion()));
}
/**