Finish /huskhomes command

This commit is contained in:
William committed 2022-08-24 16:56:21 +01:00
1 parent bb66246fb6
commit f12490951a
3 files changed
+82 -21

No files matched your search

@@ -1,5 +1,6 @@
package net.william278.huskhomes;
import net.william278.desertwell.UpdateChecker;
import net.william278.huskhomes.command.CommandBase;
import net.william278.huskhomes.config.Locales;
import net.william278.huskhomes.config.Settings;
@@ -29,6 +30,8 @@ import java.util.concurrent.CompletableFuture;
*/
public interface HuskHomes {
int SPIGOT_RESOURCE_ID = 83767;
/**
* The platform plugin console logger
*
@@ -138,6 +141,22 @@ public interface HuskHomes {
*/
Optional<Spawn> getServerSpawn();
/**
* Returns a future returning the latest plugin {@link Version} if the plugin is out-of-date
*
* @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());
}
});
}
/**
* Update the {@link Spawn} position to a location on the server
*