Skip to content

Commit

Permalink
Cleanup RuneLite class (use Lombok)
Browse files Browse the repository at this point in the history
- Use Lombok for creating setters and getters for variables in RuneLite
- Use correct spacing and final modifiers

Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam authored and Adam- committed Jun 4, 2018
1 parent a67bec7 commit 0793181
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions runelite-client/src/main/java/net/runelite/client/RuneLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -122,10 +126,12 @@ public static void main(String[] args) throws Exception
{
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<UpdateCheckMode> updateMode = parser.accepts("rs", "Select client type")

final ArgumentAcceptingOptionSpec<UpdateCheckMode> updateMode = parser
.accepts("rs", "Select client type")
.withRequiredArg()
.ofType(UpdateCheckMode.class)
.defaultsTo(UpdateCheckMode.AUTO)
Expand All @@ -137,8 +143,9 @@ public UpdateCheckMode convert(String v)
return super.convert(v.toUpperCase());
}
});

parser.accepts("help", "Show this text").forHelp();
setOptions(parser.parse(args));
options = parser.parse(args);

if (getOptions().has("help"))
{
Expand Down Expand Up @@ -176,7 +183,7 @@ public UpdateCheckMode convert(String v)
}
});

setInjector(Guice.createInjector(new RuneLiteModule()));
injector = Guice.createInjector(new RuneLiteModule());
injector.getInstance(RuneLite.class).start(getOptions().valueOf(updateMode));
}

Expand Down Expand Up @@ -207,6 +214,7 @@ public void start(UpdateCheckMode updateMode) throws Exception
eventBus.register(commandManager);
eventBus.register(pluginManager);
eventBus.register(clanManager);

if (this.client != null)
{
eventBus.register(itemManager.get());
Expand Down Expand Up @@ -249,28 +257,20 @@ public void shutdown()
}

@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()
@VisibleForTesting
public static void setOptions(OptionSet options)
{
return options;
RuneLite.options = options;
}

public static void setOptions(OptionSet options)
@VisibleForTesting
public void setClient(Client client)
{
RuneLite.options = options;
this.client = client;
}
}

0 comments on commit 0793181

Please sign in to comment.