mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-07 09:52:34 -05:00
Fix NPE when failed check update
Former-commit-id: da4873714b107eb409b86393763e1fdeb4950800 [formerly cd82b1280e14dafb384c35ff9bd79154006efafd] Former-commit-id: 7e16e2d7b8147af70fe63ecdc4aaff90a71de78e
This commit is contained in:
1 parent
f3db01eb1a
commit
93dc34980d
2 files changed
+21
-13
No files matched your search
@@ -9,6 +9,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.Command.CommandProcesser;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.UpdateInfomation;
|
||||
import org.maxgamer.quickshop.Util.Updater;
|
||||
|
||||
public class SubCommand_Update implements CommandProcesser {
|
||||
@@ -20,7 +21,13 @@ public class SubCommand_Update implements CommandProcesser {
|
||||
@Override
|
||||
public void run() {
|
||||
sender.sendMessage(ChatColor.YELLOW + "Checking for updates...");
|
||||
if (Updater.checkUpdate().getVersion().equals(plugin.getDescription().getVersion())) {
|
||||
UpdateInfomation updateInfomation = Updater.checkUpdate();
|
||||
String updateVersion = updateInfomation.getVersion();
|
||||
if (updateVersion == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Failed check the update, connection issue?");
|
||||
return;
|
||||
}
|
||||
if (updateVersion.equals(plugin.getDescription().getVersion())) {
|
||||
sender.sendMessage(ChatColor.GREEN + "No updates can update now.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package org.maxgamer.quickshop.Util;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
@Getter
|
||||
@Setter
|
||||
public class UpdateInfomation {
|
||||
private String version;
|
||||
private boolean isBeta;
|
||||
}
|
||||
package org.maxgamer.quickshop.Util;
|
||||
|
||||
import lombok.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
@Getter
|
||||
@Setter
|
||||
public class UpdateInfomation {
|
||||
@Nullable private String version;
|
||||
private boolean isBeta;
|
||||
}
|
||||
Reference in new issue
Block a user