client: add session and config file arguments
This commit is contained in:
@@ -33,6 +33,7 @@ import com.google.inject.Injector;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.lang.management.RuntimeMXBean;
|
import java.lang.management.RuntimeMXBean;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
@@ -41,6 +42,8 @@ import javax.swing.SwingUtilities;
|
|||||||
import joptsimple.ArgumentAcceptingOptionSpec;
|
import joptsimple.ArgumentAcceptingOptionSpec;
|
||||||
import joptsimple.OptionParser;
|
import joptsimple.OptionParser;
|
||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
|
import joptsimple.ValueConversionException;
|
||||||
|
import joptsimple.ValueConverter;
|
||||||
import joptsimple.util.EnumConverter;
|
import joptsimple.util.EnumConverter;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -52,12 +55,12 @@ import net.runelite.client.chat.CommandManager;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.discord.DiscordService;
|
import net.runelite.client.discord.DiscordService;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
|
import net.runelite.client.externalplugins.ExternalPluginManager;
|
||||||
import net.runelite.client.game.ClanManager;
|
import net.runelite.client.game.ClanManager;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.game.LootManager;
|
import net.runelite.client.game.LootManager;
|
||||||
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||||
import net.runelite.client.menus.MenuManager;
|
import net.runelite.client.menus.MenuManager;
|
||||||
import net.runelite.client.externalplugins.ExternalPluginManager;
|
|
||||||
import net.runelite.client.plugins.PluginManager;
|
import net.runelite.client.plugins.PluginManager;
|
||||||
import net.runelite.client.rs.ClientLoader;
|
import net.runelite.client.rs.ClientLoader;
|
||||||
import net.runelite.client.rs.ClientUpdateCheckMode;
|
import net.runelite.client.rs.ClientUpdateCheckMode;
|
||||||
@@ -85,6 +88,8 @@ public class RuneLite
|
|||||||
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
|
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
|
||||||
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
|
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
|
||||||
public static final File LOGS_DIR = new File(RUNELITE_DIR, "logs");
|
public static final File LOGS_DIR = new File(RUNELITE_DIR, "logs");
|
||||||
|
public static final String DEFAULT_SESSION_FILE = "session";
|
||||||
|
public static final String DEFAULT_CONFIG_FILE = "settings.properties";
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static Injector injector;
|
private static Injector injector;
|
||||||
@@ -173,6 +178,14 @@ public class RuneLite
|
|||||||
parser.accepts("developer-mode", "Enable developer tools");
|
parser.accepts("developer-mode", "Enable developer tools");
|
||||||
parser.accepts("debug", "Show extra debugging output");
|
parser.accepts("debug", "Show extra debugging output");
|
||||||
|
|
||||||
|
final ArgumentAcceptingOptionSpec<File> sessionfile = parser.accepts("sessionfile", "Use a specified session file")
|
||||||
|
.withRequiredArg().defaultsTo(DEFAULT_SESSION_FILE)
|
||||||
|
.withValuesConvertedBy(new ConfigFileConverter());
|
||||||
|
|
||||||
|
final ArgumentAcceptingOptionSpec<File> configfile = parser.accepts("config", "Use a specified config file")
|
||||||
|
.withRequiredArg().defaultsTo(DEFAULT_CONFIG_FILE)
|
||||||
|
.withValuesConvertedBy(new ConfigFileConverter());
|
||||||
|
|
||||||
final ArgumentAcceptingOptionSpec<ClientUpdateCheckMode> updateMode = parser
|
final ArgumentAcceptingOptionSpec<ClientUpdateCheckMode> updateMode = parser
|
||||||
.accepts("rs", "Select client type")
|
.accepts("rs", "Select client type")
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
@@ -246,7 +259,9 @@ public class RuneLite
|
|||||||
|
|
||||||
injector = Guice.createInjector(new RuneLiteModule(
|
injector = Guice.createInjector(new RuneLiteModule(
|
||||||
clientLoader,
|
clientLoader,
|
||||||
developerMode));
|
developerMode,
|
||||||
|
options.valueOf(sessionfile),
|
||||||
|
options.valueOf(configfile)));
|
||||||
|
|
||||||
injector.getInstance(RuneLite.class).start();
|
injector.getInstance(RuneLite.class).start();
|
||||||
|
|
||||||
@@ -363,4 +378,43 @@ public class RuneLite
|
|||||||
{
|
{
|
||||||
RuneLite.injector = injector;
|
RuneLite.injector = injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class ConfigFileConverter implements ValueConverter<File>
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public File convert(String fileName)
|
||||||
|
{
|
||||||
|
final File file;
|
||||||
|
|
||||||
|
if (Paths.get(fileName).isAbsolute()
|
||||||
|
|| fileName.startsWith("./")
|
||||||
|
|| fileName.startsWith(".\\"))
|
||||||
|
{
|
||||||
|
file = new File(fileName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file = new File(RuneLite.RUNELITE_DIR, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file.exists() && (!file.isFile() || !file.canWrite()))
|
||||||
|
{
|
||||||
|
throw new ValueConversionException(String.format("File %s is not accessible", file.getAbsolutePath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends File> valueType()
|
||||||
|
{
|
||||||
|
return File.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String valuePattern()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,17 +61,23 @@ public class RuneLiteModule extends AbstractModule
|
|||||||
|
|
||||||
private final Supplier<Applet> clientLoader;
|
private final Supplier<Applet> clientLoader;
|
||||||
private final boolean developerMode;
|
private final boolean developerMode;
|
||||||
|
private final File sessionfile;
|
||||||
|
private final File config;
|
||||||
|
|
||||||
public RuneLiteModule(Supplier<Applet> clientLoader, boolean developerMode)
|
public RuneLiteModule(Supplier<Applet> clientLoader, boolean developerMode, File sessionfile, File config)
|
||||||
{
|
{
|
||||||
this.clientLoader = clientLoader;
|
this.clientLoader = clientLoader;
|
||||||
this.developerMode = developerMode;
|
this.developerMode = developerMode;
|
||||||
|
this.sessionfile = sessionfile;
|
||||||
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure()
|
protected void configure()
|
||||||
{
|
{
|
||||||
bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode);
|
bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode);
|
||||||
|
bind(File.class).annotatedWith(Names.named("sessionfile")).toInstance(sessionfile);
|
||||||
|
bind(File.class).annotatedWith(Names.named("config")).toInstance(config);
|
||||||
bind(ScheduledExecutorService.class).toInstance(new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor()));
|
bind(ScheduledExecutorService.class).toInstance(new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor()));
|
||||||
bind(OkHttpClient.class).toInstance(RuneLiteAPI.CLIENT.newBuilder()
|
bind(OkHttpClient.class).toInstance(RuneLiteAPI.CLIENT.newBuilder()
|
||||||
.cache(new Cache(new File(RuneLite.CACHE_DIR, "okhttp"), MAX_OKHTTP_CACHE_SIZE))
|
.cache(new Cache(new File(RuneLite.CACHE_DIR, "okhttp"), MAX_OKHTTP_CACHE_SIZE))
|
||||||
|
|||||||
@@ -33,15 +33,15 @@ import java.io.InputStreamReader;
|
|||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.client.events.SessionClose;
|
|
||||||
import net.runelite.client.events.SessionOpen;
|
|
||||||
import net.runelite.client.RuneLite;
|
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.events.SessionClose;
|
||||||
|
import net.runelite.client.events.SessionOpen;
|
||||||
import net.runelite.client.util.LinkBrowser;
|
import net.runelite.client.util.LinkBrowser;
|
||||||
import net.runelite.client.ws.WSClient;
|
import net.runelite.client.ws.WSClient;
|
||||||
import net.runelite.http.api.account.AccountClient;
|
import net.runelite.http.api.account.AccountClient;
|
||||||
@@ -52,27 +52,32 @@ import net.runelite.http.api.ws.messages.LoginResponse;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SessionManager
|
public class SessionManager
|
||||||
{
|
{
|
||||||
private static final File SESSION_FILE = new File(RuneLite.RUNELITE_DIR, "session");
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private AccountSession accountSession;
|
private AccountSession accountSession;
|
||||||
|
|
||||||
private final EventBus eventBus;
|
private final EventBus eventBus;
|
||||||
private final ConfigManager configManager;
|
private final ConfigManager configManager;
|
||||||
private final WSClient wsClient;
|
private final WSClient wsClient;
|
||||||
|
private final File sessionFile;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SessionManager(ConfigManager configManager, EventBus eventBus, WSClient wsClient)
|
private SessionManager(
|
||||||
|
@Named("sessionfile") File sessionfile,
|
||||||
|
ConfigManager configManager,
|
||||||
|
EventBus eventBus,
|
||||||
|
WSClient wsClient)
|
||||||
{
|
{
|
||||||
this.configManager = configManager;
|
this.configManager = configManager;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.wsClient = wsClient;
|
this.wsClient = wsClient;
|
||||||
|
this.sessionFile = sessionfile;
|
||||||
|
|
||||||
eventBus.register(this);
|
eventBus.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadSession()
|
public void loadSession()
|
||||||
{
|
{
|
||||||
if (!SESSION_FILE.exists())
|
if (!sessionFile.exists())
|
||||||
{
|
{
|
||||||
log.info("No session file exists");
|
log.info("No session file exists");
|
||||||
return;
|
return;
|
||||||
@@ -80,7 +85,7 @@ public class SessionManager
|
|||||||
|
|
||||||
AccountSession session;
|
AccountSession session;
|
||||||
|
|
||||||
try (FileInputStream in = new FileInputStream(SESSION_FILE))
|
try (FileInputStream in = new FileInputStream(sessionFile))
|
||||||
{
|
{
|
||||||
session = new Gson().fromJson(new InputStreamReader(in), AccountSession.class);
|
session = new Gson().fromJson(new InputStreamReader(in), AccountSession.class);
|
||||||
|
|
||||||
@@ -110,11 +115,11 @@ public class SessionManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (FileWriter fw = new FileWriter(SESSION_FILE))
|
try (FileWriter fw = new FileWriter(sessionFile))
|
||||||
{
|
{
|
||||||
new Gson().toJson(accountSession, fw);
|
new Gson().toJson(accountSession, fw);
|
||||||
|
|
||||||
log.debug("Saved session to {}", SESSION_FILE);
|
log.debug("Saved session to {}", sessionFile);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
@@ -124,7 +129,7 @@ public class SessionManager
|
|||||||
|
|
||||||
private void deleteSession()
|
private void deleteSession()
|
||||||
{
|
{
|
||||||
SESSION_FILE.delete();
|
sessionFile.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
@@ -77,7 +78,6 @@ import net.runelite.http.api.config.Configuration;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class ConfigManager
|
public class ConfigManager
|
||||||
{
|
{
|
||||||
private static final String SETTINGS_FILE_NAME = "settings.properties";
|
|
||||||
private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
|
private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -92,11 +92,15 @@ public class ConfigManager
|
|||||||
private final ConfigInvocationHandler handler = new ConfigInvocationHandler(this);
|
private final ConfigInvocationHandler handler = new ConfigInvocationHandler(this);
|
||||||
private final Properties properties = new Properties();
|
private final Properties properties = new Properties();
|
||||||
private final Map<String, String> pendingChanges = new HashMap<>();
|
private final Map<String, String> pendingChanges = new HashMap<>();
|
||||||
|
private final File settingsFileInput;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ConfigManager(ScheduledExecutorService scheduledExecutorService)
|
public ConfigManager(
|
||||||
|
@Named("config") File config,
|
||||||
|
ScheduledExecutorService scheduledExecutorService)
|
||||||
{
|
{
|
||||||
this.executor = scheduledExecutorService;
|
this.executor = scheduledExecutorService;
|
||||||
|
this.settingsFileInput = config;
|
||||||
this.propertiesFile = getPropertiesFile();
|
this.propertiesFile = getPropertiesFile();
|
||||||
|
|
||||||
executor.scheduleWithFixedDelay(this::sendConfig, 30, 30, TimeUnit.SECONDS);
|
executor.scheduleWithFixedDelay(this::sendConfig, 30, 30, TimeUnit.SECONDS);
|
||||||
@@ -125,7 +129,7 @@ public class ConfigManager
|
|||||||
|
|
||||||
private File getLocalPropertiesFile()
|
private File getLocalPropertiesFile()
|
||||||
{
|
{
|
||||||
return new File(RuneLite.RUNELITE_DIR, SETTINGS_FILE_NAME);
|
return settingsFileInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getPropertiesFile()
|
private File getPropertiesFile()
|
||||||
@@ -138,7 +142,7 @@ public class ConfigManager
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
File profileDir = new File(RuneLite.PROFILES_DIR, session.getUsername().toLowerCase());
|
File profileDir = new File(RuneLite.PROFILES_DIR, session.getUsername().toLowerCase());
|
||||||
return new File(profileDir, SETTINGS_FILE_NAME);
|
return new File(profileDir, RuneLite.DEFAULT_CONFIG_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +335,7 @@ public class ConfigManager
|
|||||||
|
|
||||||
parent.mkdirs();
|
parent.mkdirs();
|
||||||
|
|
||||||
File tempFile = new File(parent, SETTINGS_FILE_NAME + ".tmp");
|
File tempFile = new File(parent, RuneLite.DEFAULT_CONFIG_FILE + ".tmp");
|
||||||
|
|
||||||
try (FileOutputStream out = new FileOutputStream(tempFile))
|
try (FileOutputStream out = new FileOutputStream(tempFile))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,11 +27,14 @@ package net.runelite.client.config;
|
|||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.testing.fieldbinder.Bind;
|
import com.google.inject.testing.fieldbinder.Bind;
|
||||||
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.account.AccountSession;
|
import net.runelite.client.account.AccountSession;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
@@ -56,6 +59,14 @@ public class ConfigManagerTest
|
|||||||
@Bind
|
@Bind
|
||||||
RuneLiteConfig runeliteConfig;
|
RuneLiteConfig runeliteConfig;
|
||||||
|
|
||||||
|
@Bind
|
||||||
|
@Named("sessionfile")
|
||||||
|
File sessionfile = new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_SESSION_FILE);
|
||||||
|
|
||||||
|
@Bind
|
||||||
|
@Named("config")
|
||||||
|
File config = new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_CONFIG_FILE);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ConfigManager manager;
|
ConfigManager manager;
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ import java.util.Set;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.client.RuneLite;
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.RuneLiteModule;
|
import net.runelite.client.RuneLiteModule;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigItem;
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@@ -83,7 +83,9 @@ public class PluginManagerTest
|
|||||||
public void before() throws IOException
|
public void before() throws IOException
|
||||||
{
|
{
|
||||||
Injector injector = Guice.createInjector(Modules
|
Injector injector = Guice.createInjector(Modules
|
||||||
.override(new RuneLiteModule(() -> null, true))
|
.override(new RuneLiteModule(() -> null, true,
|
||||||
|
new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_SESSION_FILE),
|
||||||
|
new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_CONFIG_FILE)))
|
||||||
.with(BoundFieldModule.of(this)));
|
.with(BoundFieldModule.of(this)));
|
||||||
|
|
||||||
RuneLite.setInjector(injector);
|
RuneLite.setInjector(injector);
|
||||||
@@ -144,7 +146,9 @@ public class PluginManagerTest
|
|||||||
{
|
{
|
||||||
List<Module> modules = new ArrayList<>();
|
List<Module> modules = new ArrayList<>();
|
||||||
modules.add(new GraphvizModule());
|
modules.add(new GraphvizModule());
|
||||||
modules.add(new RuneLiteModule(() -> null, true));
|
modules.add(new RuneLiteModule(() -> null, true,
|
||||||
|
new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_SESSION_FILE),
|
||||||
|
new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_CONFIG_FILE)));
|
||||||
|
|
||||||
PluginManager pluginManager = new PluginManager(true, null, null, null, null, null);
|
PluginManager pluginManager = new PluginManager(true, null, null, null, null, null);
|
||||||
pluginManager.loadCorePlugins();
|
pluginManager.loadCorePlugins();
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
|
import net.runelite.client.account.SessionManager;
|
||||||
import net.runelite.client.game.SpriteManager;
|
import net.runelite.client.game.SpriteManager;
|
||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
import net.runelite.http.api.loottracker.LootRecordType;
|
import net.runelite.http.api.loottracker.LootRecordType;
|
||||||
@@ -72,6 +73,10 @@ public class LootTrackerPluginTest
|
|||||||
@Bind
|
@Bind
|
||||||
private LootTrackerConfig lootTrackerConfig;
|
private LootTrackerConfig lootTrackerConfig;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private SessionManager sessionManager;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp()
|
public void setUp()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import net.runelite.api.Varbits;
|
|||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.ItemContainerChanged;
|
import net.runelite.api.events.ItemContainerChanged;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarbitChanged;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -87,6 +88,10 @@ public class MotherlodePluginTest
|
|||||||
@Bind
|
@Bind
|
||||||
private ScheduledExecutorService scheduledExecutorService;
|
private ScheduledExecutorService scheduledExecutorService;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before()
|
public void before()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import java.util.List;
|
|||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -58,6 +59,10 @@ public class NpcIndicatorsPluginTest
|
|||||||
@Inject
|
@Inject
|
||||||
private NpcIndicatorsPlugin npcIndicatorsPlugin;
|
private NpcIndicatorsPlugin npcIndicatorsPlugin;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp()
|
public void setUp()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,16 +36,18 @@ import net.runelite.api.ItemContainer;
|
|||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
import net.runelite.api.events.WidgetLoaded;
|
||||||
import net.runelite.api.widgets.WidgetID;
|
import net.runelite.api.widgets.WidgetID;
|
||||||
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.chat.ChatMessageManager;
|
import net.runelite.client.chat.ChatMessageManager;
|
||||||
import net.runelite.client.chat.QueuedMessage;
|
import net.runelite.client.chat.QueuedMessage;
|
||||||
import net.runelite.client.config.ChatColorConfig;
|
import net.runelite.client.config.ChatColorConfig;
|
||||||
import net.runelite.client.config.RuneLiteConfig;
|
import net.runelite.client.config.RuneLiteConfig;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
import net.runelite.client.util.ImageCapture;
|
||||||
|
import net.runelite.client.ws.PartyService;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import net.runelite.client.Notifier;
|
|
||||||
import net.runelite.client.util.ImageCapture;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -98,6 +100,14 @@ public class RaidsPluginTest
|
|||||||
@Inject
|
@Inject
|
||||||
RaidsPlugin raidsPlugin;
|
RaidsPlugin raidsPlugin;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private PartyService partyService;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before()
|
public void before()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import net.runelite.client.Notifier;
|
|||||||
import net.runelite.client.config.RuneLiteConfig;
|
import net.runelite.client.config.RuneLiteConfig;
|
||||||
import net.runelite.client.ui.ClientUI;
|
import net.runelite.client.ui.ClientUI;
|
||||||
import net.runelite.client.ui.DrawManager;
|
import net.runelite.client.ui.DrawManager;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -97,6 +98,10 @@ public class ScreenshotPluginTest
|
|||||||
@Bind
|
@Bind
|
||||||
ScheduledExecutorService service;
|
ScheduledExecutorService service;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before()
|
public void before()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user