clanmanmode: Save config values
This commit is contained in:
@@ -16,12 +16,12 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
|||||||
public class ClanManModeMinimapOverlay extends Overlay
|
public class ClanManModeMinimapOverlay extends Overlay
|
||||||
{
|
{
|
||||||
private final ClanManModeService ClanManModeService;
|
private final ClanManModeService ClanManModeService;
|
||||||
private final ClanManModeConfig config;
|
private final ClanManModePlugin plugin;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ClanManModeMinimapOverlay(final ClanManModeConfig config, final ClanManModeService ClanManModeService)
|
private ClanManModeMinimapOverlay(final ClanManModePlugin plugin, final ClanManModeService ClanManModeService)
|
||||||
{
|
{
|
||||||
this.config = config;
|
this.plugin = plugin;
|
||||||
this.ClanManModeService = ClanManModeService;
|
this.ClanManModeService = ClanManModeService;
|
||||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
@@ -39,7 +39,7 @@ public class ClanManModeMinimapOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
final String name = actor.getName().replace('\u00A0', ' ');
|
final String name = actor.getName().replace('\u00A0', ' ');
|
||||||
|
|
||||||
if (config.drawMinimapNames())
|
if (plugin.isDrawMinimapNames())
|
||||||
{
|
{
|
||||||
final net.runelite.api.Point minimapLocation = actor.getMinimapLocation();
|
final net.runelite.api.Point minimapLocation = actor.getMinimapLocation();
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
|||||||
public class ClanManModeOverlay extends Overlay
|
public class ClanManModeOverlay extends Overlay
|
||||||
{
|
{
|
||||||
private final ClanManModeService ClanManModeService;
|
private final ClanManModeService ClanManModeService;
|
||||||
private final ClanManModeConfig config;
|
private final ClanManModePlugin plugin;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ClanManModeOverlay(final ClanManModeConfig config, final ClanManModeService ClanManModeService)
|
private ClanManModeOverlay(final ClanManModePlugin plugin, final ClanManModeService ClanManModeService)
|
||||||
{
|
{
|
||||||
this.config = config;
|
this.plugin = plugin;
|
||||||
this.ClanManModeService = ClanManModeService;
|
this.ClanManModeService = ClanManModeService;
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
setPriority(OverlayPriority.MED);
|
setPriority(OverlayPriority.MED);
|
||||||
@@ -37,7 +37,7 @@ public class ClanManModeOverlay extends Overlay
|
|||||||
|
|
||||||
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color)
|
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color)
|
||||||
{
|
{
|
||||||
if (!config.drawOverheadPlayerNames())
|
if (!plugin.isDrawOverheadPlayerNames())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ public class ClanManModeOverlay extends Overlay
|
|||||||
|
|
||||||
if (textLocation != null)
|
if (textLocation != null)
|
||||||
{
|
{
|
||||||
if (config.getClanAttackableColor().equals(color) && config.ShowBold())
|
if (plugin.getGetClanAttackableColor().equals(color) && plugin.isShowBold())
|
||||||
{
|
{
|
||||||
graphics.setFont(FontManager.getRunescapeBoldFont());
|
graphics.setFont(FontManager.getRunescapeBoldFont());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package net.runelite.client.plugins.clanmanmode;
|
package net.runelite.client.plugins.clanmanmode;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import java.awt.Color;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
@@ -49,6 +52,37 @@ public class ClanManModePlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean highlightAttackable;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private Color getAttackableColor;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean highlightAttacked;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private Color getClanAttackableColor;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean drawTiles;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean drawOverheadPlayerNames;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean drawMinimapNames;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean showAttackers;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private Color getAttackerColor;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean ShowBold;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean hideAttackable;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private int hideTime;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean CalcSelfCB;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean PersistentClan;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private Color getClanMemberColor;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
ClanManModeConfig provideConfig(ConfigManager configManager)
|
ClanManModeConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
@@ -65,6 +99,8 @@ public class ClanManModePlugin extends Plugin
|
|||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
|
updateConfig();
|
||||||
|
|
||||||
overlayManager.add(ClanManModeOverlay);
|
overlayManager.add(ClanManModeOverlay);
|
||||||
overlayManager.add(ClanManModeTileOverlay);
|
overlayManager.add(ClanManModeTileOverlay);
|
||||||
overlayManager.add(ClanManModeMinimapOverlay);
|
overlayManager.add(ClanManModeMinimapOverlay);
|
||||||
@@ -91,6 +127,8 @@ public class ClanManModePlugin extends Plugin
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -122,4 +160,23 @@ public class ClanManModePlugin extends Plugin
|
|||||||
clanmax = Collections.max(clan.values());
|
clanmax = Collections.max(clan.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateConfig()
|
||||||
|
{
|
||||||
|
this.highlightAttackable = config.highlightAttackable();
|
||||||
|
this.getAttackableColor = config.getAttackableColor();
|
||||||
|
this.highlightAttacked = config.highlightAttacked();
|
||||||
|
this.getClanAttackableColor = config.getClanAttackableColor();
|
||||||
|
this.drawTiles = config.drawTiles();
|
||||||
|
this.drawOverheadPlayerNames = config.drawOverheadPlayerNames();
|
||||||
|
this.drawMinimapNames = config.drawMinimapNames();
|
||||||
|
this.showAttackers = config.showAttackers();
|
||||||
|
this.getAttackerColor = config.getAttackerColor();
|
||||||
|
this.ShowBold = config.ShowBold();
|
||||||
|
this.hideAttackable = config.hideAttackable();
|
||||||
|
this.hideTime = config.hideTime();
|
||||||
|
this.CalcSelfCB = config.CalcSelfCB();
|
||||||
|
this.PersistentClan = config.PersistentClan();
|
||||||
|
this.getClanMemberColor = config.getClanMemberColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,11 @@ import net.runelite.api.coords.WorldPoint;
|
|||||||
public class ClanManModeService
|
public class ClanManModeService
|
||||||
{
|
{
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final ClanManModeConfig config;
|
|
||||||
private final ClanManModePlugin plugin;
|
private final ClanManModePlugin plugin;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ClanManModeService(final Client client, final ClanManModeConfig config, final ClanManModePlugin plugin)
|
private ClanManModeService(final Client client, final ClanManModePlugin plugin)
|
||||||
{
|
{
|
||||||
this.config = config;
|
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
@@ -57,13 +55,13 @@ public class ClanManModeService
|
|||||||
interactor = ((Player) interacting);
|
interactor = ((Player) interacting);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.showAttackers())
|
if (plugin.isShowAttackers())
|
||||||
{
|
{
|
||||||
if (interactor != null)
|
if (interactor != null)
|
||||||
{
|
{
|
||||||
if (interactor.getName().equals(localName))
|
if (interactor.getName().equals(localName))
|
||||||
{
|
{
|
||||||
consumer.accept(player, config.getAttackerColor());
|
consumer.accept(player, plugin.getGetAttackerColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +74,7 @@ public class ClanManModeService
|
|||||||
{
|
{
|
||||||
plugin.clan.put(player.getName(), player.getCombatLevel());
|
plugin.clan.put(player.getName(), player.getCombatLevel());
|
||||||
}
|
}
|
||||||
if (config.highlightAttacked())
|
if (plugin.isHighlightAttacked())
|
||||||
{
|
{
|
||||||
if (interactor != null)
|
if (interactor != null)
|
||||||
{
|
{
|
||||||
@@ -91,12 +89,12 @@ public class ClanManModeService
|
|||||||
{
|
{
|
||||||
wildydiff = 0;
|
wildydiff = 0;
|
||||||
}
|
}
|
||||||
if (config.CalcSelfCB())
|
if (plugin.isCalcSelfCB())
|
||||||
{
|
{
|
||||||
if (interacting.getCombatLevel() <= selfmax && interacting.getCombatLevel() - wildydiff >= selfmin && !interactor.isClanMember())
|
if (interacting.getCombatLevel() <= selfmax && interacting.getCombatLevel() - wildydiff >= selfmin && !interactor.isClanMember())
|
||||||
{
|
{
|
||||||
interactors.put(interactor.getName(), player.getName());
|
interactors.put(interactor.getName(), player.getName());
|
||||||
consumer.accept(interactor, config.getClanAttackableColor());
|
consumer.accept(interactor, plugin.getGetClanAttackableColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -104,7 +102,7 @@ public class ClanManModeService
|
|||||||
if (interacting.getCombatLevel() <= maxatk && interacting.getCombatLevel() - wildydiff >= minatk && !interactor.isClanMember())
|
if (interacting.getCombatLevel() <= maxatk && interacting.getCombatLevel() - wildydiff >= minatk && !interactor.isClanMember())
|
||||||
{
|
{
|
||||||
interactors.put(interactor.getName(), player.getName());
|
interactors.put(interactor.getName(), player.getName());
|
||||||
consumer.accept(interactor, config.getClanAttackableColor());
|
consumer.accept(interactor, plugin.getGetClanAttackableColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,14 +111,14 @@ public class ClanManModeService
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (config.PersistentClan())
|
if (plugin.isPersistentClan())
|
||||||
{
|
{
|
||||||
if (plugin.clan.containsKey(player.getName()))
|
if (plugin.clan.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
consumer.accept(player, config.getClanMemberColor());
|
consumer.accept(player, plugin.getGetClanMemberColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.highlightAttacked())
|
if (plugin.isHighlightAttacked())
|
||||||
{
|
{
|
||||||
if (interactors.containsKey(player.getName()))
|
if (interactors.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
@@ -140,7 +138,7 @@ public class ClanManModeService
|
|||||||
{
|
{
|
||||||
if (ainteract.getName().equals(player.getName()))
|
if (ainteract.getName().equals(player.getName()))
|
||||||
{
|
{
|
||||||
consumer.accept(player, config.getClanAttackableColor());
|
consumer.accept(player, plugin.getGetClanAttackableColor());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -161,9 +159,9 @@ public class ClanManModeService
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.highlightAttackable())
|
if (plugin.isHighlightAttackable())
|
||||||
{
|
{
|
||||||
if ((config.hideAttackable() && plugin.ticks >= config.hideTime()) || plugin.clan.containsKey(player.getName()))
|
if ((plugin.isHideAttackable() && plugin.ticks >= plugin.getHideTime()) || plugin.clan.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -176,18 +174,18 @@ public class ClanManModeService
|
|||||||
{
|
{
|
||||||
wildydiff = 0;
|
wildydiff = 0;
|
||||||
}
|
}
|
||||||
if (config.CalcSelfCB())
|
if (plugin.isCalcSelfCB())
|
||||||
{
|
{
|
||||||
if (player.getCombatLevel() <= selfmax && player.getCombatLevel() - wildydiff >= selfmin)
|
if (player.getCombatLevel() <= selfmax && player.getCombatLevel() - wildydiff >= selfmin)
|
||||||
{
|
{
|
||||||
consumer.accept(player, config.getAttackableColor());
|
consumer.accept(player, plugin.getGetAttackableColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.getCombatLevel() <= maxatk && player.getCombatLevel() - wildydiff >= minatk)
|
if (player.getCombatLevel() <= maxatk && player.getCombatLevel() - wildydiff >= minatk)
|
||||||
{
|
{
|
||||||
consumer.accept(player, config.getAttackableColor());
|
consumer.accept(player, plugin.getGetAttackableColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user