From 0793181e5f85f27e73847a03a9e4297671798f78 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 9 May 2018 14:33:23 +0200 Subject: [PATCH] Cleanup RuneLite class (use Lombok) - Use Lombok for creating setters and getters for variables in RuneLite - Use correct spacing and final modifiers Signed-off-by: Tomas Slusny --- .../java/net/runelite/client/RuneLite.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLite.java b/runelite-client/src/main/java/net/runelite/client/RuneLite.java index a0ee9f7db4..906bfaee70 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLite.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLite.java @@ -40,6 +40,7 @@ import joptsimple.ArgumentAcceptingOptionSpec; import joptsimple.OptionParser; import joptsimple.OptionSet; import joptsimple.util.EnumConverter; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.client.account.SessionManager; @@ -68,7 +69,10 @@ public class RuneLite private static final File LOGS_DIR = new File(RUNELITE_DIR, "logs"); private static final File LOGS_FILE_NAME = new File(LOGS_DIR, "application"); + @Getter private static Injector injector; + + @Getter private static OptionSet options; @Inject @@ -122,10 +126,12 @@ public class RuneLite { Locale.setDefault(Locale.ENGLISH); - OptionParser parser = new OptionParser(); + final OptionParser parser = new OptionParser(); parser.accepts("developer-mode", "Enable developer tools"); parser.accepts("debug", "Show extra debugging output"); - ArgumentAcceptingOptionSpec updateMode = parser.accepts("rs", "Select client type") + + final ArgumentAcceptingOptionSpec updateMode = parser + .accepts("rs", "Select client type") .withRequiredArg() .ofType(UpdateCheckMode.class) .defaultsTo(UpdateCheckMode.AUTO) @@ -137,8 +143,9 @@ public class RuneLite return super.convert(v.toUpperCase()); } }); + parser.accepts("help", "Show this text").forHelp(); - setOptions(parser.parse(args)); + options = parser.parse(args); if (getOptions().has("help")) { @@ -176,7 +183,7 @@ public class RuneLite } }); - setInjector(Guice.createInjector(new RuneLiteModule())); + injector = Guice.createInjector(new RuneLiteModule()); injector.getInstance(RuneLite.class).start(getOptions().valueOf(updateMode)); } @@ -207,6 +214,7 @@ public class RuneLite eventBus.register(commandManager); eventBus.register(pluginManager); eventBus.register(clanManager); + if (this.client != null) { eventBus.register(itemManager.get()); @@ -249,28 +257,20 @@ public class RuneLite } @VisibleForTesting - public void setClient(Client client) - { - this.client = client; - } - - public static Injector getInjector() - { - return injector; - } - public static void setInjector(Injector injector) { RuneLite.injector = injector; } - public static OptionSet getOptions() - { - return options; - } - + @VisibleForTesting public static void setOptions(OptionSet options) { RuneLite.options = options; } + + @VisibleForTesting + public void setClient(Client client) + { + this.client = client; + } }