npc aggro timer: Add option to hide hint overlay (#46)

This commit is contained in:
James
2019-04-22 12:02:56 -07:00
committed by Tyler Bochard
parent b3a43ac9d7
commit 67d2f1390f
2 changed files with 25 additions and 2 deletions

View File

@@ -37,6 +37,7 @@ public interface NpcAggroAreaConfig extends Config
String CONFIG_CENTER2 = "center2";
String CONFIG_LOCATION = "location";
String CONFIG_DURATION = "duration";
String CONFIG_NOT_WORKING_OVERLAY = "overlay";
@ConfigItem(
keyName = "npcUnaggroAlwaysActive",
@@ -92,4 +93,15 @@ public interface NpcAggroAreaConfig extends Config
{
return Color.YELLOW;
}
@ConfigItem(
keyName = "npcUnaggroShowNotWorkingOverlay",
name = "Show not working hint",
description = "Show hint if plugin is enabled in unsupported area",
position = 6
)
default boolean showNotWorkingOverlay()
{
return true;
}
}

View File

@@ -128,6 +128,7 @@ public class NpcAggroAreaPlugin extends Plugin
private WorldPoint previousUnknownCenter;
private boolean loggingIn;
private List<String> npcNamePatterns;
private boolean notWorkingOverlayShown = false;
@Provides
NpcAggroAreaConfig provideConfig(ConfigManager configManager)
@@ -139,7 +140,12 @@ public class NpcAggroAreaPlugin extends Plugin
protected void startUp() throws Exception
{
overlayManager.add(overlay);
overlayManager.add(notWorkingOverlay);
if (config.showNotWorkingOverlay())
{
overlayManager.add(notWorkingOverlay);
notWorkingOverlayShown = true;
}
npcNamePatterns = NAME_SPLITTER.splitToList(config.npcNamePatterns());
recheckActive();
}
@@ -149,7 +155,11 @@ public class NpcAggroAreaPlugin extends Plugin
{
removeTimer();
overlayManager.remove(overlay);
overlayManager.remove(notWorkingOverlay);
if (notWorkingOverlayShown)
{
overlayManager.remove(notWorkingOverlay);
}
Arrays.fill(safeCenters, null);
lastPlayerLocation = null;
currentTimer = null;
@@ -406,6 +416,7 @@ public class NpcAggroAreaPlugin extends Plugin
configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER2);
configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION);
configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION);
configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_NOT_WORKING_OVERLAY);
}
private void saveConfig()