Skip to content

Commit

Permalink
Initialize preferences before Telemetry nag
Browse files Browse the repository at this point in the history
Initialize preferences before relying on them in telemetry nag code in several cmdline tools.
Fixes #1255.
  • Loading branch information
Pieter12345 committed Jan 29, 2021
1 parent 60f1a26 commit 5e04ddf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/laytonsmith/core/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ public ArgumentParser getArgumentParser() {

@Override
public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception {
Prefs.init(MethodScriptFileLocations.getDefault().getPreferencesFile());
Telemetry.GetDefault().doNag();
String commandName = parsedArgs.getStringArgument("command");
Interpreter.install(commandName);
Expand Down Expand Up @@ -459,6 +460,7 @@ public ArgumentParser getArgumentParser() {
public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception {
// TODO: This should eventually be changed to use an independent
// versioning scheme for CH and MS.
Prefs.init(MethodScriptFileLocations.getDefault().getPreferencesFile());
Telemetry.GetDefault().doNag();
StreamUtils.GetSystemOut().println("You are running "
+ Implementation.GetServerType().getBranding() + " version " + Static.loadSelfVersion());
Expand Down Expand Up @@ -537,6 +539,7 @@ public ArgumentParser getArgumentParser() {
@Override
@SuppressWarnings("ResultOfObjectAllocationIgnored")
public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception {
Prefs.init(MethodScriptFileLocations.getDefault().getPreferencesFile());
Telemetry.GetDefault().doNag();
new Interpreter(parsedArgs.getStringListArgument(), parsedArgs.getStringArgument("location-----"));
}
Expand Down Expand Up @@ -1668,6 +1671,7 @@ public ArgumentParser getArgumentParser() {

@Override
public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception {
Prefs.init(MethodScriptFileLocations.getDefault().getPreferencesFile());
Telemetry.GetDefault().doNag();
Map<String, String> topics = new HashMap<>();
for(ExtensionTracker t : ExtensionManager.getTrackers().values()) {
Expand Down

0 comments on commit 5e04ddf

Please sign in to comment.