diff --git a/src/main/java/dev/plex/command/impl/PlexCMD.java b/src/main/java/dev/plex/command/impl/PlexCMD.java index c6baa8e..bec340b 100644 --- a/src/main/java/dev/plex/command/impl/PlexCMD.java +++ b/src/main/java/dev/plex/command/impl/PlexCMD.java @@ -38,7 +38,7 @@ public class PlexCMD extends PlexCommand send(sender, mmString("Authors: Telesphoreo, Taahh")); send(sender, mmString("Built by: " + Plex.build.author + " on " + Plex.build.date)); send(sender, mmString("Run /plex modules to see a list of modules.")); - plugin.getUpdateChecker().getUpdateStatusMessage(sender, true, true); + plugin.getUpdateChecker().getUpdateStatusMessage(sender, true, 2); return null; } if (args[0].equalsIgnoreCase("reload")) @@ -95,7 +95,7 @@ public class PlexCMD extends PlexCommand { return messageComponent("noPermissionRank", "a developer"); } - if (!plugin.getUpdateChecker().getUpdateStatusMessage(sender, false, false)) + if (!plugin.getUpdateChecker().getUpdateStatusMessage(sender, false, 0)) { return mmString("Plex is already up to date!"); } diff --git a/src/main/java/dev/plex/services/impl/UpdateCheckerService.java b/src/main/java/dev/plex/services/impl/UpdateCheckerService.java index 494a801..418de7e 100644 --- a/src/main/java/dev/plex/services/impl/UpdateCheckerService.java +++ b/src/main/java/dev/plex/services/impl/UpdateCheckerService.java @@ -17,7 +17,7 @@ public class UpdateCheckerService extends AbstractService { if (!newVersion) { - if (plugin.getUpdateChecker().getUpdateStatusMessage(Bukkit.getConsoleSender(), false, false)) + if (plugin.getUpdateChecker().getUpdateStatusMessage(Bukkit.getConsoleSender(), false, 1)) { newVersion = true; } diff --git a/src/main/java/dev/plex/util/UpdateChecker.java b/src/main/java/dev/plex/util/UpdateChecker.java index 8bca755..2b54520 100644 --- a/src/main/java/dev/plex/util/UpdateChecker.java +++ b/src/main/java/dev/plex/util/UpdateChecker.java @@ -82,7 +82,10 @@ public class UpdateChecker extends PlexBase } } - public boolean getUpdateStatusMessage(CommandSender sender, boolean cached, boolean verbose) + // If verbose is 0, it will display nothing + // If verbose is 1, it will only display a message if there is an update available + // If verbose is 2, it will display all messages + public boolean getUpdateStatusMessage(CommandSender sender, boolean cached, int verbosity) { if (branch == null) { @@ -112,30 +115,33 @@ public class UpdateChecker extends PlexBase switch (distance) { case -1 -> { - if (verbose) + if (verbosity == 2) { sender.sendMessage(Component.text("There was an error checking for updates.").color(NamedTextColor.RED)); } return false; } case 0 -> { - if (verbose) + if (verbosity == 2) { - sender.sendMessage(Component.text("Your version of Plex is up to date!").color(NamedTextColor.GREEN)); + sender.sendMessage(Component.text("Plex is up to date!").color(NamedTextColor.GREEN)); } return false; } case -2 -> { - if (verbose) + if (verbosity == 2) { sender.sendMessage(Component.text("Unknown version, unable to check for updates.").color(NamedTextColor.RED)); } return false; } default -> { - sender.sendMessage(Component.text("Your version of Plex is not up to date!", NamedTextColor.RED)); - sender.sendMessage(Component.text("Download a new version at: " + DOWNLOAD_PAGE).color(NamedTextColor.RED)); - sender.sendMessage(Component.text("Or run: /plex update").color(NamedTextColor.RED)); + if (verbosity >= 1) + { + sender.sendMessage(Component.text("Plex is not up to date!", NamedTextColor.RED)); + sender.sendMessage(Component.text("Download a new version at: " + DOWNLOAD_PAGE).color(NamedTextColor.RED)); + sender.sendMessage(Component.text("Or run: /plex update").color(NamedTextColor.RED)); + } return true; } }