Always send info about version

This commit is contained in:
Minecon724 2025-01-05 11:32:35 +01:00
parent 15c99d007a
commit b26b8a1ded
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8

View file

@ -52,6 +52,15 @@ public class UpdateCommand {
if (args.length == 1) { // remember this function is proxied if (args.length == 1) { // remember this function is proxied
updater.getLatestVersion().thenAccept(metadata -> { updater.getLatestVersion().thenAccept(metadata -> {
updater.getCurrentVersion().thenAccept(metadata2 -> {
sender.sendMessage("You're on Giants " + metadata2.getLabel() + " released " + formatDate(metadata2.getTimestamp()));
sendChangelogMessage(sender, metadata2.getChangelogUrl());
}).exceptionally(e -> {
sender.sendMessage("Error retrieving information about current version, see console for details. " + e.getMessage());
e.printStackTrace();
return null;
});
if (metadata != null) { if (metadata != null) {
sender.sendMessage("An update is available!"); sender.sendMessage("An update is available!");
sender.sendMessage("Giants " + metadata.getLabel() + " released " + formatDate(metadata.getTimestamp())); sender.sendMessage("Giants " + metadata.getLabel() + " released " + formatDate(metadata.getTimestamp()));
@ -59,14 +68,6 @@ public class UpdateCommand {
sender.sendMessage("To download: /giants update download"); sender.sendMessage("To download: /giants update download");
} else { } else {
sender.sendMessage("No new updates"); sender.sendMessage("No new updates");
updater.getCurrentVersion().thenAccept(metadata2 -> {
sender.sendMessage("You're on Giants " + metadata2.getLabel() + " released " + formatDate(metadata2.getTimestamp()));
sendChangelogMessage(sender, metadata2.getChangelogUrl());
}).exceptionally(e -> {
sender.sendMessage("Error retrieving information about current version, see console for details. " + e.getMessage());
e.printStackTrace();
return null;
});
} }
}).exceptionally(e -> { }).exceptionally(e -> {
sender.sendMessage("Error checking for update. See console for details."); sender.sendMessage("Error checking for update. See console for details.");