runelite-client: add boosts config
This commit is contained in:
@@ -25,12 +25,14 @@
|
||||
|
||||
package net.runelite.client.plugins.boosts;
|
||||
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
|
||||
public class Boosts extends Plugin
|
||||
{
|
||||
private final Overlay overlay = new BoostsOverlay();
|
||||
private final BoostsConfig config = RuneLite.getRunelite().getConfigManager().getConfig(BoostsConfig.class);
|
||||
private final Overlay overlay = new BoostsOverlay(this);
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
@@ -47,4 +49,9 @@ public class Boosts extends Plugin
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public BoostsConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.boosts;
|
||||
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup(
|
||||
keyName = "boosts",
|
||||
name = "Boosts Info",
|
||||
description = "Configuration for the Boosts plugin"
|
||||
)
|
||||
public interface BoostsConfig
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
name = "Enabled",
|
||||
description = "Configures whether or not boost info is displayed"
|
||||
)
|
||||
default boolean enabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -50,10 +50,13 @@ class BoostsOverlay extends Overlay
|
||||
private static final int RIGHT_BORDER = 2;
|
||||
|
||||
private static final int SEPARATOR = 2;
|
||||
|
||||
BoostsOverlay()
|
||||
|
||||
private final BoostsConfig config;
|
||||
|
||||
BoostsOverlay(Boosts plugin)
|
||||
{
|
||||
super(OverlayPosition.TOP_LEFT, OverlayPriority.MED);
|
||||
this.config = plugin.getConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +64,7 @@ class BoostsOverlay extends Overlay
|
||||
{
|
||||
Client client = RuneLite.getClient();
|
||||
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !config.enabled())
|
||||
return null;
|
||||
|
||||
FontMetrics metrics = graphics.getFontMetrics();
|
||||
|
||||
Reference in New Issue
Block a user