From 0986b0982cf5bd803a6cc018fce2db43a7844293 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Sat, 24 Oct 2020 11:13:16 +0200 Subject: [PATCH] Fix dontbugme command Fixes #2152 --- .../main/java/us/myles/ViaVersion/AbstractViaConfig.java | 6 ++++++ .../java/us/myles/ViaVersion/api/ViaVersionConfig.java | 8 ++++++++ .../ViaVersion/commands/defaultsubs/DontBugMeSubCmd.java | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java index f56acb691..aeafd47eb 100644 --- a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java @@ -120,6 +120,12 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf return checkForUpdates; } + @Override + public void setCheckForUpdates(boolean checkForUpdates) { + this.checkForUpdates = checkForUpdates; + set("checkforupdates", checkForUpdates); + } + @Override public boolean isPreventCollision() { return preventCollision; diff --git a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java index de31982b8..506643899 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java @@ -11,6 +11,14 @@ public interface ViaVersionConfig { */ boolean isCheckForUpdates(); + /** + * Sets whether to check for updates. This updates the internally cached value + * as well as the config, but does not save the config to disc. + * + * @param checkForUpdates true to check for updates on server start and joins + */ + void setCheckForUpdates(boolean checkForUpdates); + /** * Get if collision preventing for players is enabled * diff --git a/common/src/main/java/us/myles/ViaVersion/commands/defaultsubs/DontBugMeSubCmd.java b/common/src/main/java/us/myles/ViaVersion/commands/defaultsubs/DontBugMeSubCmd.java index 95d92d27d..e16569c4c 100644 --- a/common/src/main/java/us/myles/ViaVersion/commands/defaultsubs/DontBugMeSubCmd.java +++ b/common/src/main/java/us/myles/ViaVersion/commands/defaultsubs/DontBugMeSubCmd.java @@ -6,6 +6,7 @@ import us.myles.ViaVersion.api.command.ViaSubCommand; import us.myles.ViaVersion.api.configuration.ConfigurationProvider; public class DontBugMeSubCmd extends ViaSubCommand { + @Override public String name() { return "dontbugme"; @@ -21,7 +22,7 @@ public class DontBugMeSubCmd extends ViaSubCommand { ConfigurationProvider provider = Via.getPlatform().getConfigurationProvider(); boolean newValue = !Via.getConfig().isCheckForUpdates(); - provider.set("checkforupdates", newValue); + Via.getConfig().setCheckForUpdates(newValue); provider.saveConfig(); sendMessage(sender, "&6We will %snotify you about updates.", (newValue ? "&a" : "&cnot "));