Merge pull request #351 from deathbeam/config-overhaul

Add ability to disable/enable all plugins
This commit is contained in:
Adam
2018-02-15 20:11:18 -05:00
committed by GitHub
143 changed files with 875 additions and 1675 deletions

View File

@@ -151,7 +151,7 @@ public class RuneLite
// Initialize Discord service
discordService.init();
// Load default configuration
// Load user configuration
configManager.load();
// Register event listeners
@@ -159,6 +159,7 @@ public class RuneLite
eventBus.register(menuManager);
eventBus.register(chatMessageManager);
eventBus.register(gui);
eventBus.register(pluginManager);
// Setup the notifier
notifier = new Notifier(properties.getTitle(), gui.getTrayIcon());
@@ -172,7 +173,7 @@ public class RuneLite
// Plugins have provided their config, so set default config
// to main settings
configManager.loadDefault();
pluginManager.loadDefaultPluginConfiguration();
// Start plugins
pluginManager.startCorePlugins();

View File

@@ -41,10 +41,10 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLite;
import net.runelite.client.config.ConfigManager;
import net.runelite.api.events.SessionClose;
import net.runelite.api.events.SessionOpen;
import net.runelite.client.RuneLite;
import net.runelite.client.config.ConfigManager;
import net.runelite.http.api.account.AccountClient;
import net.runelite.http.api.account.OAuthResponse;
import net.runelite.http.api.ws.messages.LoginResponse;
@@ -261,4 +261,4 @@ public class SessionManager
closeSession();
deleteSession();
}
}
}

View File

@@ -26,5 +26,4 @@ package net.runelite.client.config;
public interface Config
{
}

View File

@@ -25,8 +25,6 @@
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.awt.Dimension;
import java.io.File;
@@ -37,8 +35,8 @@ import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.ScheduledExecutorService;
@@ -46,10 +44,9 @@ import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.events.ConfigChanged;
import net.runelite.client.RuneLite;
import net.runelite.client.account.AccountSession;
import net.runelite.api.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;
@@ -66,9 +63,6 @@ public class ConfigManager
@Inject
ScheduledExecutorService executor;
@Inject
PluginManager pluginManager;
private AccountSession session;
private ConfigClient client;
private File propertiesFile;
@@ -81,42 +75,6 @@ public class ConfigManager
this.propertiesFile = getPropertiesFile();
}
public ConfigManager(EventBus eventBus, AccountSession session)
{
this.eventBus = eventBus;
switchSession(session);
}
public List<Config> getConfigProxies()
{
List<Injector> injectors = new ArrayList<>();
injectors.add(RuneLite.getInjector());
pluginManager.getPlugins().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 : getConfigProxies())
{
setDefaultConfiguration(config, false);
}
}
public final void switchSession(AccountSession session)
{
if (session == null)
@@ -133,7 +91,6 @@ public class ConfigManager
this.propertiesFile = getPropertiesFile();
load(); // load profile specific config
loadDefault(); // set defaults over anything not set
}
private File getPropertiesFile()
@@ -183,8 +140,18 @@ public class ConfigManager
for (ConfigEntry entry : configuration.getConfig())
{
log.debug("Loading configuration value from client {}: {}", entry.getKey(), entry.getValue());
final String[] split = entry.getKey().split("\\.");
final String groupName = split[0];
final String key = split[1];
final String value = entry.getValue();
final String oldValue = (String) properties.setProperty(entry.getKey(), value);
properties.setProperty(entry.getKey(), entry.getValue());
ConfigChanged configChanged = new ConfigChanged();
configChanged.setGroup(groupName);
configChanged.setKey(key);
configChanged.setOldValue(oldValue);
configChanged.setNewValue(value);
eventBus.post(configChanged);
}
try
@@ -343,16 +310,11 @@ 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(Comparator.comparingInt(m -> m.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);
}

View File

@@ -37,6 +37,14 @@ public @interface PluginDescriptor
{
String name();
boolean enabledByDefault() default true;
/**
* Whether or not plugin is hidden from configuration panel
* @return
*/
boolean hidden() default false;
boolean developerPlugin() default false;
boolean loadWhenOutdated() default false;

View File

@@ -26,12 +26,14 @@ package net.runelite.client.plugins;
import com.google.common.collect.ImmutableSet;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import com.google.common.reflect.ClassPath;
import com.google.common.reflect.ClassPath.ClassInfo;
import com.google.inject.Binder;
import com.google.inject.CreationException;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@@ -40,15 +42,23 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Singleton;
import javax.swing.SwingUtilities;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.events.SessionClose;
import net.runelite.api.events.SessionOpen;
import net.runelite.client.RuneLite;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.events.PluginChanged;
import net.runelite.client.task.Schedule;
import net.runelite.client.task.ScheduledMethod;
import net.runelite.client.task.Scheduler;
import net.runelite.client.util.RegionTileManager;
@Singleton
@Slf4j
@@ -65,10 +75,114 @@ public class PluginManager
@Inject
Scheduler scheduler;
@Inject
ConfigManager configManager;
@Inject
ScheduledExecutorService executor;
@Inject
RegionTileManager regionTileManager;
@Setter
boolean isOutdated;
private final List<Plugin> plugins = new CopyOnWriteArrayList<>();
private final List<Plugin> activePlugins = new CopyOnWriteArrayList<>();
private final String runeliteGroupName = RuneLiteConfig.class
.getAnnotation(ConfigGroup.class).keyName();
@Subscribe
public void onSessionOpen(SessionOpen event)
{
refreshPlugins();
}
@Subscribe
public void onSessionClose(SessionClose event)
{
refreshPlugins();
}
private void refreshPlugins()
{
loadDefaultPluginConfiguration();
getPlugins()
.forEach(plugin -> executor.submit(() ->
{
try
{
if (!startPlugin(plugin))
{
stopPlugin(plugin);
}
}
catch (PluginInstantiationException e)
{
log.warn("Error during starting/stopping plugin {}. {}", plugin.getClass().getSimpleName(), e);
}
}));
}
public Config getPluginConfigProxy(Plugin plugin)
{
final Injector injector = plugin.getInjector();
for (Key<?> key : injector.getAllBindings().keySet())
{
Class<?> type = key.getTypeLiteral().getRawType();
if (Config.class.isAssignableFrom(type))
{
return (Config) injector.getInstance(key);
}
}
return null;
}
public List<Config> getPluginConfigProxies()
{
List<Injector> injectors = new ArrayList<>();
injectors.add(RuneLite.getInjector());
getPlugins().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 loadDefaultPluginConfiguration()
{
for (Object config : getPluginConfigProxies())
{
configManager.setDefaultConfiguration(config, false);
}
for (Plugin plugin : getPlugins())
{
final String keyName = plugin.getClass().getSimpleName().toLowerCase();
final String value = configManager.getConfiguration(runeliteGroupName, keyName);
if (value == null)
{
final PluginDescriptor pluginDescriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final boolean enabled = pluginDescriptor == null || pluginDescriptor.enabledByDefault();
configManager.setConfiguration(runeliteGroupName, keyName, String.valueOf(enabled));
}
}
}
public void loadCorePlugins() throws IOException
{
@@ -86,7 +200,7 @@ public class PluginManager
}
catch (PluginInstantiationException ex)
{
log.warn("Unable to start plugin {}", plugin.getClass().getSimpleName(), ex);
log.warn("Unable to start plugin {}. {}", plugin.getClass().getSimpleName(), ex);
plugins.remove(plugin);
}
}
@@ -136,11 +250,11 @@ public class PluginManager
Plugin plugin;
try
{
plugin = instantiate(pluginDescriptor, (Class<Plugin>) clazz);
plugin = instantiate((Class<Plugin>) clazz);
}
catch (PluginInstantiationException ex)
{
log.warn("error instantiating plugin!", ex);
log.warn("Error instantiating plugin!", ex);
continue;
}
@@ -150,8 +264,15 @@ public class PluginManager
return scannedPlugins;
}
void startPlugin(Plugin plugin) throws PluginInstantiationException
public synchronized boolean startPlugin(Plugin plugin) throws PluginInstantiationException
{
if (activePlugins.contains(plugin) || !isPluginEnabled(plugin))
{
return false;
}
activePlugins.add(plugin);
try
{
// plugins always start in the event thread
@@ -168,23 +289,32 @@ public class PluginManager
});
log.debug("Plugin {} is now running", plugin.getClass().getSimpleName());
regionTileManager.simulateObjectSpawns(plugin);
eventBus.register(plugin);
eventBus.post(new PluginChanged(plugin, true));
schedule(plugin);
eventBus.post(new PluginChanged(plugin, true));
}
catch (InterruptedException | InvocationTargetException ex)
{
throw new PluginInstantiationException(ex);
}
return true;
}
void stopPlugin(Plugin plugin) throws PluginInstantiationException
public synchronized boolean stopPlugin(Plugin plugin) throws PluginInstantiationException
{
if (!activePlugins.contains(plugin) || isPluginEnabled(plugin))
{
return false;
}
activePlugins.remove(plugin);
try
{
unschedule(plugin);
eventBus.unregister(plugin);
eventBus.post(new PluginChanged(plugin, false));
// plugins always stop in the event thread
SwingUtilities.invokeAndWait(() ->
@@ -199,19 +329,37 @@ public class PluginManager
}
});
log.debug("Plugin {} is now stopped", plugin.getClass().getSimpleName());
eventBus.post(new PluginChanged(plugin, false));
}
catch (InterruptedException | InvocationTargetException ex)
{
throw new PluginInstantiationException(ex);
}
return true;
}
Plugin instantiate(PluginDescriptor pluginDescriptor, Class<Plugin> clazz) throws PluginInstantiationException
public void setPluginEnabled(Plugin plugin, boolean enabled)
{
final String keyName = plugin.getClass().getSimpleName().toLowerCase();
configManager.setConfiguration(runeliteGroupName, keyName, String.valueOf(enabled));
}
public boolean isPluginEnabled(Plugin plugin)
{
final String keyName = plugin.getClass().getSimpleName().toLowerCase();
final String value = configManager.getConfiguration(runeliteGroupName, keyName);
return Boolean.valueOf(value);
}
private Plugin instantiate(Class<Plugin> clazz) throws PluginInstantiationException
{
Plugin plugin;
try
{
plugin = (Plugin) clazz.newInstance();
plugin = clazz.newInstance();
}
catch (InstantiationException | IllegalAccessException ex)
{
@@ -222,7 +370,7 @@ public class PluginManager
{
Module pluginModule = (Binder binder) ->
{
binder.bind((Class<Plugin>) clazz).toInstance(plugin);
binder.bind(clazz).toInstance(plugin);
binder.install(plugin);
};
Injector pluginInjector = RuneLite.getInjector().createChildInjector(pluginModule);
@@ -234,7 +382,7 @@ public class PluginManager
throw new PluginInstantiationException(ex);
}
log.debug("Loaded plugin {}", pluginDescriptor.name());
log.debug("Loaded plugin {}", clazz.getSimpleName());
return plugin;
}

View File

@@ -42,7 +42,7 @@ import net.runelite.client.ui.PluginToolbar;
import net.runelite.client.util.RunnableExceptionLogger;
@PluginDescriptor(
name = "Account plugin",
name = "Account",
loadWhenOutdated = true
)
@Slf4j

View File

@@ -44,26 +44,19 @@ public class AgilityOverlay extends Overlay
private final Client client;
private final AgilityPlugin plugin;
private final AgilityPluginConfiguration config;
@Inject
public AgilityOverlay(@Nullable Client client, AgilityPlugin plugin, AgilityPluginConfiguration config)
public AgilityOverlay(@Nullable Client client, AgilityPlugin plugin)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_SCENE);
this.client = client;
this.plugin = plugin;
this.config = config;
}
@Override
public Dimension render(Graphics2D graphics, java.awt.Point parent)
{
if (!config.enabled())
{
return null;
}
Point playerLocation = client.getLocalPlayer().getLocalLocation();
Point mousePosition = client.getMouseCanvasPosition();
plugin.getObstacles().forEach((object, tile) ->

View File

@@ -26,7 +26,6 @@ package net.runelite.client.plugins.agilityplugin;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Binder;
import com.google.inject.Provides;
import java.util.HashMap;
import javax.inject.Inject;
import lombok.Getter;
@@ -47,12 +46,11 @@ import net.runelite.api.events.GroundObjectSpawned;
import net.runelite.api.events.WallObjectChanged;
import net.runelite.api.events.WallObjectDespawned;
import net.runelite.api.events.WallObjectSpawned;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(
name = "Agility plugin"
name = "Agility"
)
@Slf4j
public class AgilityPlugin extends Plugin
@@ -64,10 +62,10 @@ public class AgilityPlugin extends Plugin
@Getter
private AgilityOverlay overlay;
@Provides
AgilityPluginConfiguration getConfig(ConfigManager configManager)
@Override
protected void shutDown() throws Exception
{
return configManager.getConfig(AgilityPluginConfiguration.class);
obstacles.clear();
}
@Override

View File

@@ -1,48 +0,0 @@
/*
* Copyright (c) 2018, 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.agilityplugin;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "agilityplugin",
name = "Agility plugin",
description = "Configuration for the agility plugin"
)
public interface AgilityPluginConfiguration extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable overlay",
description = "Configures whether the overlay is enabled"
)
default boolean enabled()
{
return true;
}
}

View File

@@ -35,17 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface AttackIndicatorConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Show attack style",
description = "Configures whether or not the attack indicator overlay is displayed",
position = 1
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "warnForDefensive",
name = "Warn for defensive",

View File

@@ -37,26 +37,19 @@ public class AttackIndicatorOverlay extends Overlay
{
private static final int COMPONENT_WIDTH = 80;
private final AttackIndicatorConfig config;
private final AttackIndicatorPlugin plugin;
private final PanelComponent panelComponent = new PanelComponent();
@Inject
public AttackIndicatorOverlay(AttackIndicatorPlugin plugin, AttackIndicatorConfig config)
public AttackIndicatorOverlay(AttackIndicatorPlugin plugin)
{
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
this.plugin = plugin;
this.config = config;
}
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
final String attackStyleString = plugin.getAttackStyle().getName();
panelComponent.setTitleColor(plugin.isWarnedSkillSelected() ? Color.RED : Color.WHITE);

View File

@@ -24,6 +24,11 @@
*/
package net.runelite.client.plugins.attackindicator;
import static net.runelite.api.widgets.WidgetID.COMBAT_GROUP_ID;
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
import static net.runelite.client.plugins.attackindicator.AttackStyle.CASTING;
import static net.runelite.client.plugins.attackindicator.AttackStyle.DEFENSIVE_CASTING;
import static net.runelite.client.plugins.attackindicator.AttackStyle.OTHER;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.google.common.eventbus.Subscribe;
@@ -43,16 +48,13 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.events.WidgetHiddenChanged;
import net.runelite.api.widgets.Widget;
import static net.runelite.api.widgets.WidgetID.COMBAT_GROUP_ID;
import net.runelite.api.widgets.WidgetInfo;
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import static net.runelite.client.plugins.attackindicator.AttackStyle.*;
@PluginDescriptor(
name = "Attack indicator plugin"
name = "Attack indicator"
)
@Slf4j
public class AttackIndicatorPlugin extends Plugin
@@ -202,8 +204,6 @@ public class AttackIndicatorPlugin extends Plugin
boolean enabled = event.getNewValue().equals("true");
switch (event.getKey())
{
case "enabled":
break;
case "warnForDefensive":
updateWarnedSkills(enabled, Skill.DEFENCE);
break;
@@ -222,8 +222,6 @@ public class AttackIndicatorPlugin extends Plugin
case "removeWarnedStyles":
hideWarnedStyles(enabled);
break;
default:
log.warn("Unreachable default case for config keys");
}
}
}

View File

@@ -35,16 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface BarbarianAssaultConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable plugin",
description = "Configures whether or not the plugin is enabled"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "removeUnused",
name = "Remove incorrect calls",

View File

@@ -62,7 +62,7 @@ public class BarbarianAssaultOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled() || client.getGameState() != GameState.LOGGED_IN || currentRound == null)
if (client.getGameState() != GameState.LOGGED_IN || currentRound == null)
{
return null;
}

View File

@@ -52,7 +52,7 @@ import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Barbarian Assault Plugin"
name = "Barbarian Assault"
)
public class BarbarianAssaultPlugin extends Plugin
{

View File

@@ -35,16 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface BarrowsConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not the Barrows plugin is displayed"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "showMinimap",
name = "Show Minimap in tunnels",

View File

@@ -62,11 +62,6 @@ class BarrowsOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
Player local = client.getLocalPlayer();
// tunnels are only on z=0

View File

@@ -91,6 +91,13 @@ public class BarrowsPlugin extends Plugin
return barrowsOverlay;
}
@Override
protected void shutDown()
{
walls.clear();
ladders.clear();
}
@Subscribe
public void onWallObjectSpanwed(WallObjectSpawned event)
{

View File

@@ -41,16 +41,14 @@ class BlastFurnaceCofferOverlay extends Overlay
{
private final Client client;
private final BlastFurnacePlugin plugin;
private final BlastFurnaceConfig config;
private final PanelComponent panelComponent = new PanelComponent();
@Inject
BlastFurnaceCofferOverlay(Client client, BlastFurnacePlugin plugin, BlastFurnaceConfig config)
BlastFurnaceCofferOverlay(Client client, BlastFurnacePlugin plugin)
{
setPosition(OverlayPosition.TOP_LEFT);
this.client = client;
this.plugin = plugin;
this.config = config;
}
@Override

View File

@@ -35,16 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface BlastFurnaceConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable",
description = "Configures whether to enable the blast furnace plugin"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "showConveyorBelt",
name = "Show Conveyor belt clickbox",

View File

@@ -39,25 +39,23 @@ class BlastFurnaceOverlay extends Overlay
{
private final Client client;
private final BlastFurnacePlugin plugin;
private final BlastFurnaceConfig config;
private final ImagePanelComponent imagePanelComponent = new ImagePanelComponent();
@Inject
private ItemManager itemManager;
@Inject
BlastFurnaceOverlay(Client client, BlastFurnacePlugin plugin, BlastFurnaceConfig config)
BlastFurnaceOverlay(Client client, BlastFurnacePlugin plugin)
{
setPosition(OverlayPosition.TOP_LEFT);
this.plugin = plugin;
this.client = client;
this.config = config;
}
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled() || plugin.getConveyorBelt() == null)
if (plugin.getConveyorBelt() == null)
{
return null;
}

View File

@@ -59,6 +59,12 @@ public class BlastFurnacePlugin extends Plugin
@Inject
private ConveyorBeltOverlay conveyorBeltOverlay;
@Override
protected void shutDown()
{
conveyorBelt = null;
}
@Provides
BlastFurnaceConfig provideConfig(ConfigManager configManager)
{

View File

@@ -55,7 +55,7 @@ class ConveyorBeltOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, java.awt.Point parent)
{
if (!config.enabled() || !config.showConveyorBelt() || plugin.getConveyorBelt() == null)
if (!config.showConveyorBelt() || plugin.getConveyorBelt() == null)
{
return null;
}

View File

@@ -35,16 +35,6 @@ import net.runelite.client.config.Config;
)
public interface BoostsConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not boost info is displayed"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "enableSkill",
name = "Enable Skill Boosts",

View File

@@ -72,11 +72,6 @@ class BoostsOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
panelComponent = new PanelComponent();
for (Skill skill : plugin.getShownSkills())

View File

@@ -40,7 +40,7 @@ import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor(
name = "Boosts plugin"
name = "Boosts"
)
public class BoostsPlugin extends Plugin
{
@@ -88,10 +88,7 @@ public class BoostsPlugin extends Plugin
@Override
protected void startUp()
{
if (config.enabled())
{
updateShownSkills(config.enableSkill());
}
updateShownSkills(config.enableSkill());
}
@Override
@@ -103,12 +100,6 @@ public class BoostsPlugin extends Plugin
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
if (!config.enabled())
{
infoBoxManager.removeIf(t -> t instanceof BoostIndicator);
return;
}
updateShownSkills(config.enableSkill());
infoBoxManager.removeIf(t -> t instanceof BoostIndicator

View File

@@ -35,7 +35,7 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor(
name = "Boss timers plugin"
name = "Boss timers"
)
@Slf4j
public class BossTimersPlugin extends Plugin

View File

@@ -30,21 +30,11 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "cannon",
name = "Cannon Plugin",
name = "Cannon",
description = "Configuration for the Cannon plugin"
)
public interface CannonConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not the Cannon plugin is displayed"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "showEmptyCannonNotification",
name = "Empty cannon notification",

View File

@@ -59,7 +59,7 @@ class CannonOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!plugin.cannonPlaced || plugin.myCannon == null || !config.enabled())
if (!plugin.cannonPlaced || plugin.myCannon == null)
{
return null;
}

View File

@@ -50,7 +50,7 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Cannon plugin"
name = "Cannon"
)
public class CannonPlugin extends Plugin
{
@@ -93,6 +93,14 @@ public class CannonPlugin extends Plugin
return cannonOverlay;
}
@Override
protected void shutDown() throws Exception
{
cannonPlaced = false;
myCannon = null;
cballsLeft = 0;
}
@Subscribe
public void onGameObjectSpawned(GameObjectSpawned event)
{

View File

@@ -58,7 +58,7 @@ import net.runelite.http.api.item.ItemPrice;
import net.runelite.http.api.item.SearchResult;
@PluginDescriptor(
name = "Chat commands plugin"
name = "Chat commands"
)
@Slf4j
public class ChatCommandsPlugin extends Plugin
@@ -82,6 +82,13 @@ public class ChatCommandsPlugin extends Plugin
@Inject
private ScheduledExecutorService executor;
@Override
protected void startUp()
{
cacheConfiguredColors();
chatMessageManager.refreshAll();
}
@Provides
ChatCommandsConfig provideConfig(ConfigManager configManager)
{

View File

@@ -1,47 +0,0 @@
/*
* 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.plugins.clanchat;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "clanchat",
name = "Clan Chat",
description = "Configuration for clan chat"
)
public interface ClanChatConfig extends Config
{
@ConfigItem(
keyName = "clanRank",
name = "Show Clan Ranks Icon",
description = "Configures whether the clan ranks icons are shown next to name in chat"
)
default boolean clanRank()
{
return true;
}
}

View File

@@ -28,7 +28,6 @@ import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Provides;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.DataBufferByte;
@@ -48,17 +47,16 @@ import net.runelite.api.ClanMemberRank;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.IndexedSprite;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.SetMessage;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule;
@PluginDescriptor(
name = "Clan chat plugin"
name = "Clan chat"
)
@Slf4j
public class ClanChatPlugin extends Plugin
@@ -72,47 +70,48 @@ public class ClanChatPlugin extends Plugin
};
private LoadingCache<String, ClanMemberRank> clanRanksCache;
private final LoadingCache<String, ClanMemberRank> clanRanksCache = CacheBuilder.newBuilder()
.maximumSize(100)
.expireAfterAccess(1, TimeUnit.MINUTES)
.build(new CacheLoader<String, ClanMemberRank>()
{
@Override
public ClanMemberRank load(String key) throws Exception
{
final ClanMember[] clanMembersArr = client.getClanMembers();
if (clanMembersArr == null || clanMembersArr.length == 0)
{
return ClanMemberRank.UNRANKED;
}
return Arrays.stream(clanMembersArr)
.filter(Objects::nonNull)
.filter(clanMember -> sanitize(clanMember.getUsername()).equals(sanitize(key)))
.map(ClanMember::getRank)
.findAny()
.orElse(ClanMemberRank.UNRANKED);
}
});
private int modIconsLength;
@Inject
private Client client;
@Inject
private ClanChatConfig config;
@Provides
ClanChatConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(ClanChatConfig.class);
}
@Override
protected void startUp() throws Exception
{
clanRanksCache = CacheBuilder.newBuilder()
.maximumSize(100)
.expireAfterAccess(1, TimeUnit.MINUTES)
.build(new CacheLoader<String, ClanMemberRank>()
{
@Override
public ClanMemberRank load(String key) throws Exception
{
final ClanMember[] clanMembersArr = client.getClanMembers();
if (modIconsLength == 0 && client.getGameState().compareTo(GameState.LOGIN_SCREEN) >= 0)
{
loadClanChatIcons();
}
}
if (clanMembersArr == null || clanMembersArr.length == 0)
{
return ClanMemberRank.UNRANKED;
}
return Arrays.stream(clanMembersArr)
.filter(Objects::nonNull)
.filter(clanMember -> sanitize(clanMember.getUsername()).equals(sanitize(key)))
.map(ClanMember::getRank)
.findAny()
.orElse(ClanMemberRank.UNRANKED);
}
});
@Override
protected void shutDown()
{
clanRanksCache.invalidateAll();
}
@Subscribe
@@ -152,7 +151,7 @@ public class ClanChatPlugin extends Plugin
return;
}
if (config.clanRank() && setMessage.getType() == ChatMessageType.CLANCHAT)
if (setMessage.getType() == ChatMessageType.CLANCHAT)
{
insertClanRankIcon(setMessage);
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2016-2017, Seth <Sethtroll3@gmail.com>
* 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 HOLDER 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.cluescrolls;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "cluescrolls",
name = "Clue Scrolls",
description = "Configuration for the clue scroll plugin"
)
public interface ClueScrollConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable",
description = "Configures whether the clue scroll plugin is displayed"
)
default boolean enabled()
{
return true;
}
}

View File

@@ -44,28 +44,21 @@ public class ClueScrollOverlay extends Overlay
private static final Duration WAIT_DURATION = Duration.ofMinutes(4);
private final Client client;
private final ClueScrollConfig config;
private final PanelComponent panelComponent = new PanelComponent();
ClueScroll clue;
Instant clueTimeout;
@Inject
public ClueScrollOverlay(@Nullable Client client, ClueScrollConfig config)
public ClueScrollOverlay(@Nullable Client client)
{
setPosition(OverlayPosition.TOP_LEFT);
this.client = client;
this.config = config;
}
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
if (clue == null)
{
return null;

View File

@@ -27,7 +27,6 @@
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.inject.Inject;
@@ -35,22 +34,18 @@ 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.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule;
@PluginDescriptor(
name = "Clue scroll plugin"
name = "Clue scroll"
)
public class ClueScrollPlugin extends Plugin
{
@Inject
private Client client;
@Inject
private ClueScrollConfig config;
@Inject
private ClueScrollOverlay clueScrollOverlay;
@@ -60,12 +55,6 @@ public class ClueScrollPlugin extends Plugin
binder.bind(ClueScrollOverlay.class);
}
@Provides
ClueScrollConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(ClueScrollConfig.class);
}
@Override
public ClueScrollOverlay getOverlay()
{
@@ -78,7 +67,7 @@ public class ClueScrollPlugin extends Plugin
)
public void checkForClues()
{
if (client.getGameState() != GameState.LOGGED_IN || !config.enabled())
if (client.getGameState() != GameState.LOGGED_IN)
{
return;
}

View File

@@ -1,47 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.combatlevel;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "combatlevel",
name = "Combat Level",
description = "Configuration for the precise combat level plugin"
)
public interface CombatLevelConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not precise combat level is displayed"
)
default boolean enabled()
{
return true;
}
}

View File

@@ -25,7 +25,6 @@
package net.runelite.client.plugins.combatlevel;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Provides;
import java.text.DecimalFormat;
import javax.inject.Inject;
import net.runelite.api.Client;
@@ -35,12 +34,11 @@ import net.runelite.api.Skill;
import net.runelite.api.events.GameTick;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(
name = "Combat level plugin"
name = "Combat level"
)
public class CombatLevelPlugin extends Plugin
{
@@ -49,13 +47,20 @@ public class CombatLevelPlugin extends Plugin
@Inject
Client client;
@Inject
CombatLevelConfig config;
@Provides
CombatLevelConfig provideConfig(ConfigManager configManager)
@Override
protected void shutDown() throws Exception
{
return configManager.getConfig(CombatLevelConfig.class);
Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL);
if (combatLevelWidget != null)
{
String widgetText = combatLevelWidget.getText();
if (widgetText.contains("."))
{
combatLevelWidget.setText(widgetText.substring(0, widgetText.indexOf(".")));
}
}
}
@Subscribe
@@ -72,9 +77,7 @@ public class CombatLevelPlugin extends Plugin
return;
}
if (config.enabled())
{
double combatLevelPrecise = Experience.getCombatLevelPrecise(
double combatLevelPrecise = Experience.getCombatLevelPrecise(
client.getRealSkillLevel(Skill.ATTACK),
client.getRealSkillLevel(Skill.STRENGTH),
client.getRealSkillLevel(Skill.DEFENCE),
@@ -82,16 +85,8 @@ public class CombatLevelPlugin extends Plugin
client.getRealSkillLevel(Skill.MAGIC),
client.getRealSkillLevel(Skill.RANGED),
client.getRealSkillLevel(Skill.PRAYER)
);
combatLevelWidget.setText("Combat Lvl: " + decimalFormat.format(combatLevelPrecise));
}
else
{
String widgetText = combatLevelWidget.getText();
if (widgetText.contains("."))
{
combatLevelWidget.setText(widgetText.substring(0, widgetText.indexOf(".")));
}
}
);
combatLevelWidget.setText("Combat Lvl: " + decimalFormat.format(combatLevelPrecise));
}
}

View File

@@ -24,13 +24,11 @@
*/
package net.runelite.client.plugins.config;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION;
import static javax.swing.JOptionPane.YES_OPTION;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
@@ -38,9 +36,14 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.AbstractMap;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ScheduledExecutorService;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JColorChooser;
@@ -50,6 +53,9 @@ import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION;
import static javax.swing.JOptionPane.YES_OPTION;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
@@ -66,6 +72,11 @@ import net.runelite.client.config.ConfigDescriptor;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigItemDescriptor;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginInstantiationException;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.ui.PluginPanel;
@Slf4j
@@ -73,16 +84,39 @@ public class ConfigPanel extends PluginPanel
{
private static final int TEXT_FIELD_WIDTH = 7;
private static final int SPINNER_FIELD_WIDTH = 6;
private static BufferedImage CONFIG_ICON;
private static BufferedImage UNCHECK_ICON;
private static BufferedImage CHECK_ICON;
static
{
try
{
CONFIG_ICON = ImageIO.read(ConfigPanel.class.getResourceAsStream("config_icon.png"));
UNCHECK_ICON = ImageIO.read(ConfigPanel.class.getResourceAsStream("698-0.png"));
CHECK_ICON = ImageIO.read(ConfigPanel.class.getResourceAsStream("699-0.png"));
}
catch (IOException e)
{
log.warn("Failed to read icon", e);
}
}
private final PluginManager pluginManager;
private final ConfigManager configManager;
private final ScheduledExecutorService executorService;
private final RuneLiteConfig runeLiteConfig;
private final JTextField searchBar = new JTextField();
private Map<String, JPanel> children = new TreeMap<>();
private int scrollBarPosition = 0;
public ConfigPanel(ConfigManager configManager)
public ConfigPanel(PluginManager pluginManager, ConfigManager configManager, ScheduledExecutorService executorService, RuneLiteConfig runeLiteConfig)
{
super();
this.pluginManager = pluginManager;
this.configManager = configManager;
this.executorService = executorService;
this.runeLiteConfig = runeLiteConfig;
searchBar.getDocument().addDocumentListener(new DocumentListener()
{
@@ -111,36 +145,126 @@ public class ConfigPanel extends PluginPanel
final void rebuildPluginList()
{
scrollBarPosition = getScrollPane().getVerticalScrollBar().getValue();
Map<String, JPanel> newChildren = new TreeMap<>();
configManager.getConfigProxies()
.stream()
// Convert config proxies to pair of config descriptors and config proxies
.map(c -> new AbstractMap.SimpleEntry<>(configManager.getConfigDescriptor(c), c))
.filter(e -> e.getKey().getItems().stream().anyMatch(cid -> !cid.getItem().hidden()))
.forEach(e ->
{
ConfigDescriptor cd = e.getKey();
Config config = e.getValue();
String groupName = cd.getGroup().name();
if (children.containsKey(groupName))
pluginManager.getPlugins().stream()
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).hidden())
.sorted(Comparator.comparing(left -> left.getClass().getAnnotation(PluginDescriptor.class).name()))
.forEach(plugin ->
{
newChildren.put(groupName, children.get(groupName));
return;
}
final Config pluginConfigProxy = pluginManager.getPluginConfigProxy(plugin);
final String pluginName = plugin.getClass().getAnnotation(PluginDescriptor.class).name();
JPanel groupPanel = new JPanel();
groupPanel.setLayout(new BorderLayout());
JButton viewGroupItemsButton = new JButton(groupName);
viewGroupItemsButton.addActionListener(ae -> openGroupConfigPanel(config, cd, configManager));
groupPanel.add(viewGroupItemsButton);
newChildren.put(groupName, groupPanel);
});
final JPanel groupPanel = buildGroupPanel();
groupPanel.add(new JLabel(pluginName), BorderLayout.CENTER);
final JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(1, 2, 3, 0));
groupPanel.add(buttonPanel, BorderLayout.LINE_END);
final JButton editConfigButton = buildConfigButton(pluginConfigProxy);
buttonPanel.add(editConfigButton);
final JButton toggleButton = buildToggleButton(plugin);
buttonPanel.add(toggleButton);
newChildren.put(pluginName, groupPanel);
});
final JPanel groupPanel = buildGroupPanel();
groupPanel.add(new JLabel("RuneLite"), BorderLayout.CENTER);
final JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(1, 2, 3, 0));
groupPanel.add(buttonPanel, BorderLayout.LINE_END);
final JButton editConfigButton = buildConfigButton(runeLiteConfig);
buttonPanel.add(editConfigButton);
final JButton toggleButton = buildToggleButton(null);
buttonPanel.add(toggleButton);
newChildren.put("RuneLite", groupPanel);
children = newChildren;
openConfigList();
}
private JPanel buildGroupPanel()
{
// Create base panel for the config button and enabled/disabled button
final JPanel groupPanel = new JPanel();
groupPanel.setLayout(new BorderLayout(3, 0));
return groupPanel;
}
private JButton buildConfigButton(Config config)
{
// Create edit config button and disable it by default
final JButton editConfigButton = new JButton(new ImageIcon(CONFIG_ICON));
editConfigButton.setPreferredSize(new Dimension(32, 0));
editConfigButton.setEnabled(false);
// If we have configuration proxy enable the button and add edit config listener
if (config != null)
{
final ConfigDescriptor configDescriptor = configManager.getConfigDescriptor(config);
editConfigButton.addActionListener(ae -> openGroupConfigPanel(config, configDescriptor, configManager));
editConfigButton.setEnabled(true);
editConfigButton.setToolTipText("Edit plugin configuration");
}
return editConfigButton;
}
private JButton buildToggleButton(Plugin plugin)
{
// Create enabling/disabling button
final JButton toggleButton = new JButton(new ImageIcon(CHECK_ICON));
toggleButton.setPreferredSize(new Dimension(32, 0));
if (plugin == null)
{
toggleButton.setEnabled(false);
return toggleButton;
}
highlightButton(toggleButton, pluginManager.isPluginEnabled(plugin));
toggleButton.addActionListener(e -> executorService.submit(() ->
{
final boolean enabled = pluginManager.isPluginEnabled(plugin);
pluginManager.setPluginEnabled(plugin, !enabled);
try
{
if (enabled)
{
pluginManager.stopPlugin(plugin);
}
else
{
pluginManager.startPlugin(plugin);
}
}
catch (PluginInstantiationException ex)
{
log.warn("Error during starting/stopping plugin {}", plugin.getClass().getSimpleName(), ex);
}
highlightButton(toggleButton, !enabled);
}));
return toggleButton;
}
private void highlightButton(JButton button, boolean enabled)
{
button.setIcon(enabled ? new ImageIcon(CHECK_ICON) : new ImageIcon(UNCHECK_ICON));
button.setToolTipText(enabled ? "Disable plugin" : "Enable plugin");
}
private void onSearchBarChanged()
{
children.forEach((key, value) ->

View File

@@ -25,19 +25,23 @@
package net.runelite.client.plugins.config;
import com.google.common.eventbus.Subscribe;
import java.util.concurrent.ScheduledExecutorService;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import javax.swing.SwingUtilities;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.events.PluginChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.NavigationButton;
@PluginDescriptor(
name = "Configuration plugin",
loadWhenOutdated = true
name = "Configuration",
loadWhenOutdated = true,
hidden = true // prevent users from disabling
)
public class ConfigPlugin extends Plugin
{
@@ -47,13 +51,22 @@ public class ConfigPlugin extends Plugin
@Inject
private ConfigManager configManager;
@Inject
private PluginManager pluginManager;
@Inject
private ScheduledExecutorService executorService;
@Inject
private RuneLiteConfig runeLiteConfig;
private ConfigPanel configPanel;
private NavigationButton navButton;
@Override
protected void startUp() throws Exception
{
configPanel = new ConfigPanel(configManager);
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig);
navButton = new NavigationButton(
"Configuration",

View File

@@ -37,7 +37,7 @@ import net.runelite.client.ui.NavigationButton;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Developer tools plugin",
name = "Developer tools",
developerPlugin = true
)
public class DevToolsPlugin extends Plugin

View File

@@ -1,47 +0,0 @@
/*
* Copyright (c) 2018, oplosthee <https://github.com/oplosthee>
* 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.diaryprogress;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "diaryprogress",
name = "Diary Progress",
description = "Configuration for the plugin for enabling and disabling diary progress indicators"
)
public interface DiaryProgressConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not to display diary progress indicators"
)
default boolean enabled()
{
return false;
}
}

View File

@@ -26,18 +26,17 @@ package net.runelite.client.plugins.diaryprogress;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Inject;
import com.google.inject.Provides;
import net.runelite.api.Client;
import net.runelite.api.Varbits;
import net.runelite.api.events.GameTick;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(
name = "Diary Progress plugin"
name = "Diary Progress",
enabledByDefault = false
)
public class DiaryProgressPlugin extends Plugin
{
@@ -47,13 +46,21 @@ public class DiaryProgressPlugin extends Plugin
@Inject
private Client client;
@Inject
private DiaryProgressConfig config;
@Provides
DiaryProgressConfig provideConfig(ConfigManager configManager)
@Override
protected void shutDown() throws Exception
{
return configManager.getConfig(DiaryProgressConfig.class);
Widget diaryWidget = client.getWidget(WidgetInfo.DIARY_LIST);
if (diaryWidget == null)
{
return;
}
for (DiaryEntry entry : DiaryEntry.values())
{
Widget child = diaryWidget.getChild(entry.getIndex());
child.setText(entry.getName());
}
}
@Subscribe
@@ -71,28 +78,20 @@ public class DiaryProgressPlugin extends Plugin
Widget child = diaryWidget.getChild(entry.getIndex());
StringBuilder progress = new StringBuilder();
if (config.enabled())
for (Varbits varbits : entry.getVarbits())
{
for (Varbits varbits : entry.getVarbits())
int value = client.getSetting(varbits);
if ((entry != DiaryEntry.KARAMJA && value == 1) || value == 2)
{
int value = client.getSetting(varbits);
if ((entry != DiaryEntry.KARAMJA && value == 1) || value == 2)
{
progress.append(STAGE_FINISHED_STRING);
}
else
{
progress.append(STAGE_UNFINISHED_STRING);
}
progress.append(STAGE_FINISHED_STRING);
}
else
{
progress.append(STAGE_UNFINISHED_STRING);
}
progress.append("</col> ").append(entry.getName());
}
else
{
progress.append(entry.getName());
}
progress.append("</col> ").append(entry.getName());
child.setText(progress.toString());
}
}

View File

@@ -35,16 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface DiscordConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not Discord plugin is enabled"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "actionTimeout",
name = "Action timeout (minutes)",

View File

@@ -42,7 +42,7 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule;
@PluginDescriptor(
name = "Discord plugin"
name = "Discord"
)
public class DiscordPlugin extends Plugin
{
@@ -65,14 +65,22 @@ public class DiscordPlugin extends Plugin
return configManager.getConfig(DiscordConfig.class);
}
@Override
protected void startUp() throws Exception
{
updateGameStatus(client.getGameState(), true);
}
@Override
protected void shutDown() throws Exception
{
discordService.clearPresence();
discordState.reset();
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
if (!config.enabled())
{
return;
}
updateGameStatus(event.getGameState(), false);
}
@@ -87,11 +95,6 @@ public class DiscordPlugin extends Plugin
return;
}
if (!config.enabled())
{
return;
}
final DiscordGameEventType discordGameEventType = DiscordGameEventType.fromSkill(event.getSkill());
if (discordGameEventType != null)
@@ -106,11 +109,6 @@ public class DiscordPlugin extends Plugin
)
public void checkForValidStatus()
{
if (!config.enabled())
{
return;
}
if (discordState.checkForTimeout(config.actionTimeout()))
{
updateGameStatus(client.getGameState(), true);
@@ -123,11 +121,6 @@ public class DiscordPlugin extends Plugin
)
public void flushDiscordStatus()
{
if (!config.enabled())
{
return;
}
discordState.flushEvent(discordService);
}

View File

@@ -41,6 +41,16 @@ public class DiscordState
private DiscordPresence lastPresence;
private boolean needsFlush;
void reset()
{
lastQueue.clear();
lastEvent = null;
startOfAction = null;
lastAction = null;
lastPresence = null;
needsFlush = false;
}
void flushEvent(DiscordService discordService)
{
if (lastPresence != null && needsFlush)

View File

@@ -36,17 +36,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface ExamineConfig extends Config
{
@ConfigItem(
position = 1,
keyName = "itemPrice",
name = "Show item price on examine",
description = "Configures whether the item price is shown when examining item"
)
default boolean itemPrice()
{
return true;
}
@ConfigItem(
position = 2,
keyName = "hexColorExamine",

View File

@@ -24,6 +24,8 @@
*/
package net.runelite.client.plugins.examine;
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.eventbus.Subscribe;
@@ -39,6 +41,10 @@ import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.ItemComposition;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
@@ -47,17 +53,11 @@ import net.runelite.client.chat.ChatColorType;
import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.http.api.examine.ExamineClient;
import net.runelite.http.api.item.ItemPrice;
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
/**
* Submits exammine info to the api
@@ -65,7 +65,7 @@ import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
* @author Adam
*/
@PluginDescriptor(
name = "Examine plugin"
name = "Examine"
)
@Slf4j
public class ExaminePlugin extends Plugin
@@ -93,6 +93,13 @@ public class ExaminePlugin extends Plugin
@Inject
private ScheduledExecutorService executor;
@Override
protected void startUp()
{
cacheConfiguredColors();
chatMessageManager.refreshAll();
}
@Provides
ExamineConfig provideConfig(ConfigManager configManager)
{
@@ -208,11 +215,7 @@ public class ExaminePlugin extends Plugin
log.debug("Got examine for {} {}: {}", pendingExamine.getType(), pendingExamine.getId(), event.getMessage());
if (config.itemPrice())
{
findExamineItem(pendingExamine);
}
findExamineItem(pendingExamine);
CacheKey key = new CacheKey(type, pendingExamine.getId());
Boolean cached = cache.getIfPresent(key);
if (cached != null)

View File

@@ -36,16 +36,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface ExperienceDropConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not plugin is enabled."
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "meleePrayerColor",
name = "Melee Prayer Color",

View File

@@ -38,7 +38,7 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(
name = "Experience drop plugin"
name = "Experience drop"
)
public class ExperienceDropPlugin extends Plugin
{
@@ -67,7 +67,7 @@ public class ExperienceDropPlugin extends Plugin
}
PrayerType prayer = getActivePrayerType();
if (!config.enabled() || widget.isHidden())
if (widget.isHidden())
{
return;
}

View File

@@ -1,47 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.fightcave;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "fightcave",
name = "Fight Cave",
description = "Configuration for the fight cave plugin"
)
public interface FightCaveConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not fight cave overlay is displayed"
)
default boolean enabled()
{
return true;
}
}

View File

@@ -25,7 +25,6 @@
package net.runelite.client.plugins.fightcave;
import com.google.inject.Binder;
import com.google.inject.Provides;
import java.time.temporal.ChronoUnit;
import javax.inject.Inject;
import net.runelite.api.Client;
@@ -33,7 +32,6 @@ 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.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule;
@@ -41,7 +39,7 @@ import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.util.QueryRunner;
@PluginDescriptor(
name = "Fight cave plugin"
name = "Fight cave"
)
public class FightCavePlugin extends Plugin
{
@@ -51,9 +49,6 @@ public class FightCavePlugin extends Plugin
@Inject
private QueryRunner queryRunner;
@Inject
private FightCaveConfig config;
@Inject
private FightCaveOverlay overlay;
@@ -65,12 +60,6 @@ public class FightCavePlugin extends Plugin
binder.bind(FightCaveOverlay.class);
}
@Provides
FightCaveConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(FightCaveConfig.class);
}
@Override
public Overlay getOverlay()
{
@@ -83,7 +72,7 @@ public class FightCavePlugin extends Plugin
)
public void update()
{
if (!config.enabled() || client.getGameState() != GameState.LOGGED_IN)
if (client.getGameState() != GameState.LOGGED_IN)
{
return;
}

View File

@@ -35,16 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface FishingConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable",
description = "Configures whether or not the fishing plugin is displayed"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "showIcons",
name = "Display Fish icons",

View File

@@ -58,11 +58,6 @@ class FishingOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
FishingSession session = plugin.getSession();
if (session.getLastFishCaught() == null)

View File

@@ -53,7 +53,7 @@ import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.util.QueryRunner;
@PluginDescriptor(
name = "Fishing plugin"
name = "Fishing"
)
@Singleton
public class FishingPlugin extends Plugin

View File

@@ -38,25 +38,18 @@ import net.runelite.client.ui.overlay.OverlayUtil;
class FishingSpotMinimapOverlay extends Overlay
{
private final FishingPlugin plugin;
private final FishingConfig config;
@Inject
public FishingSpotMinimapOverlay(FishingPlugin plugin, FishingConfig config)
public FishingSpotMinimapOverlay(FishingPlugin plugin)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_WIDGETS);
this.plugin = plugin;
this.config = config;
}
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
NPC[] fishingSpots = plugin.getFishingSpots();
if (fishingSpots == null)
{

View File

@@ -57,11 +57,6 @@ class FishingSpotOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
NPC[] fishingSpots = plugin.getFishingSpots();
if (fishingSpots == null)
{

View File

@@ -38,16 +38,6 @@ import java.awt.Color;
)
public interface GroundItemsConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not item names/quantities are displayed"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "showGEPrice",
name = "Show Grand Exchange Prices",

View File

@@ -99,11 +99,6 @@ public class GroundItemsOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, java.awt.Point parent)
{
if (!config.enabled())
{
return null;
}
// gets the hidden/highlighted items from the text box in the config
String configItems = config.getHiddenItems().toLowerCase();
List<String> hiddenItems = Arrays.asList(configItems.split(DELIMITER_REGEX));

View File

@@ -33,7 +33,7 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Ground items plugin"
name = "Ground items"
)
public class GroundItemsPlugin extends Plugin
{

View File

@@ -38,7 +38,7 @@ import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.NavigationButton;
@PluginDescriptor(
name = "Hiscore plugin",
name = "Hiscore",
loadWhenOutdated = true
)
public class HiscorePlugin extends Plugin

View File

@@ -60,16 +60,14 @@ public class CatchrateOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (config.enabled())
if (Duration.between(plugin.getLastActionTime(), Instant.now()).compareTo(catchRatePanelTimeOut) < 0)
{
if (Duration.between(plugin.getLastActionTime(), Instant.now()).compareTo(catchRatePanelTimeOut) < 0)
{
final String attackStyleString = String.format("%.2f", plugin.getCatchRate() * 100) + " %";
catchRatePanel.setTitle(attackStyleString);
catchRatePanel.setWidth(80);
return catchRatePanel.render(graphics, parent);
}
final String attackStyleString = String.format("%.2f", plugin.getCatchRate() * 100) + " %";
catchRatePanel.setTitle(attackStyleString);
catchRatePanel.setWidth(80);
return catchRatePanel.render(graphics, parent);
}
return null;
}

View File

@@ -31,22 +31,11 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "hunterplugin",
name = "Hunter plugin",
name = "Hunter",
description = "Configuration for the hunter plugin"
)
public interface HunterConfig extends Config
{
@ConfigItem(
position = 0,
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not the hunter plugin is enabled"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
position = 1,
keyName = "hexColorOpenTrap",

View File

@@ -45,12 +45,12 @@ import net.runelite.api.GameState;
import net.runelite.api.ObjectID;
import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.api.queries.GameObjectQuery;
import net.runelite.api.queries.PlayerQuery;
import net.runelite.client.config.ConfigManager;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.queries.GameObjectQuery;
import net.runelite.api.queries.PlayerQuery;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule;
@@ -59,7 +59,7 @@ import net.runelite.client.util.QueryRunner;
@Slf4j
@PluginDescriptor(
name = "Hunter plugin"
name = "Hunter"
)
public class HunterPlugin extends Plugin
{
@@ -69,9 +69,6 @@ public class HunterPlugin extends Plugin
@Inject
private QueryRunner queryRunner;
@Inject
private HunterConfig config;
@Inject
private TrapOverlay trapOverlay;
@@ -106,14 +103,18 @@ public class HunterPlugin extends Plugin
return Arrays.asList(trapOverlay, catchrateOverlay);
}
@Override
protected void shutDown() throws Exception
{
catchAtempts = 0;
catchSuccess = 0;
lastActionTime = Instant.ofEpochMilli(0);
traps.clear();
}
@Subscribe
public void onGameObjectSpawned(GameObjectSpawned event)
{
if (!config.enabled())
{
return;
}
GameObject gameObject = event.getGameObject();
HunterTrap myTrap = getTrapFromCollection(gameObject);
@@ -199,7 +200,7 @@ public class HunterPlugin extends Plugin
lastActionTime = Instant.now();
}
break;
//Black chin shaking box
//Black chin shaking box
case ObjectID.BOX_TRAP:
case ObjectID.BOX_TRAP_2026:
case ObjectID.BOX_TRAP_2028:
@@ -279,11 +280,6 @@ public class HunterPlugin extends Plugin
)
public void updateTraps()
{
if (!config.enabled())
{
return;
}
//Check if all traps are still there, and remove the ones that are not.
//TODO: use despawn events
Iterator<HunterTrap> it = traps.iterator();

View File

@@ -81,10 +81,7 @@ public class TrapOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (config.enabled())
{
drawTraps(graphics);
}
drawTraps(graphics);
return null;
}

View File

@@ -35,17 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface IdleNotifierConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Toggles idle notifications",
position = 1
)
default boolean isEnabled()
{
return false;
}
@ConfigItem(
keyName = "tray",
name = "Send Tray Notification",

View File

@@ -110,7 +110,7 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.ClientUI;
@PluginDescriptor(
name = "Idle notifier plugin"
name = "Idle notifier"
)
public class IdleNotifierPlugin extends Plugin
{
@@ -152,7 +152,7 @@ public class IdleNotifierPlugin extends Plugin
@Subscribe
public void onAnimationChanged(AnimationChanged event)
{
if (!config.isEnabled() || client.getGameState() != GameState.LOGGED_IN)
if (client.getGameState() != GameState.LOGGED_IN)
{
return;
}
@@ -276,7 +276,7 @@ public class IdleNotifierPlugin extends Plugin
final Player local = client.getLocalPlayer();
final Duration waitDuration = Duration.ofMillis(config.getTimeout());
if (!config.isEnabled() || client.getGameState() != GameState.LOGGED_IN || local == null)
if (client.getGameState() != GameState.LOGGED_IN || local == null)
{
return;
}
@@ -409,6 +409,11 @@ public class IdleNotifierPlugin extends Plugin
private boolean check6hrLogout()
{
if (sixHourWarningTime == null)
{
return false;
}
if (Instant.now().compareTo(sixHourWarningTime) >= 0)
{
if (notify6HourLogout)

View File

@@ -1,26 +1,26 @@
/*
* Copyright (c) 2017, Robin <robin.weymans@gmail.com>
* 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.
/*
* Copyright (c) 2017, Robin <robin.weymans@gmail.com>
* 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.implings;
@@ -40,18 +40,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface ImplingsConfig extends Config
{
@ConfigItem(
position = 0,
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not the impling plugin is enabled"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
position = 1,
keyName = "showbaby",

View File

@@ -39,7 +39,7 @@ import net.runelite.client.ui.overlay.Overlay;
* @author robin
*/
@PluginDescriptor(
name = "Implings plugin"
name = "Implings"
)
public class ImplingsPlugin extends Plugin
{

View File

@@ -33,7 +33,7 @@ import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.NavigationButton;
@PluginDescriptor(
name = "Info panel plugin",
name = "Info panel",
loadWhenOutdated = true
)
public class InfoPlugin extends Plugin

View File

@@ -1,47 +0,0 @@
/*
* 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.plugins.instancemap;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "instancemap",
name = "Instance Map",
description = "Displays a map of the current instance"
)
public interface InstanceMapConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Enables or disables the overlay"
)
default boolean enabled()
{
return true;
}
}

View File

@@ -24,6 +24,26 @@
*/
package net.runelite.client.plugins.instancemap;
import static net.runelite.client.plugins.instancemap.PixelMaps.ALL;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_LEFT_CORNER;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_LEFT_DOT;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_LEFT_TO_TOP_RIGHT;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_RIGHT_CORNER;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_RIGHT_DOT;
import static net.runelite.client.plugins.instancemap.PixelMaps.LEFT;
import static net.runelite.client.plugins.instancemap.PixelMaps.RIGHT;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_LEFT_CORNER;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_LEFT_DOT;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_LEFT_TO_BOTTOM_RIGHT;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_RIGHT_CORNER;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_RIGHT_DOT;
import static net.runelite.client.plugins.instancemap.WallOffset.BOTTOM_LEFT;
import static net.runelite.client.plugins.instancemap.WallOffset.BOTTOM_RIGHT;
import static net.runelite.client.plugins.instancemap.WallOffset.NONE;
import static net.runelite.client.plugins.instancemap.WallOffset.TOP_LEFT;
import static net.runelite.client.plugins.instancemap.WallOffset.TOP_RIGHT;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
@@ -45,26 +65,6 @@ import net.runelite.api.Tile;
import net.runelite.api.WallObject;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MapRegionChanged;
import static net.runelite.client.plugins.instancemap.PixelMaps.ALL;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_LEFT_CORNER;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_LEFT_DOT;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_LEFT_TO_TOP_RIGHT;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_RIGHT_CORNER;
import static net.runelite.client.plugins.instancemap.PixelMaps.BOTTOM_RIGHT_DOT;
import static net.runelite.client.plugins.instancemap.PixelMaps.LEFT;
import static net.runelite.client.plugins.instancemap.PixelMaps.RIGHT;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_LEFT_CORNER;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_LEFT_DOT;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_LEFT_TO_BOTTOM_RIGHT;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_RIGHT_CORNER;
import static net.runelite.client.plugins.instancemap.PixelMaps.TOP_RIGHT_DOT;
import static net.runelite.client.plugins.instancemap.WallOffset.BOTTOM_LEFT;
import static net.runelite.client.plugins.instancemap.WallOffset.BOTTOM_RIGHT;
import static net.runelite.client.plugins.instancemap.WallOffset.NONE;
import static net.runelite.client.plugins.instancemap.WallOffset.TOP_LEFT;
import static net.runelite.client.plugins.instancemap.WallOffset.TOP_RIGHT;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -101,8 +101,6 @@ class InstanceMapOverlay extends Overlay
private int viewedPlane = 0;
private final Client client;
private final InstanceMapConfig config;
private final InstanceMapPlugin plugin;
/**
* Saved image of the region, no reason to draw the whole thing every
@@ -112,13 +110,11 @@ class InstanceMapOverlay extends Overlay
private boolean showMap = false;
@Inject
InstanceMapOverlay(@Nullable Client client, InstanceMapConfig config, InstanceMapPlugin plugin)
InstanceMapOverlay(@Nullable Client client)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ALWAYS_ON_TOP);
this.client = client;
this.config = config;
this.plugin = plugin;
}
public boolean isMapShown()
@@ -173,7 +169,7 @@ class InstanceMapOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, java.awt.Point parent)
{
if (!config.enabled() || !showMap)
if (!showMap)
{
return null;
}

View File

@@ -24,17 +24,14 @@
*/
package net.runelite.client.plugins.instancemap;
import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Binder;
import com.google.inject.Provides;
import javax.inject.Inject;
import net.runelite.api.widgets.WidgetInfo;
import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP;
import net.runelite.client.config.ConfigManager;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MapRegionChanged;
import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption;
import net.runelite.client.plugins.Plugin;
@@ -50,9 +47,6 @@ public class InstanceMapPlugin extends Plugin
private final WidgetMenuOption ascendOption = new WidgetMenuOption("Ascend", "Instance Map", WidgetInfo.WORLD_MAP);
private final WidgetMenuOption descendOption = new WidgetMenuOption("Descend", "Instance Map", WidgetInfo.WORLD_MAP);
@Inject
private InstanceMapConfig config;
@Inject
private InstanceMapOverlay overlay;
@@ -65,12 +59,6 @@ public class InstanceMapPlugin extends Plugin
binder.bind(InstanceMapOverlay.class);
}
@Provides
InstanceMapConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(InstanceMapConfig.class);
}
private void addCustomOptions()
{
menuManager.addManagedCustomMenu(openMapOption);
@@ -88,10 +76,7 @@ public class InstanceMapPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
if (config.enabled())
{
addCustomOptions();
}
addCustomOptions();
}
@Override
@@ -100,19 +85,6 @@ public class InstanceMapPlugin extends Plugin
removeCustomOptions();
}
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
if (config.enabled())
{
addCustomOptions();
}
else
{
removeCustomOptions();
}
}
@Subscribe
public void regionChange(MapRegionChanged event)
{
@@ -133,7 +105,7 @@ public class InstanceMapPlugin extends Plugin
@Subscribe
public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
if (!config.enabled() || event.getWidget() != WORLD_MAP)
if (event.getWidget() != WORLD_MAP)
{
return;
}

View File

@@ -34,7 +34,7 @@ import net.runelite.client.plugins.itemstats.stats.Stats;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Item stat plugin"
name = "Item stat"
)
public class ItemStatPlugin extends Plugin
{

View File

@@ -1,47 +0,0 @@
/*
* Copyright (c) 2017, Seth <Sethtroll3@gmail.com>
* 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.jewellerycount;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "jewellerycount",
name = "Jewellery Count",
description = "Configuration for the jewellery count plugin"
)
public interface JewelleryCountConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable",
description = "Configures whether or not the jewellery count plugin is displayed"
)
default boolean enabled()
{
return true;
}
}

View File

@@ -47,25 +47,18 @@ import net.runelite.client.util.QueryRunner;
class JewelleryCountOverlay extends Overlay
{
private final QueryRunner queryRunner;
private final JewelleryCountConfig config;
@Inject
JewelleryCountOverlay(QueryRunner queryRunner, JewelleryCountConfig config)
JewelleryCountOverlay(QueryRunner queryRunner)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_WIDGETS);
this.queryRunner = queryRunner;
this.config = config;
}
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
graphics.setFont(FontManager.getRunescapeSmallFont());
for (WidgetItem item : getJewelleryWidgetItems())

View File

@@ -25,21 +25,16 @@
package net.runelite.client.plugins.jewellerycount;
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;
@PluginDescriptor(
name = "Jewellery count plugin"
name = "Jewellery count"
)
public class JewelleryCountPlugin extends Plugin
{
@Inject
private JewelleryCountConfig config;
@Inject
private JewelleryCountOverlay overlay;
@@ -49,12 +44,6 @@ public class JewelleryCountPlugin extends Plugin
binder.bind(JewelleryCountOverlay.class);
}
@Provides
JewelleryCountConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(JewelleryCountConfig.class);
}
@Override
public Overlay getOverlay()
{

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* 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.lowmemory;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "lowmemory",
name = "Low Memory Mode",
description = "Configuration for the plugin for enabling and disabling RuneScape low memory mode"
)
public interface LowMemoryConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not low memory mode is enabled",
confirmationWarining = "Please re-log into RuneScape for this change to fully take effect.",
warnOnEnable = true,
warnOnDisable = true
)
default boolean enabled()
{
return false;
}
}

View File

@@ -25,37 +25,26 @@
package net.runelite.client.plugins.lowmemory;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Provides;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.SessionClose;
import net.runelite.api.events.SessionOpen;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(name = "Low memory plugin")
@PluginDescriptor(
name = "Low memory",
enabledByDefault = false
)
public class LowMemoryPlugin extends Plugin
{
@Inject
private Client client;
@Inject
private LowMemoryConfig config;
@Provides
LowMemoryConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(LowMemoryConfig.class);
}
@Override
protected void startUp() throws Exception
{
client.changeMemoryMode(config.enabled());
client.changeMemoryMode(true);
}
@Override
@@ -64,33 +53,12 @@ public class LowMemoryPlugin extends Plugin
client.changeMemoryMode(false);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("lowmemory"))
{
client.changeMemoryMode(config.enabled());
}
}
@Subscribe
private void onSessionOpen(SessionOpen event)
{
client.changeMemoryMode(config.enabled());
}
@Subscribe
private void onSessionClose(SessionClose event)
{
client.changeMemoryMode(config.enabled());
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOGIN_SCREEN)
{
client.changeMemoryMode(config.enabled());
client.changeMemoryMode(true);
}
}
}
}

View File

@@ -36,7 +36,8 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(
name = "Metronome plugin"
name = "Metronome",
enabledByDefault = false
)
public class MetronomePlugin extends Plugin
{
@@ -58,7 +59,7 @@ public class MetronomePlugin extends Plugin
@Subscribe
void onTick(GameTick tick)
{
if (!config.enabled() || config.tickCount() == 0)
if (config.tickCount() == 0)
{
return;
}

View File

@@ -36,17 +36,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface MetronomePluginConfiguration extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable metronome",
description = "Toggles tick metronome",
position = 1
)
default boolean enabled()
{
return false;
}
@ConfigItem(
keyName = "tickCount",
name = "Tick count",

View File

@@ -35,16 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface MotherlodeConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable",
description = "Configures whether or not the motherlode plugin is displayed"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "showRocks",
name = "Show Pay-dirt mining spots",

View File

@@ -74,11 +74,6 @@ class MotherlodeOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
MotherlodeSession session = plugin.getSession();
if (session.getLastPayDirtMined() == null)

View File

@@ -64,7 +64,8 @@ import net.runelite.client.task.Schedule;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Motherlode plugin"
name = "Motherlode",
enabledByDefault = false
)
public class MotherlodePlugin extends Plugin
{
@@ -108,6 +109,13 @@ public class MotherlodePlugin extends Plugin
return Arrays.asList(overlay, rocksOverlay, motherlodeSackOverlay);
}
@Override
protected void shutDown() throws Exception
{
veins.clear();
rocks.clear();
}
public MotherlodeSession getSession()
{
return session;

View File

@@ -69,7 +69,7 @@ class MotherlodeRocksOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, java.awt.Point parent)
{
if (!config.enabled() || !config.showRocks())
if (!config.showRocks())
{
return null;
}

View File

@@ -54,11 +54,6 @@ class MotherlodeSackOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
Widget sack = client.getWidget(WidgetInfo.MOTHERLODE_MINE);
panelComponent.getLines().clear();

View File

@@ -1,47 +0,0 @@
/*
* Copyright (c) 2017, Seth <Sethtroll3@gmail.com>
* 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.mousehighlight;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "mousehighlight",
name = "Mouse Highlighting",
description = "Configuration for the mouse Highlight plugin"
)
public interface MouseHighlightConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not mouse hover info is displayed"
)
default boolean enabled()
{
return true;
}
}

View File

@@ -38,27 +38,20 @@ import net.runelite.client.ui.overlay.tooltip.TooltipManager;
class MouseHighlightOverlay extends Overlay
{
private final MouseHighlightConfig config;
private final TooltipManager tooltipManager;
private final Client client;
@Inject
MouseHighlightOverlay(@Nullable Client client, MouseHighlightConfig config, TooltipManager tooltipManager)
MouseHighlightOverlay(@Nullable Client client, TooltipManager tooltipManager)
{
setPosition(OverlayPosition.DYNAMIC);
this.client = client;
this.config = config;
this.tooltipManager = tooltipManager;
}
@Override
public Dimension render(Graphics2D graphics, Point point)
{
if (!config.enabled())
{
return null;
}
if (client.isMenuOpen())
{
return null;

View File

@@ -25,21 +25,16 @@
package net.runelite.client.plugins.mousehighlight;
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;
@PluginDescriptor(
name = "Mouse highlight plugin"
name = "Mouse highlight"
)
public class MouseHighlightPlugin extends Plugin
{
@Inject
private MouseHighlightConfig config;
@Inject
private MouseHighlightOverlay overlay;
@@ -49,12 +44,6 @@ public class MouseHighlightPlugin extends Plugin
binder.bind(MouseHighlightOverlay.class);
}
@Provides
MouseHighlightConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(MouseHighlightConfig.class);
}
@Override
public Overlay getOverlay()
{

View File

@@ -35,17 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface NightmareZoneConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable plugin",
description = "Configures whether or not the plugin is enabled",
position = 1
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "tray",
name = "Send Tray Notification",

View File

@@ -72,7 +72,7 @@ class NightmareZoneOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled() || !plugin.isInNightmareZone() || !config.moveOverlay())
if (!plugin.isInNightmareZone() || !config.moveOverlay())
{
if (absorptionCounter != null)
{

View File

@@ -42,7 +42,7 @@ import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Nightmare Zone Plugin"
name = "Nightmare Zone"
)
public class NightmareZonePlugin extends Plugin
{
@@ -88,7 +88,7 @@ public class NightmareZonePlugin extends Plugin
@Subscribe
public void onGameTick(GameTick event)
{
if (!config.enabled() || !isInNightmareZone())
if (!isInNightmareZone())
{
return;
}
@@ -101,8 +101,7 @@ public class NightmareZonePlugin extends Plugin
@Subscribe
public void onChatMessage(ChatMessage event)
{
if (!config.enabled()
|| event.getType() != ChatMessageType.SERVER
if (event.getType() != ChatMessageType.SERVER
|| !isInNightmareZone()
|| !config.overloadNotification())
{

View File

@@ -1,47 +0,0 @@
/*
* 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.plugins.opponentinfo;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "oppinfo",
name = "Opponent Info",
description = "Configuration for the opponent info plugin"
)
public interface OpponentConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not opponent info is displayed"
)
default boolean enabled()
{
return true;
}
}

View File

@@ -60,7 +60,6 @@ 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");
private float lastRatio = 0;
@@ -69,12 +68,11 @@ class OpponentInfoOverlay extends Overlay
private Map<String, Integer> oppInfoHealth = OpponentInfoPlugin.loadNpcHealth();
@Inject
OpponentInfoOverlay(@Nullable Client client, OpponentConfig config)
OpponentInfoOverlay(@Nullable Client client)
{
setPosition(OverlayPosition.TOP_LEFT);
setPriority(OverlayPriority.HIGH);
this.client = client;
this.config = config;
}
private Actor getOpponent()
@@ -91,11 +89,6 @@ class OpponentInfoOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled())
{
return null;
}
Actor opponent = getOpponent();
if (opponent != null && opponent.getHealth() > 0)

View File

@@ -27,19 +27,17 @@ 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 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;
@PluginDescriptor(
name = "Opponent information plugin"
name = "Opponent information"
)
public class OpponentInfoPlugin extends Plugin
{
@@ -52,12 +50,6 @@ public class OpponentInfoPlugin extends Plugin
binder.bind(OpponentInfoOverlay.class);
}
@Provides
OpponentConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(OpponentConfig.class);
}
@Override
public Overlay getOverlay()
{

View File

@@ -33,7 +33,7 @@ import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Pest control plugin"
name = "Pest control"
)
public class PestControlPlugin extends Plugin
{

View File

@@ -33,7 +33,7 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Player names plugin"
name = "Player names"
)
public class PlayerIndicatorsPlugin extends Plugin
{

View File

@@ -60,7 +60,7 @@ public class BurnerOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, java.awt.Point parent)
{
if (!config.enabled() || !config.showBurner())
if (!config.showBurner())
{
return null;
}

View File

@@ -35,16 +35,6 @@ import net.runelite.client.config.ConfigItem;
)
public interface PohConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not the POH plugin is displayed"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "showVarrock",
name = "Show Varrock portal",

Some files were not shown because too many files have changed in this diff Show More