runelite-client: use guice for dependency injection
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
|
||||
<properties>
|
||||
<slf4j.version>1.7.12</slf4j.version>
|
||||
<guice.version>4.1.0</guice.version>
|
||||
|
||||
<jarsigner.skip>true</jarsigner.skip>
|
||||
</properties>
|
||||
@@ -62,6 +63,12 @@
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.inject</groupId>
|
||||
<artifactId>guice</artifactId>
|
||||
<version>${guice.version}</version>
|
||||
<classifier>no_aop</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
@@ -114,6 +121,18 @@
|
||||
<version>1.10.19</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.inject.extensions</groupId>
|
||||
<artifactId>guice-testlib</artifactId>
|
||||
<version>${guice.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.inject.extensions</groupId>
|
||||
<artifactId>guice-grapher</artifactId>
|
||||
<version>${guice.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -26,8 +26,10 @@ package net.runelite.client;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.SubscriberExceptionContext;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Image;
|
||||
@@ -41,9 +43,9 @@ import java.io.FileInputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
@@ -55,21 +57,17 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.Query;
|
||||
import net.runelite.client.account.AccountSession;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.RuneliteConfig;
|
||||
import net.runelite.client.events.SessionClose;
|
||||
import net.runelite.client.events.SessionOpen;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.task.Scheduler;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.overlay.OverlayRenderer;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.http.api.account.AccountClient;
|
||||
import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class RuneLite
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(RuneLite.class);
|
||||
@@ -80,26 +78,34 @@ public class RuneLite
|
||||
|
||||
public static Image ICON;
|
||||
|
||||
private static Injector injector;
|
||||
|
||||
private static OptionSet options;
|
||||
private static Client client;
|
||||
private static RuneLite runelite;
|
||||
private static TrayIcon trayIcon;
|
||||
|
||||
private final RuneliteProperties properties = new RuneliteProperties();
|
||||
private Client client;
|
||||
private ClientUI gui;
|
||||
private RuneliteConfig config;
|
||||
|
||||
@Inject
|
||||
private PluginManager pluginManager;
|
||||
private final MenuManager menuManager = new MenuManager(this);
|
||||
private OverlayRenderer renderer;
|
||||
private final EventBus eventBus = new EventBus(this::eventExceptionHandler);
|
||||
private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
|
||||
private final Scheduler scheduler = new Scheduler(this);
|
||||
|
||||
@Inject
|
||||
private MenuManager menuManager;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
private ScheduledExecutorService executor;
|
||||
|
||||
private WSClient wsclient;
|
||||
|
||||
private AccountSession accountSession;
|
||||
private final ConfigManager configManager = new ConfigManager(eventBus);
|
||||
private final ItemManager itemManager = new ItemManager(this);
|
||||
private final InfoBoxManager infoBoxManager = new InfoBoxManager();
|
||||
|
||||
static
|
||||
{
|
||||
@@ -126,7 +132,8 @@ public class RuneLite
|
||||
|
||||
PROFILES_DIR.mkdirs();
|
||||
|
||||
runelite = new RuneLite();
|
||||
injector = Guice.createInjector(new RuneliteModule());
|
||||
runelite = injector.getInstance(RuneLite.class);
|
||||
runelite.start();
|
||||
}
|
||||
|
||||
@@ -146,7 +153,7 @@ public class RuneLite
|
||||
logger.warn("unable to set look and feel", ex);
|
||||
}
|
||||
|
||||
gui = new ClientUI();
|
||||
gui = new ClientUI(this);
|
||||
setTitle(null);
|
||||
|
||||
setupTrayIcon();
|
||||
@@ -154,18 +161,13 @@ public class RuneLite
|
||||
|
||||
configManager.load();
|
||||
|
||||
config = configManager.getConfig(RuneliteConfig.class);
|
||||
|
||||
eventBus.register(menuManager);
|
||||
|
||||
renderer = new OverlayRenderer();
|
||||
|
||||
// Load the plugins, but does not start them yet.
|
||||
// This will initialize configuration
|
||||
pluginManager = new PluginManager(this);
|
||||
pluginManager.loadPlugins();
|
||||
|
||||
// Plugins have registered their config, so set default config
|
||||
// Plugins have provided their config, so set default config
|
||||
// to main settings
|
||||
configManager.loadDefault();
|
||||
|
||||
@@ -294,7 +296,7 @@ public class RuneLite
|
||||
wsclient.close();
|
||||
}
|
||||
|
||||
wsclient = new WSClient(session);
|
||||
wsclient = new WSClient(eventBus, executor, session);
|
||||
wsclient.connect();
|
||||
}
|
||||
|
||||
@@ -333,34 +335,14 @@ public class RuneLite
|
||||
eventBus.post(new SessionClose());
|
||||
}
|
||||
|
||||
private void eventExceptionHandler(Throwable exception, SubscriberExceptionContext context)
|
||||
{
|
||||
logger.warn("uncaught exception in event subscriber", exception);
|
||||
}
|
||||
|
||||
public static Client getClient()
|
||||
public Client getClient()
|
||||
{
|
||||
return client;
|
||||
}
|
||||
|
||||
public static void setClient(Client client)
|
||||
public void setClient(Client client)
|
||||
{
|
||||
RuneLite.client = client;
|
||||
}
|
||||
|
||||
public static RuneLite getRunelite()
|
||||
{
|
||||
return runelite;
|
||||
}
|
||||
|
||||
public static void setRunelite(RuneLite runelite)
|
||||
{
|
||||
RuneLite.runelite = runelite;
|
||||
}
|
||||
|
||||
public RuneliteProperties getProperties()
|
||||
{
|
||||
return properties;
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public ClientUI getGui()
|
||||
@@ -368,24 +350,19 @@ public class RuneLite
|
||||
return gui;
|
||||
}
|
||||
|
||||
public PluginManager getPluginManager()
|
||||
public void setGui(ClientUI gui)
|
||||
{
|
||||
return pluginManager;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public MenuManager getMenuManager()
|
||||
public static Injector getInjector()
|
||||
{
|
||||
return menuManager;
|
||||
return injector;
|
||||
}
|
||||
|
||||
public OverlayRenderer getRenderer()
|
||||
public static void setInjector(Injector injector)
|
||||
{
|
||||
return renderer;
|
||||
}
|
||||
|
||||
public EventBus getEventBus()
|
||||
{
|
||||
return eventBus;
|
||||
RuneLite.injector = injector;
|
||||
}
|
||||
|
||||
public static OptionSet getOptions()
|
||||
@@ -393,14 +370,9 @@ public class RuneLite
|
||||
return options;
|
||||
}
|
||||
|
||||
public ScheduledExecutorService getExecutor()
|
||||
public static void setOptions(OptionSet options)
|
||||
{
|
||||
return executor;
|
||||
}
|
||||
|
||||
public Scheduler getScheduler()
|
||||
{
|
||||
return scheduler;
|
||||
RuneLite.options = options;
|
||||
}
|
||||
|
||||
public static TrayIcon getTrayIcon()
|
||||
@@ -424,26 +396,6 @@ public class RuneLite
|
||||
return accountSession;
|
||||
}
|
||||
|
||||
public ConfigManager getConfigManager()
|
||||
{
|
||||
return configManager;
|
||||
}
|
||||
|
||||
public RuneliteConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
public ItemManager getItemManager()
|
||||
{
|
||||
return itemManager;
|
||||
}
|
||||
|
||||
public InfoBoxManager getInfoBoxManager()
|
||||
{
|
||||
return infoBoxManager;
|
||||
}
|
||||
|
||||
public <T> T[] runQuery(Query query)
|
||||
{
|
||||
return (T[]) query.result(client);
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.SubscriberExceptionContext;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.RuneliteConfig;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.task.Scheduler;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RuneliteModule extends AbstractModule
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(RuneliteModule.class);
|
||||
|
||||
@Override
|
||||
protected void configure()
|
||||
{
|
||||
bind(ScheduledExecutorService.class).toInstance(Executors.newSingleThreadScheduledExecutor());
|
||||
bind(MenuManager.class);
|
||||
bind(ItemManager.class);
|
||||
bind(InfoBoxManager.class);
|
||||
bind(Scheduler.class);
|
||||
bind(PluginManager.class);
|
||||
bind(RuneliteProperties.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
Client provideClient(RuneLite runelite)
|
||||
{
|
||||
return runelite.getClient();
|
||||
}
|
||||
|
||||
@Provides
|
||||
ClientUI provideClientUi(RuneLite runelite)
|
||||
{
|
||||
return runelite.getGui();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
RuneliteConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(RuneliteConfig.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
EventBus provideEventBus()
|
||||
{
|
||||
return new EventBus(RuneliteModule::eventExceptionHandler);
|
||||
}
|
||||
|
||||
private static void eventExceptionHandler(Throwable exception, SubscriberExceptionContext context)
|
||||
{
|
||||
logger.warn("uncaught exception in event subscriber", exception);
|
||||
}
|
||||
}
|
||||
@@ -52,17 +52,17 @@ public class WSClient extends WebSocketListener implements AutoCloseable
|
||||
private static final Duration PING_TIME = Duration.ofSeconds(30);
|
||||
|
||||
private static final Gson gson = WebsocketGsonFactory.build();
|
||||
private static final EventBus eventBus = RuneLite.getRunelite().getEventBus();
|
||||
private static final ScheduledExecutorService executor = RuneLite.getRunelite().getExecutor();
|
||||
|
||||
private final OkHttpClient client = new OkHttpClient();
|
||||
|
||||
private final EventBus eventBus;
|
||||
private final AccountSession session;
|
||||
private WebSocket webSocket;
|
||||
private final ScheduledFuture pingFuture;
|
||||
|
||||
public WSClient(AccountSession session)
|
||||
public WSClient(EventBus eventBus, ScheduledExecutorService executor, AccountSession session)
|
||||
{
|
||||
this.eventBus = eventBus;
|
||||
this.session = session;
|
||||
this.pingFuture = executor.scheduleWithFixedDelay(this::ping, PING_TIME.getSeconds(), PING_TIME.getSeconds(), TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package net.runelite.client.callback;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.inject.Injector;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
@@ -47,8 +49,12 @@ public class Hooks
|
||||
|
||||
private static final long CHECK = 600; // ms - how often to run checks
|
||||
|
||||
private static final RuneLite runelite = RuneLite.getRunelite();
|
||||
private static final DeathChecker death = new DeathChecker(runelite);
|
||||
private static final Injector injector = RuneLite.getInjector();
|
||||
private static final Client client = injector.getInstance(Client.class);
|
||||
private static final EventBus eventBus = injector.getInstance(EventBus.class);
|
||||
private static final Scheduler scheduler = injector.getInstance(Scheduler.class);
|
||||
private static final InfoBoxManager infoBoxManager = injector.getInstance(InfoBoxManager.class);
|
||||
private static final DeathChecker death = new DeathChecker(client, eventBus);
|
||||
|
||||
private static long lastCheck;
|
||||
|
||||
@@ -73,11 +79,9 @@ public class Hooks
|
||||
}
|
||||
|
||||
// tick pending scheduled tasks
|
||||
Scheduler scheduler = runelite.getScheduler();
|
||||
scheduler.tick();
|
||||
|
||||
// cull infoboxes
|
||||
InfoBoxManager infoBoxManager = runelite.getInfoBoxManager();
|
||||
infoBoxManager.cull();
|
||||
}
|
||||
|
||||
@@ -85,7 +89,7 @@ public class Hooks
|
||||
{
|
||||
BufferedImage image = (BufferedImage) mainBufferProvider.getImage();
|
||||
|
||||
OverlayRenderer renderer = runelite.getRenderer();
|
||||
OverlayRenderer renderer = injector.getInstance(OverlayRenderer.class);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -99,12 +103,6 @@ public class Hooks
|
||||
|
||||
public static void callHook(String name, int idx, Object object)
|
||||
{
|
||||
if (RuneLite.getClient() == null)
|
||||
{
|
||||
logger.warn("Event {} triggered prior to client being ready", name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (name)
|
||||
{
|
||||
case "experienceChanged":
|
||||
@@ -117,7 +115,7 @@ public class Hooks
|
||||
{
|
||||
Skill updatedSkill = possibleSkills[idx];
|
||||
experienceChanged.setSkill(updatedSkill);
|
||||
runelite.getEventBus().post(experienceChanged);
|
||||
eventBus.post(experienceChanged);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -125,42 +123,42 @@ public class Hooks
|
||||
{
|
||||
MapRegionChanged regionChanged = new MapRegionChanged();
|
||||
regionChanged.setIndex(idx);
|
||||
runelite.getEventBus().post(regionChanged);
|
||||
eventBus.post(regionChanged);
|
||||
break;
|
||||
}
|
||||
case "playerMenuOptionsChanged":
|
||||
{
|
||||
PlayerMenuOptionsChanged optionsChanged = new PlayerMenuOptionsChanged();
|
||||
optionsChanged.setIndex(idx);
|
||||
runelite.getEventBus().post(optionsChanged);
|
||||
eventBus.post(optionsChanged);
|
||||
break;
|
||||
}
|
||||
case "animationChanged":
|
||||
{
|
||||
AnimationChanged animationChange = new AnimationChanged();
|
||||
animationChange.setObject(object);
|
||||
runelite.getEventBus().post(animationChange);
|
||||
eventBus.post(animationChange);
|
||||
break;
|
||||
}
|
||||
case "gameStateChanged":
|
||||
{
|
||||
GameStateChanged gameStateChange = new GameStateChanged();
|
||||
gameStateChange.setGameState(RuneLite.getClient().getGameState());
|
||||
runelite.getEventBus().post(gameStateChange);
|
||||
gameStateChange.setGameState(client.getGameState());
|
||||
eventBus.post(gameStateChange);
|
||||
break;
|
||||
}
|
||||
case "varbitChanged":
|
||||
{
|
||||
VarbitChanged varbitChanged = new VarbitChanged();
|
||||
runelite.getEventBus().post(varbitChanged);
|
||||
eventBus.post(varbitChanged);
|
||||
break;
|
||||
}
|
||||
case "resizeChanged":
|
||||
{
|
||||
//maybe couple with varbitChanged. resizeable may not be a varbit but it would fit with the other client settings.
|
||||
ResizeableChanged resizeableChanged = new ResizeableChanged();
|
||||
resizeableChanged.setResized(RuneLite.getClient().isResized());
|
||||
runelite.getEventBus().post(resizeableChanged);
|
||||
resizeableChanged.setResized(client.isResized());
|
||||
eventBus.post(resizeableChanged);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -196,7 +194,7 @@ public class Hooks
|
||||
menuOptionClicked.setMenuAction(MenuAction.of(menuAction));
|
||||
menuOptionClicked.setId(id);
|
||||
|
||||
runelite.getEventBus().post(menuOptionClicked);
|
||||
eventBus.post(menuOptionClicked);
|
||||
}
|
||||
|
||||
public static void addChatMessage(int type, String sender, String message, String clan)
|
||||
@@ -209,7 +207,7 @@ public class Hooks
|
||||
ChatMessageType chatMessageType = ChatMessageType.of(type);
|
||||
ChatMessage chatMessage = new ChatMessage(chatMessageType, sender, message, clan);
|
||||
|
||||
runelite.getEventBus().post(chatMessage);
|
||||
eventBus.post(chatMessage);
|
||||
}
|
||||
|
||||
public static void setMessage(MessageNode messageNode, int type, String name, String sender, String value)
|
||||
@@ -223,6 +221,6 @@ public class Hooks
|
||||
setMessage.setSender(sender);
|
||||
setMessage.setValue(value);
|
||||
|
||||
runelite.getEventBus().post(setMessage);
|
||||
eventBus.post(setMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.config;
|
||||
|
||||
public interface Config
|
||||
{
|
||||
|
||||
}
|
||||
@@ -25,8 +25,9 @@
|
||||
package net.runelite.client.config;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Key;
|
||||
import java.awt.Color;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -37,27 +38,38 @@ import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.account.AccountSession;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.http.api.config.ConfigClient;
|
||||
import net.runelite.http.api.config.ConfigEntry;
|
||||
import net.runelite.http.api.config.Configuration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class ConfigManager
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConfigManager.class);
|
||||
|
||||
private static final String SETTINGS_FILE_NAME = "settings.properties";
|
||||
|
||||
private final EventBus eventBus;
|
||||
@Inject
|
||||
EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
@Inject
|
||||
PluginManager pluginManager;
|
||||
|
||||
private AccountSession session;
|
||||
private ConfigClient client;
|
||||
private File propertiesFile;
|
||||
@@ -65,11 +77,8 @@ public class ConfigManager
|
||||
private final ConfigInvocationHandler handler = new ConfigInvocationHandler(this);
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
private final List<Object> configProxies = new ArrayList<>();
|
||||
|
||||
public ConfigManager(EventBus eventBus)
|
||||
public ConfigManager()
|
||||
{
|
||||
this.eventBus = eventBus;
|
||||
this.propertiesFile = getPropertiesFile();
|
||||
}
|
||||
|
||||
@@ -79,14 +88,31 @@ public class ConfigManager
|
||||
switchSession(session);
|
||||
}
|
||||
|
||||
public Collection<Object> getConfigProxies()
|
||||
public List<Config> getConfigProxies()
|
||||
{
|
||||
return Collections.unmodifiableCollection(configProxies);
|
||||
List<Injector> injectors = new ArrayList<>();
|
||||
injectors.add(RuneLite.getInjector());
|
||||
pluginManager.getAllPlugins().forEach(pl -> injectors.add(pl.getInjector()));
|
||||
|
||||
List<Config> list = new ArrayList<>();
|
||||
for (Injector injector : injectors)
|
||||
{
|
||||
for (Key<?> key : injector.getAllBindings().keySet())
|
||||
{
|
||||
Class<?> type = key.getTypeLiteral().getRawType();
|
||||
if (Config.class.isAssignableFrom(type))
|
||||
{
|
||||
Config config = (Config) injector.getInstance(key);
|
||||
list.add(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void loadDefault()
|
||||
{
|
||||
for (Object config : configProxies)
|
||||
for (Object config : getConfigProxies())
|
||||
{
|
||||
setDefaultConfiguration(config);
|
||||
}
|
||||
@@ -214,8 +240,6 @@ public class ConfigManager
|
||||
clazz
|
||||
}, handler);
|
||||
|
||||
configProxies.add(t);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -243,7 +267,7 @@ public class ConfigManager
|
||||
logger.warn("unable to set configuration item", ex);
|
||||
}
|
||||
};
|
||||
RuneLite.getRunelite().getExecutor().execute(task);
|
||||
executor.execute(task);
|
||||
|
||||
}
|
||||
|
||||
@@ -312,16 +336,16 @@ public class ConfigManager
|
||||
|
||||
List<ConfigItemDescriptor> items = Arrays.stream(inter.getMethods())
|
||||
.filter(m -> m.getParameterCount() == 0)
|
||||
.sorted((m1, m2) ->
|
||||
Integer.compare(
|
||||
m1.getDeclaredAnnotation(ConfigItem.class).position(),
|
||||
m2.getDeclaredAnnotation(ConfigItem.class).position()
|
||||
)
|
||||
.sorted((m1, m2)
|
||||
-> Integer.compare(
|
||||
m1.getDeclaredAnnotation(ConfigItem.class).position(),
|
||||
m2.getDeclaredAnnotation(ConfigItem.class).position()
|
||||
)
|
||||
)
|
||||
.map(m -> new ConfigItemDescriptor(
|
||||
m.getDeclaredAnnotation(ConfigItem.class),
|
||||
m.getReturnType()
|
||||
))
|
||||
m.getDeclaredAnnotation(ConfigItem.class),
|
||||
m.getReturnType()
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
return new ConfigDescriptor(group, items);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ package net.runelite.client.config;
|
||||
name = "Runelite",
|
||||
description = "Configuration for Runelite client options"
|
||||
)
|
||||
public interface RuneliteConfig
|
||||
public interface RuneliteConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "tooltipLeft",
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
*/
|
||||
package net.runelite.client.game;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import java.lang.ref.WeakReference;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.events.ActorDeath;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -37,13 +37,14 @@ public class DeathChecker
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(DeathChecker.class);
|
||||
|
||||
private final RuneLite runelite;
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final EventBus eventBus;
|
||||
private final Client client;
|
||||
private WeakReference<Actor> last = new WeakReference<>(null);
|
||||
|
||||
public DeathChecker(RuneLite runelite)
|
||||
public DeathChecker(Client client, EventBus eventBus)
|
||||
{
|
||||
this.runelite = runelite;
|
||||
this.client = client;
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
public void check()
|
||||
@@ -66,7 +67,7 @@ public class DeathChecker
|
||||
ActorDeath death = new ActorDeath();
|
||||
death.setActor(opponent);
|
||||
|
||||
runelite.getEventBus().post(death);
|
||||
eventBus.post(death);
|
||||
}
|
||||
|
||||
private Actor getOpponent()
|
||||
|
||||
@@ -30,13 +30,17 @@ import com.google.common.cache.LoadingCache;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.SpritePixels;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.http.api.item.ItemClient;
|
||||
import net.runelite.http.api.item.ItemPrice;
|
||||
|
||||
@Singleton
|
||||
public class ItemManager
|
||||
{
|
||||
/**
|
||||
@@ -49,17 +53,19 @@ public class ItemManager
|
||||
*/
|
||||
static final ItemPrice NONE = new ItemPrice();
|
||||
|
||||
|
||||
private final Client client;
|
||||
private final ItemClient itemClient = new ItemClient();
|
||||
private final LoadingCache<Integer, ItemPrice> itemPrices;
|
||||
private final LoadingCache<Integer, BufferedImage> itemImages;
|
||||
|
||||
public ItemManager(RuneLite runelite)
|
||||
@Inject
|
||||
public ItemManager(@Nullable Client client, ScheduledExecutorService executor)
|
||||
{
|
||||
this.client = client;
|
||||
itemPrices = CacheBuilder.newBuilder()
|
||||
.maximumSize(512L)
|
||||
.expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build(new ItemPriceLoader(runelite, itemClient));
|
||||
.build(new ItemPriceLoader(executor, itemClient));
|
||||
|
||||
itemImages = CacheBuilder.newBuilder()
|
||||
.maximumSize(200)
|
||||
@@ -135,12 +141,12 @@ public class ItemManager
|
||||
|
||||
/**
|
||||
* Loads item sprite from game, makes transparent, and generates image
|
||||
*
|
||||
* @param itemId
|
||||
* @return
|
||||
*/
|
||||
private BufferedImage loadImage(int itemId)
|
||||
{
|
||||
Client client = RuneLite.getClient();
|
||||
SpritePixels sprite = client.createItemSprite(itemId, 1, 1, SpritePixels.DEFAULT_SHADOW_COLOR, 0, false);
|
||||
int[] pixels = sprite.getPixels();
|
||||
int[] transPixels = new int[pixels.length];
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import java.io.IOException;
|
||||
import net.runelite.client.RuneLite;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import static net.runelite.client.game.ItemManager.EMPTY;
|
||||
import static net.runelite.client.game.ItemManager.NONE;
|
||||
import net.runelite.http.api.item.ItemClient;
|
||||
@@ -44,9 +44,9 @@ class ItemPriceLoader extends CacheLoader<Integer, ItemPrice>
|
||||
private final ListeningExecutorService executorService;
|
||||
private final ItemClient client;
|
||||
|
||||
ItemPriceLoader(RuneLite runelite, ItemClient client)
|
||||
ItemPriceLoader(ScheduledExecutorService executor, ItemClient client)
|
||||
{
|
||||
this.executorService = MoreExecutors.listeningDecorator(runelite.getExecutor());
|
||||
this.executorService = MoreExecutors.listeningDecorator(executor);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,18 +25,22 @@
|
||||
package net.runelite.client.menus;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.events.MenuOptionClicked;
|
||||
import net.runelite.client.events.PlayerMenuOptionClicked;
|
||||
import net.runelite.client.events.PlayerMenuOptionsChanged;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class MenuManager
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(MenuManager.class);
|
||||
@@ -47,14 +51,17 @@ public class MenuManager
|
||||
private static final int IDX_LOWER = 4;
|
||||
private static final int IDX_UPPER = 8;
|
||||
|
||||
private final RuneLite runeLite;
|
||||
private final Provider<Client> clientProvider;
|
||||
private final EventBus eventBus;
|
||||
|
||||
//Maps the indexes that are being used to the menu option.
|
||||
private final Map<Integer, String> playerMenuIndexMap = new HashMap<>();
|
||||
|
||||
public MenuManager(RuneLite runeLite)
|
||||
@Inject
|
||||
public MenuManager(Provider<Client> clientProvider, EventBus eventBus)
|
||||
{
|
||||
this.runeLite = runeLite;
|
||||
this.clientProvider = clientProvider;
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
public void addPlayerMenuItem(String menuText)
|
||||
@@ -110,12 +117,12 @@ public class MenuManager
|
||||
playerMenuOptionClicked.setMenuOption(event.getMenuOption());
|
||||
playerMenuOptionClicked.setMenuTarget(username);
|
||||
|
||||
runeLite.getEventBus().post(playerMenuOptionClicked);
|
||||
eventBus.post(playerMenuOptionClicked);
|
||||
}
|
||||
|
||||
private void addPlayerMenuItem(int playerOptionIndex, String menuText)
|
||||
{
|
||||
Client client = RuneLite.getClient();
|
||||
Client client = clientProvider.get();
|
||||
|
||||
client.getPlayerOptions()[playerOptionIndex] = menuText;
|
||||
client.getPlayerOptionsPriorities()[playerOptionIndex] = true;
|
||||
@@ -133,7 +140,7 @@ public class MenuManager
|
||||
{
|
||||
int index = IDX_LOWER;
|
||||
|
||||
Client client = RuneLite.getClient();
|
||||
Client client = clientProvider.get();
|
||||
if (client == null)
|
||||
{
|
||||
return IDX_UPPER;
|
||||
|
||||
@@ -25,14 +25,39 @@
|
||||
package net.runelite.client.plugins;
|
||||
|
||||
import com.google.common.util.concurrent.AbstractIdleService;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.Executor;
|
||||
import javax.swing.SwingUtilities;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
|
||||
public abstract class Plugin extends AbstractIdleService
|
||||
public abstract class Plugin extends AbstractIdleService implements Module
|
||||
{
|
||||
protected Injector injector;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public final Injector getInjector()
|
||||
{
|
||||
return injector;
|
||||
}
|
||||
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
return null;
|
||||
@@ -46,9 +71,7 @@ public abstract class Plugin extends AbstractIdleService
|
||||
|
||||
/**
|
||||
* Override AbstractIdleService's default executor to instead execute in
|
||||
* the main thread. Prevents plugins from all being initialized from
|
||||
* different threads, which causes the plugin order on the navbar to be
|
||||
* undefined
|
||||
* the AWT event dispatch thread.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -25,38 +25,46 @@
|
||||
package net.runelite.client.plugins;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.reflect.ClassPath;
|
||||
import com.google.common.reflect.ClassPath.ClassInfo;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.google.common.util.concurrent.Service;
|
||||
import com.google.common.util.concurrent.ServiceManager;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.task.ScheduledMethod;
|
||||
import net.runelite.client.task.Scheduler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class PluginManager
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(PluginManager.class);
|
||||
|
||||
private static final String PLUGIN_PACKAGE = "net.runelite.client.plugins";
|
||||
|
||||
private final RuneLite runelite;
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
private Scheduler scheduler;
|
||||
|
||||
private ServiceManager manager;
|
||||
private final List<Plugin> plugins = new ArrayList<>();
|
||||
|
||||
public PluginManager(RuneLite runelite)
|
||||
{
|
||||
this.runelite = runelite;
|
||||
}
|
||||
|
||||
public void loadPlugins() throws IOException
|
||||
{
|
||||
boolean developerPlugins = false;
|
||||
@@ -108,6 +116,16 @@ public class PluginManager
|
||||
}
|
||||
|
||||
plugins.add(plugin);
|
||||
|
||||
Module pluginModule = (Binder binder) ->
|
||||
{
|
||||
binder.bind((Class<Plugin>) clazz).toInstance(plugin);
|
||||
binder.install(plugin);
|
||||
};
|
||||
Injector pluginInjector = RuneLite.getInjector().createChildInjector(pluginModule);
|
||||
pluginInjector.injectMembers(plugin);
|
||||
plugin.injector = pluginInjector;
|
||||
|
||||
logger.debug("Loaded plugin {}", pluginDescriptor.name());
|
||||
}
|
||||
}
|
||||
@@ -123,7 +141,7 @@ public class PluginManager
|
||||
public void running()
|
||||
{
|
||||
logger.debug("Plugin {} is now running", plugin);
|
||||
runelite.getEventBus().register(plugin);
|
||||
eventBus.register(plugin);
|
||||
|
||||
schedule(plugin);
|
||||
}
|
||||
@@ -132,7 +150,7 @@ public class PluginManager
|
||||
public void stopping(Service.State from)
|
||||
{
|
||||
logger.debug("Plugin {} is stopping", plugin);
|
||||
runelite.getEventBus().unregister(plugin);
|
||||
eventBus.unregister(plugin);
|
||||
unschedule(plugin);
|
||||
}
|
||||
|
||||
@@ -143,7 +161,7 @@ public class PluginManager
|
||||
|
||||
if (from == Service.State.RUNNING)
|
||||
{
|
||||
runelite.getEventBus().unregister(plugin);
|
||||
eventBus.unregister(plugin);
|
||||
unschedule(plugin);
|
||||
}
|
||||
}
|
||||
@@ -158,6 +176,21 @@ public class PluginManager
|
||||
manager.startAsync();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all plugins regardless of state
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Collection<Plugin> getAllPlugins()
|
||||
{
|
||||
return plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get running plugins
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Collection<Plugin> getPlugins()
|
||||
{
|
||||
return manager.servicesByState().get(Service.State.RUNNING)
|
||||
@@ -180,13 +213,13 @@ public class PluginManager
|
||||
ScheduledMethod scheduledMethod = new ScheduledMethod(schedule, method, plugin);
|
||||
logger.debug("Scheduled task {}", scheduledMethod);
|
||||
|
||||
runelite.getScheduler().addScheduledMethod(scheduledMethod);
|
||||
scheduler.addScheduledMethod(scheduledMethod);
|
||||
}
|
||||
}
|
||||
|
||||
private void unschedule(Plugin plugin)
|
||||
{
|
||||
List<ScheduledMethod> methods = new ArrayList<>(runelite.getScheduler().getScheduledMethods());
|
||||
List<ScheduledMethod> methods = new ArrayList<>(scheduler.getScheduledMethods());
|
||||
|
||||
for (ScheduledMethod method : methods)
|
||||
{
|
||||
@@ -196,7 +229,7 @@ public class PluginManager
|
||||
}
|
||||
|
||||
logger.debug("Removing scheduled task {}", method);
|
||||
runelite.getScheduler().removeScheduledMethod(method);
|
||||
scheduler.removeScheduledMethod(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.net.URISyntaxException;
|
||||
import java.time.Instant;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.ImageIcon;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.account.AccountSession;
|
||||
@@ -57,8 +58,14 @@ public class AccountPlugin extends Plugin
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(AccountPlugin.class);
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final ClientUI ui = runelite.getGui();
|
||||
@Inject
|
||||
RuneLite runelite;
|
||||
|
||||
@Inject
|
||||
ClientUI ui;
|
||||
|
||||
@Inject
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
private NavigationButton loginButton;
|
||||
private NavigationButton logoutButton;
|
||||
@@ -83,14 +90,8 @@ public class AccountPlugin extends Plugin
|
||||
ui.getPluginToolbar().addNavigation(loginButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
private void loginClick(ActionEvent ae)
|
||||
{
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.execute(RunnableExceptionLogger.wrap(this::openLoginPage));
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.boosts;
|
||||
|
||||
import net.runelite.client.RuneLite;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -35,27 +37,24 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class Boosts extends Plugin
|
||||
{
|
||||
private final BoostsConfig config = RuneLite.getRunelite().getConfigManager().getConfig(BoostsConfig.class);
|
||||
private final Overlay overlay = new BoostsOverlay(this);
|
||||
@Inject
|
||||
BoostsOverlay boostsOverlay;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(BoostsOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
BoostsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BoostsConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public BoostsConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
return boostsOverlay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,13 +26,14 @@ package net.runelite.client.plugins.boosts;
|
||||
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Config;
|
||||
|
||||
@ConfigGroup(
|
||||
keyName = "boosts",
|
||||
name = "Boosts Info",
|
||||
description = "Configuration for the Boosts plugin"
|
||||
)
|
||||
public interface BoostsConfig
|
||||
public interface BoostsConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -25,18 +25,18 @@
|
||||
package net.runelite.client.plugins.boosts;
|
||||
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
|
||||
class BoostsOverlay extends Overlay
|
||||
{
|
||||
@@ -62,19 +62,20 @@ class BoostsOverlay extends Overlay
|
||||
|
||||
private static final int SEPARATOR = 2;
|
||||
|
||||
private final Client client;
|
||||
private final BoostsConfig config;
|
||||
|
||||
BoostsOverlay(Boosts plugin)
|
||||
@Inject
|
||||
BoostsOverlay(@Nullable Client client, BoostsConfig config)
|
||||
{
|
||||
super(OverlayPosition.TOP_LEFT, OverlayPriority.MED);
|
||||
this.config = plugin.getConfig();
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
Client client = RuneLite.getClient();
|
||||
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !config.enabled())
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
package net.runelite.client.plugins.bosstimer;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.events.ActorDeath;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -42,17 +42,8 @@ public class BossTimers extends Plugin
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(BossTimers.class);
|
||||
|
||||
private final InfoBoxManager infoBoxManager = RuneLite.getRunelite().getInfoBoxManager();
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
@Inject
|
||||
InfoBoxManager infoBoxManager;
|
||||
|
||||
@Subscribe
|
||||
public void onActorDeath(ActorDeath death)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.runelite.client.plugins.chatcommands;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
@@ -34,13 +35,15 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.SetMessage;
|
||||
import net.runelite.client.events.ResizeableChanged;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
@@ -70,22 +73,27 @@ public class ChatCommands extends Plugin
|
||||
|
||||
private final String colKeyword = "<colRegular>";
|
||||
private final String colKeywordHighLight = "<colHighlight>";
|
||||
private final ChatCommandsConfig config = RuneLite.getRunelite().getConfigManager().getConfig(ChatCommandsConfig.class);
|
||||
private final ItemManager itemManager = RuneLite.getRunelite().getItemManager();
|
||||
private final ItemClient itemClient = new ItemClient();
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final HiscoreClient hiscoreClient = new HiscoreClient();
|
||||
private int transparancyVarbit = -1;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
@Inject
|
||||
ChatCommandsConfig config;
|
||||
|
||||
@Inject
|
||||
ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
@Provides
|
||||
ChatCommandsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(ChatCommandsConfig.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +112,6 @@ public class ChatCommands extends Plugin
|
||||
else if (transparancyVarbit != client.getSetting(Varbits.TRANSPARANT_CHATBOX))
|
||||
{
|
||||
transparancyVarbit = client.getSetting(Varbits.TRANSPARANT_CHATBOX);
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.submit(() -> recolorChat());
|
||||
}
|
||||
}
|
||||
@@ -112,7 +119,6 @@ public class ChatCommands extends Plugin
|
||||
@Subscribe
|
||||
public void onResizableChanged(ResizeableChanged event)
|
||||
{
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.submit(() -> recolorChat());
|
||||
}
|
||||
|
||||
@@ -141,7 +147,6 @@ public class ChatCommands extends Plugin
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.submit(() -> recolorChat());
|
||||
}
|
||||
|
||||
@@ -179,7 +184,6 @@ public class ChatCommands extends Plugin
|
||||
if (config.lvl() && message.toLowerCase().equals("!total"))
|
||||
{
|
||||
logger.debug("Running total level lookup");
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.submit(() -> playerSkillLookup(setMessage.getType(), setMessage, "total"));
|
||||
}
|
||||
else if (config.price() && message.toLowerCase().startsWith("!price") && message.length() > 7)
|
||||
@@ -188,7 +192,6 @@ public class ChatCommands extends Plugin
|
||||
|
||||
logger.debug("Running price lookup for {}", search);
|
||||
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.submit(() -> lookup(setMessage.getType(), setMessage.getMessageNode(), search));
|
||||
}
|
||||
else if (config.lvl() && message.toLowerCase().startsWith("!lvl") && message.length() > 5)
|
||||
@@ -196,7 +199,6 @@ public class ChatCommands extends Plugin
|
||||
String search = message.substring(5);
|
||||
|
||||
logger.debug("Running level lookup for {}", search);
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.submit(() -> playerSkillLookup(setMessage.getType(), setMessage, search));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.chatcommands;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -33,7 +34,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Chat commands",
|
||||
description = "Configuration for chat commands"
|
||||
)
|
||||
public interface ChatCommandsConfig
|
||||
public interface ChatCommandsConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
package net.runelite.client.plugins.clanchat;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
@@ -38,15 +40,9 @@ import net.runelite.client.task.Schedule;
|
||||
)
|
||||
public class ClanChat extends Plugin
|
||||
{
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Schedule(
|
||||
period = 600,
|
||||
@@ -54,15 +50,15 @@ public class ClanChat extends Plugin
|
||||
)
|
||||
public void updateClanChatTitle()
|
||||
{
|
||||
if (RuneLite.getClient().getGameState() != GameState.LOGGED_IN)
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Widget clanChatTitleWidget = RuneLite.getClient().getWidget(WidgetInfo.CLAN_CHAT_TITLE);
|
||||
Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
|
||||
if (clanChatTitleWidget != null)
|
||||
{
|
||||
clanChatTitleWidget.setText("Clan Chat (" + RuneLite.getClient().getClanChatCount() + "/100)");
|
||||
clanChatTitleWidget.setText("Clan Chat (" + client.getClanChatCount() + "/100)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
package net.runelite.client.plugins.cluescrolls;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -35,7 +36,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Clue Scrolls",
|
||||
description = "Configuration for the clue scroll plugin"
|
||||
)
|
||||
public interface ClueScrollConfig
|
||||
public interface ClueScrollConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -26,13 +26,17 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.cluescrolls;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
@@ -49,17 +53,18 @@ public class ClueScrollOverlay extends Overlay
|
||||
|
||||
private static final Duration WAIT_DURATION = Duration.ofMinutes(4);
|
||||
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final Client client;
|
||||
private final ClueScrollConfig config;
|
||||
|
||||
ClueScroll clue;
|
||||
Instant clueTimeout;
|
||||
|
||||
private final ClueScrollConfig config;
|
||||
|
||||
public ClueScrollOverlay(ClueScrollPlugin plugin)
|
||||
@Inject
|
||||
public ClueScrollOverlay(@Nullable Client client, ClueScrollConfig config)
|
||||
{
|
||||
super(OverlayPosition.TOP_LEFT, OverlayPriority.LOW);
|
||||
this.config = plugin.getConfig();
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,13 +26,17 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.cluescrolls;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
@@ -42,32 +46,32 @@ import net.runelite.client.task.Schedule;
|
||||
)
|
||||
public class ClueScrollPlugin extends Plugin
|
||||
{
|
||||
private final Client client = RuneLite.getClient();
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
private final ClueScrollConfig config = RuneLite.getRunelite().getConfigManager().getConfig(ClueScrollConfig.class);
|
||||
private final ClueScrollOverlay overlay = new ClueScrollOverlay(this);
|
||||
@Inject
|
||||
ClueScrollConfig config;
|
||||
|
||||
@Inject
|
||||
ClueScrollOverlay clueScrollOverlay;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(ClueScrollOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
ClueScrollConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(ClueScrollConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClueScrollOverlay getOverlay()
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ClueScrollConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
return clueScrollOverlay;
|
||||
}
|
||||
|
||||
@Schedule(
|
||||
@@ -93,19 +97,19 @@ public class ClueScrollPlugin extends Plugin
|
||||
|
||||
if (clue == null)
|
||||
{
|
||||
overlay.clue = null;
|
||||
clueScrollOverlay.clue = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (clue.getType() == ClueScrollType.EMOTE)
|
||||
{
|
||||
overlay.clue = clue;
|
||||
clueScrollOverlay.clue = clue;
|
||||
|
||||
overlay.clueTimeout = Instant.now();
|
||||
clueScrollOverlay.clueTimeout = Instant.now();
|
||||
return;
|
||||
}
|
||||
|
||||
overlay.clue = null;
|
||||
clueScrollOverlay.clue = null;
|
||||
|
||||
//check for <col=ffffff> which tells us if the string has already been built
|
||||
if (clueScroll.getText().contains("<col=ffffff>"))
|
||||
|
||||
@@ -24,39 +24,40 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.combatlevel;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Combat level plugin"
|
||||
)
|
||||
public class CombatLevel extends Plugin
|
||||
{
|
||||
private final CombatLevelConfig config = RuneLite.getRunelite().getConfigManager().getConfig(CombatLevelConfig.class);
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final DecimalFormat decimalFormat = new DecimalFormat("#.###");
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Inject
|
||||
CombatLevelConfig config;
|
||||
|
||||
@Provides
|
||||
CombatLevelConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
return configManager.getConfig(CombatLevelConfig.class);
|
||||
}
|
||||
|
||||
@Schedule(
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.combatlevel;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Combat Level",
|
||||
description = "Configuration for the precise combat level plugin"
|
||||
)
|
||||
public interface CombatLevelConfig
|
||||
public interface CombatLevelConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -57,7 +57,6 @@ import javax.swing.SwingConstants;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigDescriptor;
|
||||
import net.runelite.client.config.ConfigItemDescriptor;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -73,12 +72,13 @@ public class ConfigPanel extends PluginPanel
|
||||
private static final int TEXT_FIELD_WIDTH = 7;
|
||||
private static final int SPINNER_FIELD_WIDTH = 6;
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final ConfigManager configManager;
|
||||
|
||||
private JScrollPane scrollPane;
|
||||
|
||||
public ConfigPanel()
|
||||
public ConfigPanel(ConfigManager configManager)
|
||||
{
|
||||
this.configManager = configManager;
|
||||
setMinimumSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
setSize(PANEL_WIDTH, PANEL_HEIGHT);
|
||||
@@ -94,9 +94,8 @@ public class ConfigPanel extends PluginPanel
|
||||
private List<ConfigDescriptor> getConfig()
|
||||
{
|
||||
List<ConfigDescriptor> list = new ArrayList<>();
|
||||
for (Object config : runelite.getConfigManager().getConfigProxies())
|
||||
for (Object config : configManager.getConfigProxies())
|
||||
{
|
||||
ConfigManager configManager = runelite.getConfigManager();
|
||||
ConfigDescriptor configDescriptor = configManager.getConfigDescriptor(config);
|
||||
|
||||
list.add(configDescriptor);
|
||||
@@ -111,7 +110,6 @@ public class ConfigPanel extends PluginPanel
|
||||
panel.setLayout(new GridLayout(0, 1, 0, 3));
|
||||
panel.add(new JLabel("Plugin Configuration", SwingConstants.CENTER));
|
||||
|
||||
ConfigManager configManager = runelite.getConfigManager();
|
||||
List<ConfigDescriptor> config = getConfig();
|
||||
|
||||
// Sort by name
|
||||
@@ -138,7 +136,6 @@ public class ConfigPanel extends PluginPanel
|
||||
|
||||
private void changeConfiguration(JComponent component, ConfigDescriptor cd, ConfigItemDescriptor cid)
|
||||
{
|
||||
ConfigManager configManager = runelite.getConfigManager();
|
||||
if (component instanceof JCheckBox)
|
||||
{
|
||||
JCheckBox checkbox = (JCheckBox) component;
|
||||
@@ -237,7 +234,6 @@ public class ConfigPanel extends PluginPanel
|
||||
public void mouseClicked(MouseEvent e)
|
||||
{
|
||||
final JFrame parent = new JFrame();
|
||||
parent.setLocation(RuneLite.getRunelite().getGui().getX(), RuneLite.getRunelite().getGui().getY());
|
||||
JColorChooser jColorChooser = new JColorChooser(Color.decode(configManager.getConfiguration(cd.getGroup().keyName(), cid.getItem().keyName())));
|
||||
jColorChooser.getSelectionModel().addChangeListener(new ChangeListener()
|
||||
{
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
package net.runelite.client.plugins.config;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.ImageIcon;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
@@ -41,8 +42,11 @@ public class ConfigPlugin extends Plugin
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConfigPlugin.class);
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final ClientUI ui = runelite.getGui();
|
||||
@Inject
|
||||
ClientUI ui;
|
||||
|
||||
@Inject
|
||||
ConfigManager configManager;
|
||||
|
||||
private NavigationButton navButton;
|
||||
|
||||
@@ -57,14 +61,9 @@ public class ConfigPlugin extends Plugin
|
||||
ui.getPluginToolbar().addNavigation(navButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
private ConfigPanel buildPanel()
|
||||
{
|
||||
ConfigPanel panel = new ConfigPanel();
|
||||
ConfigPanel panel = new ConfigPanel(configManager);
|
||||
panel.init();
|
||||
return panel;
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.devtools;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import java.awt.Font;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.ImageIcon;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
@@ -43,10 +43,14 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class DevTools extends Plugin
|
||||
{
|
||||
private final DevToolsOverlay overlay = new DevToolsOverlay(this);
|
||||
private DevToolsPanel panel;
|
||||
@Inject
|
||||
ClientUI ui;
|
||||
|
||||
@Inject
|
||||
DevToolsOverlay overlay;
|
||||
|
||||
private NavigationButton navButton;
|
||||
private final ClientUI ui = RuneLite.getRunelite().getGui();
|
||||
private DevToolsPanel panel;
|
||||
|
||||
private boolean togglePlayers;
|
||||
private boolean toggleNpcs;
|
||||
@@ -62,10 +66,17 @@ public class DevTools extends Plugin
|
||||
|
||||
private Font font;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(DevToolsOverlay.class);
|
||||
binder.bind(DevToolsPanel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
panel = new DevToolsPanel(this);
|
||||
panel = injector.getInstance(DevToolsPanel.class);
|
||||
navButton = new NavigationButton("DevTools", () -> panel);
|
||||
|
||||
ImageIcon icon = new ImageIcon(ImageIO.read(getClass().getResourceAsStream("devtools_icon.png")));
|
||||
@@ -77,11 +88,6 @@ public class DevTools extends Plugin
|
||||
.deriveFont(Font.BOLD, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
|
||||
@@ -35,6 +35,8 @@ import java.awt.Rectangle;
|
||||
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.DecorativeObject;
|
||||
import net.runelite.api.GameObject;
|
||||
@@ -51,7 +53,6 @@ import net.runelite.api.WallObject;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetItem;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
@@ -74,12 +75,14 @@ public class DevToolsOverlay extends Overlay
|
||||
private static final int REGION_SIZE = 104;
|
||||
private static final int MAX_DISTANCE = 2400;
|
||||
|
||||
private final Client client;
|
||||
private final DevTools plugin;
|
||||
private final Client client = RuneLite.getClient();
|
||||
|
||||
public DevToolsOverlay(DevTools plugin)
|
||||
@Inject
|
||||
public DevToolsOverlay(@Nullable Client client, DevTools plugin)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ package net.runelite.client.plugins.devtools;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
@@ -37,7 +39,6 @@ import net.runelite.api.widgets.Widget;
|
||||
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
|
||||
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
||||
import net.runelite.api.widgets.WidgetItem;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -48,8 +49,6 @@ public class DevToolsPanel extends PluginPanel
|
||||
|
||||
private final EmptyBorder PADDING_BORDER = new EmptyBorder(3, 3, 3, 3);
|
||||
|
||||
private final Client client = RuneLite.getClient();
|
||||
|
||||
private JButton renderPlayersBtn = new JButton();
|
||||
private JButton renderNpcsBtn = new JButton();
|
||||
private JButton renderGroundItemsBtn = new JButton();
|
||||
@@ -69,14 +68,19 @@ public class DevToolsPanel extends PluginPanel
|
||||
private JLabel typeLbl = new JLabel();
|
||||
private JLabel contentTypeLbl = new JLabel();
|
||||
|
||||
private DevTools plugin;
|
||||
private final Client client;
|
||||
private final DevTools plugin;
|
||||
|
||||
private final SettingsTracker settingsTracker = new SettingsTracker(client);
|
||||
private final SettingsTracker settingsTracker;
|
||||
|
||||
public DevToolsPanel(DevTools plugin)
|
||||
@Inject
|
||||
public DevToolsPanel(@Nullable Client client, DevTools plugin)
|
||||
{
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
|
||||
settingsTracker = new SettingsTracker(client);
|
||||
|
||||
setMinimumSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
setSize(PANEL_WIDTH, PANEL_HEIGHT);
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.time.Instant;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import net.runelite.client.RuneLite;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.events.ChatMessage;
|
||||
import net.runelite.client.events.GameStateChanged;
|
||||
import net.runelite.client.events.MenuOptionClicked;
|
||||
@@ -54,22 +54,14 @@ public class ExaminePlugin extends Plugin
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(ExaminePlugin.class);
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final ExamineClient client = new ExamineClient();
|
||||
private final Deque<PendingExamine> pending = new ArrayDeque<>();
|
||||
private final Cache<CacheKey, Boolean> cache = CacheBuilder.newBuilder()
|
||||
.maximumSize(128L)
|
||||
.build();
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
@Inject
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChange(GameStateChanged event)
|
||||
@@ -149,7 +141,6 @@ public class ExaminePlugin extends Plugin
|
||||
|
||||
cache.put(key, Boolean.TRUE);
|
||||
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.submit(() -> submit(pendingExamine, event.getMessage()));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.fightcave;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.NPC;
|
||||
@@ -31,41 +35,39 @@ import net.runelite.api.Query;
|
||||
import net.runelite.api.queries.NPCQuery;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Fight cave plugin"
|
||||
)
|
||||
public class FightCave extends Plugin
|
||||
{
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final FightCaveOverlay overlay = new FightCaveOverlay(this);
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Inject
|
||||
RuneLite runelite;
|
||||
|
||||
@Inject
|
||||
FightCaveOverlay overlay;
|
||||
|
||||
private JadAttack attack;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(FightCaveOverlay.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Schedule(
|
||||
period = 600,
|
||||
unit = ChronoUnit.MILLIS
|
||||
|
||||
@@ -26,7 +26,6 @@ package net.runelite.client.plugins.fightcave;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import org.slf4j.Logger;
|
||||
@@ -41,25 +40,30 @@ import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class FightCaveOverlay extends Overlay
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(FightCaveOverlay.class);
|
||||
|
||||
private static final int WIDTH = 70;
|
||||
private static final int SPACER = 6;
|
||||
private static final int BOTTOM_BORDER = 4;
|
||||
private static final Color GREEN_BACKGROUND = new Color(0, 255, 0, 100);
|
||||
private static final Color RED_BACKGROUND = new Color(255, 0, 0, 100);
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(FightCaveOverlay.class);
|
||||
|
||||
private final Client client;
|
||||
private final FightCave plugin;
|
||||
private final Client client = RuneLite.getClient();
|
||||
|
||||
private Image protectFromMagicImg;
|
||||
private Image protectFromMissilesImg;
|
||||
|
||||
FightCaveOverlay(FightCave plugin)
|
||||
@Inject
|
||||
FightCaveOverlay(@Nullable Client client, FightCave plugin)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.fishing;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Fishing",
|
||||
description = "Configuration for the fishing plugin"
|
||||
)
|
||||
public interface FishingConfig
|
||||
public interface FishingConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -30,9 +30,10 @@ import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
@@ -50,16 +51,17 @@ class FishingOverlay extends Overlay
|
||||
private static final Color BACKGROUND = new Color(Color.gray.getRed(), Color.gray.getGreen(), Color.gray.getBlue(), 127);
|
||||
private static final String FISHING_SPOT = "Fishing spot";
|
||||
|
||||
private final Client client = RuneLite.getClient();
|
||||
|
||||
private final Client client;
|
||||
private final FishingPlugin plugin;
|
||||
private final FishingConfig config;
|
||||
|
||||
public FishingOverlay(FishingPlugin plugin)
|
||||
@Inject
|
||||
public FishingOverlay(@Nullable Client client, FishingPlugin plugin, FishingConfig config)
|
||||
{
|
||||
super(OverlayPosition.TOP_LEFT, OverlayPriority.LOW);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = plugin.getConfig();
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,13 +25,17 @@
|
||||
package net.runelite.client.plugins.fishing;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.ChatMessage;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -42,19 +46,30 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
@PluginDescriptor(
|
||||
name = "Fishing plugin"
|
||||
)
|
||||
@Singleton
|
||||
public class FishingPlugin extends Plugin
|
||||
{
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final FishingConfig config = runelite.getConfigManager().getConfig(FishingConfig.class);
|
||||
private final FishingOverlay overlay = new FishingOverlay(this);
|
||||
private final FishingSpotOverlay spotOverlay = new FishingSpotOverlay(this);
|
||||
@Inject
|
||||
FishingConfig config;
|
||||
|
||||
private FishingSession session = new FishingSession();
|
||||
@Inject
|
||||
FishingOverlay overlay;
|
||||
|
||||
@Inject
|
||||
FishingSpotOverlay spotOverlay;
|
||||
|
||||
private final FishingSession session = new FishingSession();
|
||||
|
||||
@Override
|
||||
public Collection<Overlay> getOverlays()
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
return Arrays.asList(overlay, spotOverlay);
|
||||
binder.bind(FishingOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
FishingConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(FishingConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,13 +80,9 @@ public class FishingPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
public Collection<Overlay> getOverlays()
|
||||
{
|
||||
}
|
||||
|
||||
public FishingConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
return Arrays.asList(overlay, spotOverlay);
|
||||
}
|
||||
|
||||
public FishingSession getSession()
|
||||
|
||||
@@ -31,11 +31,14 @@ import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.queries.NPCQuery;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
@@ -48,14 +51,20 @@ class FishingSpotOverlay extends Overlay
|
||||
|
||||
private final List<Integer> ids = new ArrayList<>();
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RuneLite runelite;
|
||||
private final Client client;
|
||||
private final FishingConfig config;
|
||||
|
||||
public FishingSpotOverlay(FishingPlugin plugin)
|
||||
@Inject
|
||||
ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
public FishingSpotOverlay(RuneLite runelite, @Nullable Client client, FishingConfig config)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.config = plugin.getConfig();
|
||||
this.runelite = runelite;
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,7 +108,7 @@ class FishingSpotOverlay extends Overlay
|
||||
|
||||
private BufferedImage getFishImage(FishingSpot spot)
|
||||
{
|
||||
BufferedImage fishImage = runelite.getItemManager().getImage(spot.getFishSpriteId());
|
||||
BufferedImage fishImage = itemManager.getImage(spot.getFishSpriteId());
|
||||
return fishImage;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,11 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.fpsinfo;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import java.awt.Font;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
@@ -36,10 +37,17 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class FPS extends Plugin
|
||||
{
|
||||
private final Overlay overlay = new FPSOverlay(this);
|
||||
@Inject
|
||||
FPSOverlay overlay;
|
||||
|
||||
private Font font;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(FPSOverlay.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
@@ -47,11 +55,6 @@ public class FPS extends Plugin
|
||||
.deriveFont(Font.BOLD, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
@@ -62,4 +65,4 @@ public class FPS extends Plugin
|
||||
{
|
||||
return font;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,30 +30,32 @@ import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
|
||||
public class FPSOverlay extends Overlay
|
||||
{
|
||||
private static final Client client = RuneLite.getClient();
|
||||
private final Client client;
|
||||
private final FPS plugin;
|
||||
|
||||
public FPSOverlay(FPS plugin)
|
||||
@Inject
|
||||
public FPSOverlay(@Nullable Client client, FPS plugin)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC, OverlayPriority.HIGH);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.grounditems;
|
||||
|
||||
import net.runelite.client.RuneLite;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -34,15 +37,22 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class GroundItems extends Plugin
|
||||
{
|
||||
private final GroundItemsConfig config = RuneLite.getRunelite().getConfigManager()
|
||||
.getConfig(GroundItemsConfig.class);
|
||||
@Inject
|
||||
ConfigManager configManager;
|
||||
|
||||
private final Overlay overlay = new GroundItemsOverlay(this);
|
||||
@Inject
|
||||
GroundItemsOverlay overlay;
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(GroundItemsOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
GroundItemsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(GroundItemsConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,14 +61,4 @@ public class GroundItems extends Plugin
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public GroundItemsConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
package net.runelite.client.plugins.grounditems;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -33,7 +34,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Ground Items",
|
||||
description = "Configuration for the ground items plugin"
|
||||
)
|
||||
public interface GroundItemsConfig
|
||||
public interface GroundItemsConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -39,6 +39,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Item;
|
||||
@@ -52,7 +54,6 @@ import net.runelite.api.Tile;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.http.api.item.ItemPrice;
|
||||
@@ -86,9 +87,8 @@ public class GroundItemsOverlay extends Overlay
|
||||
// Regex for splitting the hidden items in the config.
|
||||
private static final String DELIMITER_REGEX = "\\s*,\\s*";
|
||||
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final Client client;
|
||||
private final GroundItemsConfig config;
|
||||
private final ItemManager itemManager = RuneLite.getRunelite().getItemManager();
|
||||
private final StringBuilder itemStringBuilder = new StringBuilder();
|
||||
private final LoadingCache<Integer, ItemComposition> itemCache = CacheBuilder.newBuilder()
|
||||
.maximumSize(1024L)
|
||||
@@ -102,10 +102,15 @@ public class GroundItemsOverlay extends Overlay
|
||||
}
|
||||
});
|
||||
|
||||
public GroundItemsOverlay(GroundItems plugin)
|
||||
@Inject
|
||||
ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
public GroundItemsOverlay(@Nullable Client client, GroundItemsConfig config)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.config = plugin.getConfig();
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,9 +27,10 @@ package net.runelite.client.plugins.hiscore;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.ImageIcon;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.events.PlayerMenuOptionClicked;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
@@ -46,8 +47,14 @@ public class Hiscore extends Plugin
|
||||
|
||||
private static final String LOOKUP = "Lookup";
|
||||
|
||||
private final RuneLite runeLite = RuneLite.getRunelite();
|
||||
private final ClientUI ui = runeLite.getGui();
|
||||
@Inject
|
||||
ClientUI ui;
|
||||
|
||||
@Inject
|
||||
MenuManager menuManager;
|
||||
|
||||
@Inject
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
private NavigationButton navButton;
|
||||
private HiscorePanel hiscorePanel;
|
||||
@@ -56,19 +63,14 @@ public class Hiscore extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
navButton = new NavigationButton("Hiscore", () -> hiscorePanel);
|
||||
hiscorePanel = new HiscorePanel(runeLite);
|
||||
hiscorePanel = injector.getInstance(HiscorePanel.class);
|
||||
|
||||
ImageIcon icon = new ImageIcon(ImageIO.read(getClass().getResourceAsStream("hiscore.gif")));
|
||||
navButton.getButton().setIcon(icon);
|
||||
|
||||
ui.getPluginToolbar().addNavigation(navButton);
|
||||
|
||||
runeLite.getMenuManager().addPlayerMenuItem(LOOKUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
menuManager.addPlayerMenuItem(LOOKUP);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -76,7 +78,6 @@ public class Hiscore extends Plugin
|
||||
{
|
||||
if (event.getMenuOption().equals(LOOKUP))
|
||||
{
|
||||
ScheduledExecutorService executor = runeLite.getExecutor();
|
||||
executor.execute(() -> hiscorePanel.lookup(event.getMenuTarget()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
package net.runelite.client.plugins.hiscore;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.IOException;
|
||||
@@ -34,18 +33,15 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.event.MouseInputAdapter;
|
||||
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.IconTextField;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
import net.runelite.http.api.hiscore.*;
|
||||
|
||||
import static net.runelite.http.api.hiscore.HiscoreSkill.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -68,7 +64,8 @@ public class HiscorePanel extends PluginPanel
|
||||
CONSTRUCTION, HUNTER
|
||||
};
|
||||
|
||||
private final RuneLite runelite;
|
||||
@Inject
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
private final IconTextField input;
|
||||
|
||||
@@ -81,10 +78,8 @@ public class HiscorePanel extends PluginPanel
|
||||
private final HiscoreClient client = new HiscoreClient();
|
||||
private HiscoreResult result;
|
||||
|
||||
public HiscorePanel(RuneLite runelite)
|
||||
public HiscorePanel()
|
||||
{
|
||||
this.runelite = runelite;
|
||||
|
||||
// Panel "constants"
|
||||
// This was an EtchedBorder, but the style would change when the window was maximized.
|
||||
Border subPanelBorder = BorderFactory.createLineBorder(this.getBackground().brighter(), 2);
|
||||
@@ -125,11 +120,7 @@ public class HiscorePanel extends PluginPanel
|
||||
input = new IconTextField();
|
||||
input.setIcon(search);
|
||||
input.setFont(labelFont.deriveFont(Font.BOLD));
|
||||
input.addActionListener(e ->
|
||||
{
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.execute(this::lookup);
|
||||
});
|
||||
input.addActionListener(e -> executor.execute(this::lookup));
|
||||
inputPanel.add(input, BorderLayout.CENTER);
|
||||
|
||||
c.gridx = 0;
|
||||
@@ -229,11 +220,7 @@ public class HiscorePanel extends PluginPanel
|
||||
button.setFocusPainted(false);
|
||||
button.setActionCommand(endpoint.name());
|
||||
button.setToolTipText(endpoint.getName() + " Hiscores");
|
||||
button.addActionListener((e ->
|
||||
{
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.execute(this::lookup);
|
||||
}));
|
||||
button.addActionListener((e -> executor.execute(this::lookup)));
|
||||
endpointButtons.add(button);
|
||||
endpointButtonGroup.add(button);
|
||||
endpointPanel.add(button);
|
||||
|
||||
@@ -26,17 +26,20 @@
|
||||
package net.runelite.client.plugins.idlenotifier;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import static net.runelite.api.AnimationID.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import static net.runelite.api.AnimationID.*;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.AnimationChanged;
|
||||
import net.runelite.client.events.GameStateChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -49,10 +52,18 @@ import net.runelite.client.ui.ClientUI;
|
||||
)
|
||||
public class IdleNotifier extends Plugin
|
||||
{
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final IdleNotifierConfig config = runelite.getConfigManager().getConfig(IdleNotifierConfig.class);
|
||||
private final ClientUI gui = runelite.getGui();
|
||||
@Inject
|
||||
RuneLite runelite;
|
||||
|
||||
@Inject
|
||||
ClientUI gui;
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Inject
|
||||
IdleNotifierConfig config;
|
||||
|
||||
private Instant lastAnimating;
|
||||
private Instant lastInteracting;
|
||||
@@ -62,14 +73,10 @@ public class IdleNotifier extends Plugin
|
||||
private boolean notifyHitpoints = true;
|
||||
private boolean notifyPrayer = true;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
@Provides
|
||||
IdleNotifierConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(IdleNotifierConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.idlenotifier;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Idle Notifier",
|
||||
description = "Configuration for the idle notifier plugin"
|
||||
)
|
||||
public interface IdleNotifierConfig
|
||||
public interface IdleNotifierConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -25,7 +25,10 @@
|
||||
package net.runelite.client.plugins.implings;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import net.runelite.client.RuneLite;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -40,10 +43,20 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class Implings extends Plugin
|
||||
{
|
||||
@Inject
|
||||
ImplingsOverlay overlay;
|
||||
|
||||
private final ImplingsConfig config = RuneLite.getRunelite().getConfigManager().getConfig(ImplingsConfig.class);
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(ImplingsOverlay.class);
|
||||
}
|
||||
|
||||
private final ImplingsOverlay overlay = new ImplingsOverlay(this);
|
||||
@Provides
|
||||
ImplingsConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(ImplingsConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
@@ -58,11 +71,6 @@ public class Implings extends Plugin
|
||||
|
||||
}
|
||||
|
||||
public ImplingsConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.implings;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -36,7 +37,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Implings",
|
||||
description = "Configuration for the implings plugin"
|
||||
)
|
||||
public interface ImplingsConfig
|
||||
public interface ImplingsConfig extends Config
|
||||
{
|
||||
|
||||
@ConfigItem(
|
||||
|
||||
@@ -32,6 +32,8 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
@@ -54,17 +56,18 @@ public class ImplingsOverlay extends Overlay
|
||||
private static final int STATIC_SPAWN = 1618;
|
||||
private static final int DYNAMIC_SPAWN = 1633;
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final Client client = RuneLite.getClient();
|
||||
|
||||
private final RuneLite runelite;
|
||||
private final Client client;
|
||||
private final ImplingsConfig config;
|
||||
private final List<Integer> ids;
|
||||
private final List<Integer> ids = new LinkedList<>();
|
||||
|
||||
public ImplingsOverlay(Implings plugin)
|
||||
@Inject
|
||||
public ImplingsOverlay(RuneLite runelite, @Nullable Client client, ImplingsConfig config)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.config = plugin.getConfig();
|
||||
ids = new LinkedList<>();
|
||||
this.runelite = runelite;
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.jewelrycount;
|
||||
|
||||
import net.runelite.client.RuneLite;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -34,28 +37,27 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class JewelryCount extends Plugin
|
||||
{
|
||||
private final JewelryCountConfig config = RuneLite.getRunelite().getConfigManager().getConfig(JewelryCountConfig.class);
|
||||
private final Overlay overlay = new JewelryCountOverlay(this);
|
||||
@Inject
|
||||
JewelryCountConfig config;
|
||||
|
||||
@Inject
|
||||
JewelryCountOverlay overlay;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(JewelryCountOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
JewelryCountConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(JewelryCountConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public JewelryCountConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.jewelrycount;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Jewelry Count",
|
||||
description = "Configuration for the jewelry count plugin"
|
||||
)
|
||||
public interface JewelryCountConfig
|
||||
public interface JewelryCountConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -24,11 +24,16 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.jewelrycount;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Query;
|
||||
@@ -43,20 +48,22 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
class JewelryCountOverlay extends Overlay
|
||||
{
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final RuneLite runelite;
|
||||
private final JewelryCountConfig config;
|
||||
private final Font font = FontManager.getRunescapeSmallFont().deriveFont(Font.PLAIN, 16);
|
||||
|
||||
JewelryCountOverlay(JewelryCount plugin)
|
||||
@Inject
|
||||
JewelryCountOverlay(RuneLite runelite, JewelryCountConfig config)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.config = plugin.getConfig();
|
||||
this.runelite = runelite;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
Client client = RuneLite.getClient();
|
||||
Client client = runelite.getClient();
|
||||
|
||||
if (client.getGameState() != GameState.LOGGED_IN
|
||||
|| !config.enabled()
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.mousehighlight;
|
||||
|
||||
import net.runelite.client.RuneLite;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -34,29 +37,27 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class MouseHighlight extends Plugin
|
||||
{
|
||||
private final MouseHighlightConfig config = RuneLite.getRunelite().getConfigManager().getConfig(MouseHighlightConfig.class);
|
||||
private final Overlay overlay = new MouseHighlightOverlay(this);
|
||||
@Inject
|
||||
MouseHighlightConfig config;
|
||||
|
||||
@Inject
|
||||
MouseHighlightOverlay overlay;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(MouseHighlightOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
MouseHighlightConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(MouseHighlightConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MouseHighlightConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.mousehighlight;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Mouse Highlighting",
|
||||
description = "Configuration for the mouse Highlight plugin"
|
||||
)
|
||||
public interface MouseHighlightConfig
|
||||
public interface MouseHighlightConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -26,11 +26,13 @@ package net.runelite.client.plugins.mousehighlight;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayRenderer;
|
||||
import net.runelite.client.ui.overlay.tooltips.Tooltip;
|
||||
import net.runelite.client.ui.overlay.tooltips.TooltipPriority;
|
||||
import net.runelite.client.ui.overlay.tooltips.TooltipRenderer;
|
||||
@@ -40,15 +42,18 @@ class MouseHighlightOverlay extends Overlay
|
||||
// Grabs the colour and name from a target string
|
||||
// <col=ffffff>Player1
|
||||
private final MouseHighlightConfig config;
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final TooltipRenderer tooltipRenderer = runelite.getRenderer().getTooltipRenderer();
|
||||
private final Client client;
|
||||
private final TooltipRenderer tooltipRenderer;
|
||||
|
||||
MouseHighlightOverlay(MouseHighlight plugin)
|
||||
@Inject
|
||||
MouseHighlightOverlay(@Nullable Client client, MouseHighlightConfig config, OverlayRenderer overlayRenderer)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.config = plugin.getConfig();
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.tooltipRenderer = overlayRenderer.getTooltipRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.opponentinfo;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Opponent Info",
|
||||
description = "Configuration for the opponent info plugin"
|
||||
)
|
||||
public interface OpponentConfig
|
||||
public interface OpponentConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -26,11 +26,14 @@ package net.runelite.client.plugins.opponentinfo;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
import net.runelite.client.RuneLite;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -40,8 +43,20 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class OpponentInfo extends Plugin
|
||||
{
|
||||
private final OpponentConfig config = RuneLite.getRunelite().getConfigManager().getConfig(OpponentConfig.class);
|
||||
private final Overlay overlay = new OpponentInfoOverlay(this);
|
||||
@Inject
|
||||
OpponentInfoOverlay overlay;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(OpponentInfoOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
OpponentConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(OpponentConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
@@ -49,21 +64,6 @@ public class OpponentInfo extends Plugin
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public OpponentConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> loadNpcHealth()
|
||||
{
|
||||
Gson gson = new Gson();
|
||||
|
||||
@@ -32,7 +32,6 @@ import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
@@ -40,6 +39,8 @@ import java.text.DecimalFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
class OpponentInfoOverlay extends Overlay
|
||||
{
|
||||
@@ -57,6 +58,7 @@ class OpponentInfoOverlay extends Overlay
|
||||
|
||||
private static final Duration WAIT = Duration.ofSeconds(3);
|
||||
|
||||
private final Client client;
|
||||
private final OpponentConfig config;
|
||||
private Integer lastMaxHealth;
|
||||
private DecimalFormat df = new DecimalFormat("0.0");
|
||||
@@ -65,16 +67,16 @@ class OpponentInfoOverlay extends Overlay
|
||||
private String opponentName;
|
||||
private Map<String, Integer> oppInfoHealth = OpponentInfo.loadNpcHealth();
|
||||
|
||||
OpponentInfoOverlay(OpponentInfo plugin)
|
||||
@Inject
|
||||
OpponentInfoOverlay(@Nullable Client client, OpponentConfig config)
|
||||
{
|
||||
super(OverlayPosition.TOP_LEFT, OverlayPriority.HIGH);
|
||||
this.config = plugin.getConfig();
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
private Actor getOpponent()
|
||||
{
|
||||
Client client = RuneLite.getClient();
|
||||
|
||||
Player player = client.getLocalPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
@@ -87,7 +89,7 @@ class OpponentInfoOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (RuneLite.getClient().getGameState() != GameState.LOGGED_IN || config.enabled() == false)
|
||||
if (client.getGameState() != GameState.LOGGED_IN || config.enabled() == false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.pestcontrol;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import java.awt.Font;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
@@ -35,10 +37,17 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class PestControl extends Plugin
|
||||
{
|
||||
private final Overlay overlay = new PestControlOverlay(this);
|
||||
|
||||
private Font font;
|
||||
|
||||
@Inject
|
||||
PestControlOverlay overlay;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(PestControlOverlay.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
@@ -46,11 +55,6 @@ public class PestControl extends Plugin
|
||||
.deriveFont(Font.BOLD, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.util.Arrays;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.NPC;
|
||||
@@ -54,17 +55,20 @@ public class PestControlOverlay extends Overlay
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(PestControlOverlay.class);
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RuneLite runelite;
|
||||
private final Client client;
|
||||
|
||||
private final PestControl plugin;
|
||||
|
||||
// Pest control game
|
||||
private Game game;
|
||||
|
||||
public PestControlOverlay(PestControl plugin)
|
||||
@Inject
|
||||
public PestControlOverlay(RuneLite runelite, PestControl plugin)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.runelite = runelite;
|
||||
this.client = runelite.getClient();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
package net.runelite.client.plugins.rememberusername;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.GameStateChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -37,19 +40,17 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
)
|
||||
public class RememberUsername extends Plugin
|
||||
{
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RememberUsernameConfig config = RuneLite.getRunelite().getConfigManager().getConfig(RememberUsernameConfig.class);
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
@Inject
|
||||
RememberUsernameConfig config;
|
||||
|
||||
@Provides
|
||||
RememberUsernameConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
return configManager.getConfig(RememberUsernameConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.rememberusername;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Remember Username",
|
||||
description = "Configuration for the remember username plugin"
|
||||
)
|
||||
public interface RememberUsernameConfig
|
||||
public interface RememberUsernameConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -34,11 +34,10 @@ import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import static net.runelite.api.ItemID.BINDING_NECKLACE;
|
||||
|
||||
import net.runelite.api.Query;
|
||||
import net.runelite.api.queries.EquipmentItemQuery;
|
||||
import net.runelite.api.queries.InventoryItemQuery;
|
||||
@@ -51,16 +50,19 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
public class BindNeckOverlay extends Overlay
|
||||
{
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final RuneLite runelite;
|
||||
private final Client client;
|
||||
private final RunecraftConfig config;
|
||||
private final Font font = FontManager.getRunescapeSmallFont().deriveFont(Font.PLAIN, 16);
|
||||
int bindingCharges;
|
||||
|
||||
BindNeckOverlay(Runecraft plugin)
|
||||
@Inject
|
||||
BindNeckOverlay(RuneLite runelite, RunecraftConfig config)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.config = plugin.getConfig();
|
||||
this.runelite = runelite;
|
||||
this.client = runelite.getClient();
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,13 +25,15 @@
|
||||
package net.runelite.client.plugins.runecraft;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.ChatMessage;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -44,9 +46,23 @@ public class Runecraft extends Plugin
|
||||
{
|
||||
private static Pattern bindNeckString = Pattern.compile("You have ([0-9]+) charges left before your Binding necklace disintegrates.");
|
||||
|
||||
private final RunecraftConfig config = RuneLite.getRunelite().getConfigManager().getConfig(RunecraftConfig.class);
|
||||
private final RunecraftOverlay overlay = new RunecraftOverlay(this);
|
||||
private final BindNeckOverlay bindNeckOverlay = new BindNeckOverlay(this);
|
||||
@Inject
|
||||
RunecraftOverlay overlay;
|
||||
|
||||
@Inject
|
||||
BindNeckOverlay bindNeckOverlay;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(RunecraftOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
RunecraftConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(RunecraftConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Overlay> getOverlays()
|
||||
@@ -54,21 +70,6 @@ public class Runecraft extends Plugin
|
||||
return Arrays.asList(overlay, bindNeckOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public RunecraftConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage event)
|
||||
{
|
||||
@@ -87,11 +88,11 @@ public class Runecraft extends Plugin
|
||||
if (event.getMessage().contains("You bind the temple's power"))
|
||||
{
|
||||
if (event.getMessage().contains("mud")
|
||||
|| event.getMessage().contains("lava")
|
||||
|| event.getMessage().contains("steam")
|
||||
|| event.getMessage().contains("dust")
|
||||
|| event.getMessage().contains("smoke")
|
||||
|| event.getMessage().contains("mist"))
|
||||
|| event.getMessage().contains("lava")
|
||||
|| event.getMessage().contains("steam")
|
||||
|| event.getMessage().contains("dust")
|
||||
|| event.getMessage().contains("smoke")
|
||||
|| event.getMessage().contains("mist"))
|
||||
{
|
||||
bindNeckOverlay.bindingCharges -= 1;
|
||||
return;
|
||||
@@ -104,4 +105,4 @@ public class Runecraft extends Plugin
|
||||
bindNeckOverlay.bindingCharges = 17;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.runecraft;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -33,7 +34,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Runecraft",
|
||||
description = "Configuration for the runecrafting plugin"
|
||||
)
|
||||
public interface RunecraftConfig
|
||||
public interface RunecraftConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "showPouch",
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemID;
|
||||
@@ -50,24 +50,27 @@ public class RunecraftOverlay extends Overlay
|
||||
private static final int LARGE_POUCH_DAMAGED = ItemID.LARGE_POUCH_5513;
|
||||
private static final int GIANT_POUCH_DAMAGED = ItemID.GIANT_POUCH_5515;
|
||||
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final RuneLite runelite;
|
||||
private final Client client;
|
||||
private final Font font = FontManager.getRunescapeSmallFont().deriveFont(Font.PLAIN, 16);
|
||||
|
||||
private final RunecraftConfig config;
|
||||
|
||||
RunecraftOverlay(Runecraft plugin)
|
||||
@Inject
|
||||
RunecraftOverlay(RuneLite runelite, RunecraftConfig config)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.config = plugin.getConfig();
|
||||
this.runelite = runelite;
|
||||
this.client = runelite.getClient();
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN
|
||||
|| !config.showPouch()
|
||||
|| client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null)
|
||||
|| !config.showPouch()
|
||||
|| client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.runepouch;
|
||||
|
||||
import net.runelite.client.RuneLite;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -34,27 +37,27 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class Runepouch extends Plugin
|
||||
{
|
||||
private final RunepouchConfig config = RuneLite.getRunelite().getConfigManager().getConfig(RunepouchConfig.class);
|
||||
private final RunepouchOverlay overlay = new RunepouchOverlay(this);
|
||||
@Inject
|
||||
ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
RunepouchOverlay overlay;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(RunepouchOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
RunepouchConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(RunepouchConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public RunepouchConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.runepouch;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -33,7 +34,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Runepouch",
|
||||
description = "Configuration for the Runepouch plugin"
|
||||
)
|
||||
public interface RunepouchConfig
|
||||
public interface RunepouchConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemID;
|
||||
@@ -41,6 +42,7 @@ import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayRenderer;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.ui.overlay.tooltips.Tooltip;
|
||||
import net.runelite.client.ui.overlay.tooltips.TooltipPriority;
|
||||
@@ -57,16 +59,21 @@ public class RunepouchOverlay extends Overlay
|
||||
Varbits.RUNE_POUCH_RUNE1, Varbits.RUNE_POUCH_RUNE2, Varbits.RUNE_POUCH_RUNE3
|
||||
};
|
||||
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final TooltipRenderer toolripRenderer = runelite.getRenderer().getTooltipRenderer();
|
||||
private final RuneImageCache runeImageCache = new RuneImageCache();
|
||||
private final RunepouchConfig config;
|
||||
|
||||
RunepouchOverlay(Runepouch plugin)
|
||||
private final RuneLite runelite;
|
||||
private final Client client;
|
||||
private final RunepouchConfig config;
|
||||
private final TooltipRenderer tooltipRenderer;
|
||||
|
||||
@Inject
|
||||
RunepouchOverlay(RuneLite runelite, RunepouchConfig config, OverlayRenderer overlayRenderer)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.config = plugin.getConfig();
|
||||
this.runelite = runelite;
|
||||
this.client = runelite.getClient();
|
||||
this.config = config;
|
||||
this.tooltipRenderer = overlayRenderer.getTooltipRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -143,7 +150,7 @@ public class RunepouchOverlay extends Overlay
|
||||
{
|
||||
String tooltipText = tooltipBuilder.toString();
|
||||
Tooltip tooltip = new Tooltip(TooltipPriority.HIGH, tooltipText);
|
||||
toolripRenderer.add(tooltip);
|
||||
tooltipRenderer.add(tooltip);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -25,25 +25,31 @@
|
||||
package net.runelite.client.plugins.slayer;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.Skill.SLAYER;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.ChatMessage;
|
||||
import net.runelite.client.events.ExperienceChanged;
|
||||
import net.runelite.client.events.GameStateChanged;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -68,11 +74,21 @@ public class Slayer extends Plugin
|
||||
//Reward UI
|
||||
private static final Pattern REWARD_POINTS = Pattern.compile("Reward points: (\\d*)");
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final InfoBoxManager infoBoxManager = RuneLite.getRunelite().getInfoBoxManager();
|
||||
private final SlayerConfig config = RuneLite.getRunelite().getConfigManager().getConfig(SlayerConfig.class);
|
||||
private final SlayerOverlay overlay = new SlayerOverlay(this);
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Inject
|
||||
SlayerConfig config;
|
||||
|
||||
@Inject
|
||||
SlayerOverlay overlay;
|
||||
|
||||
@Inject
|
||||
InfoBoxManager infoBoxManager;
|
||||
|
||||
@Inject
|
||||
ItemManager itemManager;
|
||||
|
||||
private String taskName;
|
||||
private int amount;
|
||||
@@ -82,15 +98,15 @@ public class Slayer extends Plugin
|
||||
private int cachedXp;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
|
||||
binder.bind(SlayerOverlay.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
@Provides
|
||||
SlayerConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
|
||||
return configManager.getConfig(SlayerConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -278,7 +294,7 @@ public class Slayer extends Plugin
|
||||
itemSpriteId = task.getItemSpriteId();
|
||||
}
|
||||
|
||||
BufferedImage taskImg = runelite.getItemManager().getImage(itemSpriteId);
|
||||
BufferedImage taskImg = itemManager.getImage(itemSpriteId);
|
||||
counter = new TaskCounter(taskImg, amount);
|
||||
counter.setTooltip(String.format("<col=ff7700>%s</br><col=ffff00>Pts:</col> %s</br><col=ffff00>Streak:</col> %s",
|
||||
capsString(taskName), points, streak));
|
||||
@@ -287,13 +303,8 @@ public class Slayer extends Plugin
|
||||
}
|
||||
|
||||
//Getters
|
||||
public SlayerConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlayerOverlay getOverlay()
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.slayer;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Slayer",
|
||||
description = "Configuration for the slayer plugin"
|
||||
)
|
||||
public interface SlayerConfig
|
||||
public interface SlayerConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemID;
|
||||
@@ -50,8 +51,8 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
class SlayerOverlay extends Overlay
|
||||
{
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RuneLite runelite;
|
||||
private final Client client;
|
||||
private final SlayerConfig config;
|
||||
private final Slayer plugin;
|
||||
private final Font font = FontManager.getRunescapeSmallFont().deriveFont(Font.PLAIN, 16);
|
||||
@@ -83,11 +84,14 @@ class SlayerOverlay extends Overlay
|
||||
ItemID.ETERNAL_GEM
|
||||
);
|
||||
|
||||
SlayerOverlay(Slayer plugin)
|
||||
@Inject
|
||||
SlayerOverlay(RuneLite runelite, Slayer plugin, SlayerConfig config)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.runelite = runelite;
|
||||
this.client = runelite.getClient();
|
||||
this.plugin = plugin;
|
||||
this.config = plugin.getConfig();
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,8 +25,10 @@
|
||||
package net.runelite.client.plugins.timers;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.ChatMessage;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -39,23 +41,16 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
)
|
||||
public class Timers extends Plugin
|
||||
{
|
||||
private final TimersConfig config = RuneLite.getRunelite().getConfigManager().getConfig(TimersConfig.class);
|
||||
@Inject
|
||||
TimersConfig config;
|
||||
|
||||
private final InfoBoxManager infoBoxManager = RuneLite.getRunelite().getInfoBoxManager();
|
||||
@Inject
|
||||
InfoBoxManager infoBoxManager;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
@Provides
|
||||
TimersConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public TimersConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
return configManager.getConfig(TimersConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.timers;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Timers",
|
||||
description = "Configuration for the timers plugin"
|
||||
)
|
||||
public interface TimersConfig
|
||||
public interface TimersConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.woodcutting;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Woodcutting",
|
||||
description = "Configuration for the woodcutting plugin"
|
||||
)
|
||||
public interface WoodcuttingConfig
|
||||
public interface WoodcuttingConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -31,10 +31,11 @@ import java.awt.Graphics2D;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.stream.IntStream;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import static net.runelite.api.AnimationID.*;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
@@ -58,16 +59,17 @@ class WoodcuttingOverlay extends Overlay
|
||||
WOODCUTTING_INFERNAL
|
||||
};
|
||||
|
||||
private final Client client = RuneLite.getClient();
|
||||
|
||||
private final Client client;
|
||||
private final WoodcuttingPlugin plugin;
|
||||
private final WoodcuttingConfig config;
|
||||
|
||||
public WoodcuttingOverlay(WoodcuttingPlugin plugin)
|
||||
@Inject
|
||||
public WoodcuttingOverlay(@Nullable Client client, WoodcuttingPlugin plugin, WoodcuttingConfig config)
|
||||
{
|
||||
super(OverlayPosition.TOP_LEFT, OverlayPriority.LOW);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = plugin.getConfig();
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,11 +25,15 @@
|
||||
package net.runelite.client.plugins.woodcutting;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.ChatMessage;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -41,11 +45,28 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class WoodcuttingPlugin extends Plugin
|
||||
{
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final WoodcuttingConfig config = runelite.getConfigManager().getConfig(WoodcuttingConfig.class);
|
||||
private final WoodcuttingOverlay overlay = new WoodcuttingOverlay(this);
|
||||
@Inject
|
||||
RuneLite runelite;
|
||||
|
||||
private WoodcuttingSession session = new WoodcuttingSession();
|
||||
@Inject
|
||||
WoodcuttingOverlay overlay;
|
||||
|
||||
@Inject
|
||||
WoodcuttingConfig config;
|
||||
|
||||
private final WoodcuttingSession session = new WoodcuttingSession();
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(WoodcuttingOverlay.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
WoodcuttingConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(WoodcuttingConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
@@ -53,21 +74,6 @@ public class WoodcuttingPlugin extends Plugin
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public WoodcuttingConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
public WoodcuttingSession getSession()
|
||||
{
|
||||
return session;
|
||||
|
||||
@@ -25,14 +25,18 @@
|
||||
package net.runelite.client.plugins.xpglobes;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.events.ExperienceChanged;
|
||||
import net.runelite.client.events.GameStateChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -44,26 +48,32 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
)
|
||||
public class XpGlobes extends Plugin
|
||||
{
|
||||
|
||||
private final XpGlobesConfig config = RuneLite.getRunelite().getConfigManager()
|
||||
.getConfig(XpGlobesConfig.class);
|
||||
private final Overlay overlay = new XpGlobesOverlay(this);
|
||||
private final Client client = RuneLite.getClient();
|
||||
private XpGlobe[] globeCache = new XpGlobe[Skill.values().length - 1]; //overall does not trigger xp change event
|
||||
private final List<XpGlobe> xpGlobes = new ArrayList<>();
|
||||
private static final int SECONDS_TO_SHOW_GLOBE = 10;
|
||||
private static final int MAXIMUM_SHOWN_GLOBES = 5;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
private XpGlobe[] globeCache = new XpGlobe[Skill.values().length - 1]; //overall does not trigger xp change event
|
||||
private final List<XpGlobe> xpGlobes = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Inject
|
||||
XpGlobesConfig config;
|
||||
|
||||
@Inject
|
||||
XpGlobesOverlay overlay;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(XpGlobesOverlay.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
@Provides
|
||||
XpGlobesConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
|
||||
return configManager.getConfig(XpGlobesConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,11 +170,6 @@ public class XpGlobes extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
public XpGlobesConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
public void resetGlobeState()
|
||||
{
|
||||
xpGlobes.clear();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.xpglobes;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "XP Globes",
|
||||
description = "Configuration for the xp globes plugin"
|
||||
)
|
||||
public interface XpGlobesConfig
|
||||
public interface XpGlobesConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -24,27 +24,27 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.xpglobes;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.FontMetrics;
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Arc2D;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -52,8 +52,8 @@ public class XpGlobesOverlay extends Overlay
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(XpGlobesOverlay.class);
|
||||
|
||||
private final Client client;
|
||||
private final XpGlobes plugin;
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final XpGlobesConfig config;
|
||||
|
||||
private static final int DEFAULT_CIRCLE_WIDTH = 40;
|
||||
@@ -75,11 +75,13 @@ public class XpGlobesOverlay extends Overlay
|
||||
private static final int TOOLTIP_TEXT_RECT_SIZE_X = TOOLTIP_RECT_SIZE_X - 10;
|
||||
private static final int TOOLTIP_RECT_SIZE_Y = 80;
|
||||
|
||||
public XpGlobesOverlay(XpGlobes plugin)
|
||||
@Inject
|
||||
public XpGlobesOverlay(@Nullable Client client, XpGlobes plugin, XpGlobesConfig config)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.config = plugin.getConfig();
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -242,7 +244,6 @@ public class XpGlobesOverlay extends Overlay
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.drawRect(x, y, TOOLTIP_RECT_SIZE_X, TOOLTIP_RECT_SIZE_Y);
|
||||
|
||||
|
||||
//draw the text
|
||||
graphics.setPaint(Color.WHITE);
|
||||
graphics.drawString(mouseOverSkill.getSkillName(), stringX, y + stringHeight);
|
||||
@@ -265,7 +266,7 @@ public class XpGlobesOverlay extends Overlay
|
||||
int progressTextX = barX + (barWidth / 2) - (progressTextLength / 2);
|
||||
int progressTextY = barY + 12;
|
||||
|
||||
int progressFill = (int)((barWidth / 100F) * progress);
|
||||
int progressFill = (int) ((barWidth / 100F) * progress);
|
||||
|
||||
graphics.setColor(Color.WHITE);
|
||||
graphics.fillRect(barX, barY, barWidth, barHeight);
|
||||
|
||||
@@ -26,30 +26,42 @@ package net.runelite.client.plugins.xptracker;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
public class XPPanel extends PluginPanel
|
||||
{
|
||||
private static final Client client = RuneLite.getClient();
|
||||
private static final Logger logger = LoggerFactory.getLogger(XPPanel.class);
|
||||
private Map<Skill, JPanel> labelMap = new HashMap<>();
|
||||
private final XPTracker xpTracker;
|
||||
private JPanel statsPanel;
|
||||
|
||||
public XPPanel(RuneLite runelite, XPTracker xpTracker)
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Inject
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
@Inject
|
||||
public XPPanel(XPTracker xpTracker)
|
||||
{
|
||||
this.xpTracker = xpTracker;
|
||||
|
||||
@@ -65,7 +77,9 @@ public class XPPanel extends PluginPanel
|
||||
for (Skill skill : Skill.values())
|
||||
{
|
||||
if (skill == Skill.OVERALL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
JLabel skillLabel = new JLabel();
|
||||
labelMap.put(skill, makeSkillPanel(skill, skillLabel));
|
||||
@@ -78,8 +92,7 @@ public class XPPanel extends PluginPanel
|
||||
|
||||
JButton resetButton = new JButton("Reset All");
|
||||
resetButton.setPreferredSize(new Dimension(PANEL_WIDTH, 32));
|
||||
resetButton.addActionListener((ActionEvent e) ->
|
||||
runelite.getExecutor().execute(this::resetAllSkillXpHr));
|
||||
resetButton.addActionListener((e) -> executor.execute(this::resetAllSkillXpHr));
|
||||
|
||||
statsPanel.add(resetButton);
|
||||
JScrollPane scroll = new JScrollPane(statsPanel);
|
||||
@@ -129,7 +142,9 @@ public class XPPanel extends PluginPanel
|
||||
for (SkillXPInfo skillInfo : xpTracker.getXpInfos())
|
||||
{
|
||||
if (skillInfo != null && skillInfo.getSkillTimeStart() != null)
|
||||
{
|
||||
resetSkillXpHr(skillInfo.getSkill());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +152,11 @@ public class XPPanel extends PluginPanel
|
||||
{
|
||||
for (SkillXPInfo skillInfo : xpTracker.getXpInfos())
|
||||
{
|
||||
if (skillInfo != null && skillInfo.getSkillTimeStart() != null &&
|
||||
skillInfo.getXpGained() != 0)
|
||||
if (skillInfo != null && skillInfo.getSkillTimeStart() != null
|
||||
&& skillInfo.getXpGained() != 0)
|
||||
{
|
||||
updateSkillXpHr(skillInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,4 +174,3 @@ public class XPPanel extends PluginPanel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,13 +28,14 @@ import com.google.common.eventbus.Subscribe;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.events.ExperienceChanged;
|
||||
import net.runelite.client.events.GameStateChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
|
||||
@@ -45,9 +46,12 @@ public class XPTracker extends Plugin
|
||||
{
|
||||
private static final int NUMBER_OF_SKILLS = Skill.values().length - 1; //ignore overall
|
||||
|
||||
private final RuneLite runeLite = RuneLite.getRunelite();
|
||||
private final ClientUI ui = runeLite.getGui();
|
||||
private final Client client = RuneLite.getClient();
|
||||
@Inject
|
||||
ClientUI ui;
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
private NavigationButton navButton;
|
||||
private XPPanel xpPanel;
|
||||
@@ -57,17 +61,12 @@ public class XPTracker extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
navButton = new NavigationButton("XP Tracker", () -> xpPanel);
|
||||
xpPanel = new XPPanel(runeLite, this);
|
||||
xpPanel = injector.getInstance(XPPanel.class);
|
||||
|
||||
navButton.getButton().setText("XP");
|
||||
ui.getPluginToolbar().addNavigation(navButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
|
||||
@@ -29,8 +29,9 @@ import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.events.MapRegionChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -46,21 +47,16 @@ public class Xtea extends Plugin
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Xtea.class);
|
||||
|
||||
private final RuneLite runeLite = RuneLite.getRunelite();
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final XteaClient xteaClient = new XteaClient();
|
||||
|
||||
private final Set<Integer> sentRegions = new HashSet<>();
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
}
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
@Inject
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
@Subscribe
|
||||
public void onMapRegionChanged(MapRegionChanged event)
|
||||
@@ -89,7 +85,6 @@ public class Xtea extends Plugin
|
||||
|
||||
sentRegions.add(region);
|
||||
|
||||
ScheduledExecutorService executor = runeLite.getExecutor();
|
||||
executor.execute(() ->
|
||||
{
|
||||
try (Response response = xteaClient.submit(revision, region, keys))
|
||||
|
||||
@@ -26,12 +26,18 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.zulrah;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Query;
|
||||
import net.runelite.api.queries.NPCQuery;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.zulrah.patterns.ZulrahPattern;
|
||||
@@ -45,8 +51,6 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Zulrah plugin"
|
||||
)
|
||||
@@ -54,29 +58,39 @@ public class Zulrah extends Plugin
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Zulrah.class);
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final ZulrahConfig config = RuneLite.getRunelite().getConfigManager().getConfig(ZulrahConfig.class);
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final ZulrahOverlay overlay = new ZulrahOverlay(this);
|
||||
private final ZulrahPattern[] patterns = new ZulrahPattern[]{
|
||||
new ZulrahPatternA(),
|
||||
new ZulrahPatternB(),
|
||||
new ZulrahPatternC(),
|
||||
new ZulrahPatternD()
|
||||
@Inject
|
||||
RuneLite runelite;
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
Client client;
|
||||
|
||||
@Inject
|
||||
ZulrahConfig config;
|
||||
|
||||
@Inject
|
||||
ZulrahOverlay overlay;
|
||||
|
||||
private final ZulrahPattern[] patterns = new ZulrahPattern[]
|
||||
{
|
||||
new ZulrahPatternA(),
|
||||
new ZulrahPatternB(),
|
||||
new ZulrahPatternC(),
|
||||
new ZulrahPatternD()
|
||||
};
|
||||
|
||||
private ZulrahInstance instance;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
|
||||
binder.bind(ZulrahOverlay.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
@Provides
|
||||
ZulrahConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
|
||||
return configManager.getConfig(ZulrahConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.zulrah;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@@ -32,7 +33,7 @@ import net.runelite.client.config.ConfigItem;
|
||||
name = "Zulrah",
|
||||
description = "Configuration for the zulrah plugin"
|
||||
)
|
||||
public interface ZulrahConfig
|
||||
public interface ZulrahConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
|
||||
@@ -36,7 +36,9 @@ import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Perspective;
|
||||
@@ -44,7 +46,6 @@ import net.runelite.api.Point;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
|
||||
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -67,15 +68,17 @@ public class ZulrahOverlay extends Overlay
|
||||
private static final Color MELEE_BACKGROUND_COLOR = new Color(180, 50, 20, 100);
|
||||
private static final Color JAD_BACKGROUND_COLOR = new Color(255, 115, 0, 100);
|
||||
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final Client client;
|
||||
private final Zulrah plugin;
|
||||
private final Image[] zulrahImages = new Image[3];
|
||||
private final Image[] smallZulrahImages = new Image[3];
|
||||
private final Image[] prayerImages = new Image[2];
|
||||
|
||||
ZulrahOverlay(Zulrah plugin)
|
||||
@Inject
|
||||
ZulrahOverlay(@Nullable Client client, Zulrah plugin)
|
||||
{
|
||||
super(OverlayPosition.DYNAMIC);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,21 +32,20 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import net.runelite.client.RuneLite;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class Scheduler
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Scheduler.class);
|
||||
|
||||
private final RuneLite runelite;
|
||||
private final List<ScheduledMethod> scheduledMethods = new ArrayList<>();
|
||||
|
||||
public Scheduler(RuneLite runelite)
|
||||
{
|
||||
this.runelite = runelite;
|
||||
}
|
||||
@Inject
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
public void addScheduledMethod(ScheduledMethod method)
|
||||
{
|
||||
@@ -84,7 +83,6 @@ public class Scheduler
|
||||
|
||||
if (schedule.asynchronous())
|
||||
{
|
||||
ScheduledExecutorService executor = runelite.getExecutor();
|
||||
executor.submit(() -> run(scheduledMethod));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -32,7 +32,6 @@ import java.io.IOException;
|
||||
import javax.swing.JPanel;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ClientLoader;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.http.api.updatecheck.UpdateCheckClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -43,10 +42,12 @@ final class ClientPanel extends JPanel
|
||||
|
||||
public static final int PANEL_WIDTH = 765, PANEL_HEIGHT = 503;
|
||||
|
||||
private final ClientUI ui;
|
||||
private Applet rs;
|
||||
|
||||
public ClientPanel()
|
||||
public ClientPanel(ClientUI ui)
|
||||
{
|
||||
this.ui = ui;
|
||||
setSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
setMinimumSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
@@ -103,7 +104,7 @@ final class ClientPanel extends JPanel
|
||||
|
||||
Client client = (Client) rs;
|
||||
|
||||
RuneLite.setClient(client);
|
||||
ui.getRunelite().setClient(client);
|
||||
|
||||
// This causes the whole game frame to be redrawn each frame instead
|
||||
// of only the viewport, so we can hook to MainBufferProvider#draw
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.pushingpixels.substance.internal.ui.SubstanceRootPaneUI;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public final class ClientUI extends JFrame
|
||||
public class ClientUI extends JFrame
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(ClientUI.class);
|
||||
|
||||
@@ -48,14 +48,16 @@ public final class ClientUI extends JFrame
|
||||
private static final int PANEL_HEIGHT = 536;
|
||||
private static final int EXPANDED_WIDTH = PANEL_WIDTH + PluginPanel.PANEL_WIDTH;
|
||||
|
||||
private final RuneLite runelite;
|
||||
private JPanel container;
|
||||
private JPanel navContainer;
|
||||
private ClientPanel panel;
|
||||
private PluginToolbar pluginToolbar;
|
||||
private PluginPanel pluginPanel;
|
||||
|
||||
public ClientUI()
|
||||
public ClientUI(RuneLite runelite)
|
||||
{
|
||||
this.runelite = runelite;
|
||||
init();
|
||||
pack();
|
||||
TitleBarPane titleBarPane = new TitleBarPane(this.getRootPane(), (SubstanceRootPaneUI)this.getRootPane().getUI());
|
||||
@@ -86,7 +88,7 @@ public final class ClientUI extends JFrame
|
||||
container = new JPanel();
|
||||
container.setLayout(new BorderLayout(0, 0));
|
||||
|
||||
panel = new ClientPanel();
|
||||
panel = new ClientPanel(this);
|
||||
if (!RuneLite.getOptions().has("no-rs"))
|
||||
{
|
||||
try
|
||||
@@ -139,7 +141,7 @@ public final class ClientUI extends JFrame
|
||||
|
||||
private void checkExit()
|
||||
{
|
||||
Client client = RuneLite.getClient();
|
||||
Client client = runelite.getClient();
|
||||
int result = JOptionPane.OK_OPTION;
|
||||
|
||||
// only ask if not logged out
|
||||
@@ -163,4 +165,9 @@ public final class ClientUI extends JFrame
|
||||
{
|
||||
return pluginPanel;
|
||||
}
|
||||
|
||||
RuneLite getRunelite()
|
||||
{
|
||||
return runelite;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,22 +25,41 @@
|
||||
package net.runelite.client.ui.overlay;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import net.runelite.client.RuneLite;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.config.RuneliteConfig;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxOverlay;
|
||||
import net.runelite.client.ui.overlay.tooltips.TooltipRenderer;
|
||||
|
||||
@Singleton
|
||||
public class OverlayRenderer
|
||||
{
|
||||
private final TooltipRenderer tooltipRenderer = new TooltipRenderer();
|
||||
private final InfoBoxOverlay infoBoxOverlay = new InfoBoxOverlay(tooltipRenderer);
|
||||
private final Client client;
|
||||
private final TooltipRenderer tooltipRenderer;
|
||||
private final InfoBoxOverlay infoBoxOverlay;
|
||||
|
||||
@Inject
|
||||
PluginManager pluginManager;
|
||||
|
||||
@Inject
|
||||
public OverlayRenderer(@Nullable Client client, InfoBoxManager infoboxManager, RuneliteConfig config)
|
||||
{
|
||||
this.client = client;
|
||||
tooltipRenderer = new TooltipRenderer(client, config);
|
||||
infoBoxOverlay = new InfoBoxOverlay(client, tooltipRenderer, infoboxManager);
|
||||
}
|
||||
|
||||
public void render(BufferedImage clientBuffer)
|
||||
{
|
||||
TopDownRendererLeft tdl = new TopDownRendererLeft();
|
||||
TopDownRendererRight tdr = new TopDownRendererRight();
|
||||
TopDownRendererRight tdr = new TopDownRendererRight(client);
|
||||
DynamicRenderer dr = new DynamicRenderer();
|
||||
for (Plugin plugin : RuneLite.getRunelite().getPluginManager().getPlugins())
|
||||
for (Plugin plugin : pluginManager.getPlugins())
|
||||
{
|
||||
for (Overlay overlay : plugin.getOverlays())
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
public class TopDownRendererRight implements Renderer
|
||||
{
|
||||
@@ -39,8 +38,14 @@ public class TopDownRendererRight implements Renderer
|
||||
private static final int BORDER_RIGHT = 10;
|
||||
private static final int PADDING = 10;
|
||||
|
||||
private final Client client;
|
||||
private final List<Overlay> overlays = new ArrayList<>();
|
||||
|
||||
public TopDownRendererRight(Client client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public void add(Overlay overlay)
|
||||
{
|
||||
overlays.add(overlay);
|
||||
@@ -49,7 +54,6 @@ public class TopDownRendererRight implements Renderer
|
||||
@Override
|
||||
public void render(BufferedImage clientBuffer)
|
||||
{
|
||||
Client client = RuneLite.getClient();
|
||||
overlays.sort((o1, o2) -> o2.getPriority().compareTo(o1.getPriority()));
|
||||
|
||||
int y = BORDER_TOP;
|
||||
|
||||
@@ -29,9 +29,11 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import javax.inject.Singleton;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class InfoBoxManager
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(InfoBoxManager.class);
|
||||
|
||||
@@ -35,7 +35,6 @@ import java.util.List;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
@@ -49,14 +48,16 @@ public class InfoBoxOverlay extends Overlay
|
||||
private static final int SEPARATOR = 2;
|
||||
private static final Color BACKGROUND = new Color(Color.gray.getRed(), Color.gray.getGreen(), Color.gray.getBlue(), 127);
|
||||
|
||||
private final RuneLite runelite = RuneLite.getRunelite();
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final Client client;
|
||||
private final TooltipRenderer tooltipRenderer;
|
||||
private final InfoBoxManager infoboxManager;
|
||||
|
||||
public InfoBoxOverlay(TooltipRenderer tooltipRenderer)
|
||||
public InfoBoxOverlay(Client client, TooltipRenderer tooltipRenderer, InfoBoxManager infoboxManager)
|
||||
{
|
||||
super(OverlayPosition.TOP_LEFT, OverlayPriority.LOW);
|
||||
this.client = client;
|
||||
this.tooltipRenderer = tooltipRenderer;
|
||||
this.infoboxManager = infoboxManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +68,7 @@ public class InfoBoxOverlay extends Overlay
|
||||
return null;
|
||||
}
|
||||
|
||||
List<InfoBox> infoBoxes = runelite.getInfoBoxManager().getInfoBoxes();
|
||||
List<InfoBox> infoBoxes = infoboxManager.getInfoBoxes();
|
||||
|
||||
if (infoBoxes.isEmpty())
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.RuneliteConfig;
|
||||
import net.runelite.client.ui.overlay.Renderer;
|
||||
|
||||
@@ -47,11 +46,17 @@ public class TooltipRenderer implements Renderer
|
||||
private static final Color BORDER_COLOR = Color.black;
|
||||
private static final Color FONT_COLOR = Color.white;
|
||||
|
||||
private final Client client = RuneLite.getClient();
|
||||
private final RuneliteConfig config = RuneLite.getRunelite().getConfig();
|
||||
private final Client client;
|
||||
private final RuneliteConfig config;
|
||||
|
||||
private Tooltip tooltip;
|
||||
|
||||
public TooltipRenderer(Client client, RuneliteConfig config)
|
||||
{
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(BufferedImage clientBuffer)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import org.junit.Test;
|
||||
|
||||
public class RuneliteModuleTest
|
||||
{
|
||||
@Test
|
||||
public void testConfigure()
|
||||
{
|
||||
Guice.createInjector(new RuneliteModule());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -25,16 +25,42 @@
|
||||
package net.runelite.client.config;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.testing.fieldbinder.Bind;
|
||||
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.account.AccountSession;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ConfigManagerTest
|
||||
{
|
||||
@Mock
|
||||
@Bind
|
||||
EventBus eventBus;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
ScheduledExecutorService executor;
|
||||
|
||||
@Inject
|
||||
ConfigManager manager;
|
||||
|
||||
@Before
|
||||
public void before()
|
||||
{
|
||||
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetConfig() throws IOException
|
||||
{
|
||||
@@ -43,7 +69,6 @@ public class ConfigManagerTest
|
||||
accountSession.setUsername("test");
|
||||
accountSession.setCreated(Instant.now());
|
||||
|
||||
ConfigManager manager = new ConfigManager(mock(EventBus.class));
|
||||
manager.setConfiguration("test", "key", "moo");
|
||||
|
||||
TestConfig conf = manager.getConfig(TestConfig.class);
|
||||
@@ -58,8 +83,6 @@ public class ConfigManagerTest
|
||||
accountSession.setUsername("test");
|
||||
accountSession.setCreated(Instant.now());
|
||||
|
||||
ConfigManager manager = new ConfigManager(mock(EventBus.class));
|
||||
|
||||
TestConfig conf = manager.getConfig(TestConfig.class);
|
||||
Assert.assertEquals("default", conf.key());
|
||||
}
|
||||
@@ -72,8 +95,6 @@ public class ConfigManagerTest
|
||||
accountSession.setUsername("test");
|
||||
accountSession.setCreated(Instant.now());
|
||||
|
||||
ConfigManager manager = new ConfigManager(mock(EventBus.class));
|
||||
|
||||
TestConfig conf = manager.getConfig(TestConfig.class);
|
||||
conf.key("new value");
|
||||
|
||||
@@ -88,8 +109,6 @@ public class ConfigManagerTest
|
||||
accountSession.setUsername("test");
|
||||
accountSession.setCreated(Instant.now());
|
||||
|
||||
ConfigManager manager = new ConfigManager(mock(EventBus.class));
|
||||
|
||||
TestConfig conf = manager.getConfig(TestConfig.class);
|
||||
ConfigDescriptor descriptor = manager.getConfigDescriptor(conf);
|
||||
Assert.assertEquals(1, descriptor.getItems().size());
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.plugins;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.grapher.graphviz.GraphvizGrapher;
|
||||
import com.google.inject.grapher.graphviz.GraphvizModule;
|
||||
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import joptsimple.OptionSet;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.RuneliteModule;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class PluginManagerTest
|
||||
{
|
||||
@Rule
|
||||
public TemporaryFolder folder = new TemporaryFolder();
|
||||
|
||||
@Mock
|
||||
ClientUI clientUi;
|
||||
|
||||
@Before
|
||||
public void before()
|
||||
{
|
||||
RuneLite.setOptions(mock(OptionSet.class));
|
||||
|
||||
Injector injector = Guice.createInjector(new RuneliteModule(),
|
||||
BoundFieldModule.of(this));
|
||||
RuneLite.setInjector(injector);
|
||||
// test with no client bound
|
||||
RuneLite runelite = injector.getInstance(RuneLite.class);
|
||||
runelite.setGui(clientUi);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadPlugins() throws Exception
|
||||
{
|
||||
PluginManager pluginManager = new PluginManager();
|
||||
pluginManager.loadPlugins();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dumpGraph() throws Exception
|
||||
{
|
||||
List<Module> modules = new ArrayList<>();
|
||||
modules.add(new GraphvizModule());
|
||||
modules.add(new RuneliteModule());
|
||||
|
||||
PluginManager pluginManager = new PluginManager();
|
||||
pluginManager.loadPlugins();
|
||||
for (Plugin p : pluginManager.getAllPlugins())
|
||||
{
|
||||
modules.add(p);
|
||||
}
|
||||
|
||||
File file = folder.newFile();
|
||||
try (PrintWriter out = new PrintWriter(file, "UTF-8"))
|
||||
{
|
||||
Injector injector = Guice.createInjector(modules);
|
||||
GraphvizGrapher grapher = injector.getInstance(GraphvizGrapher.class);
|
||||
grapher.setOut(out);
|
||||
grapher.setRankdir("TB");
|
||||
grapher.graph(injector);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,16 +24,14 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.hiscore;
|
||||
|
||||
import net.runelite.client.RuneLite;
|
||||
import org.junit.Test;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class HiscorePanelTest
|
||||
{
|
||||
@Test
|
||||
public void testConstructor()
|
||||
{
|
||||
new HiscorePanel(mock(RuneLite.class));
|
||||
new HiscorePanel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user