Updates based on Reviewer Suggestions

- COMBAT_TIMEOUT renamed to combatTimeout since it's not a constant
- Created hideStatusBar() method for code cleanliness
- Renamed Config option to remove capitalization on some words
This commit is contained in:
ErmalSh
2019-01-19 14:53:25 -05:00
parent 2d394a24a3
commit bca45c5d4c
2 changed files with 23 additions and 18 deletions

View File

@@ -67,7 +67,7 @@ public interface StatusBarsConfig extends Config
@ConfigItem(
position = 4,
keyName = "toggleRestorationBars",
name = "Toggle to Hide when not in Combat",
name = "Toggle to hide when not in combat",
description = "Visually hides the Status Bars when player is out of combat."
)
default boolean toggleRestorationBars()

View File

@@ -87,10 +87,16 @@ public class StatusBarsPlugin extends Plugin
return;
}
else
{
hideStatusBar();
}
}
private void hideStatusBar()
{
final Actor interacting = client.getLocalPlayer().getInteracting();
final boolean isNpc = interacting instanceof NPC;
final int COMBAT_TIMEOUT = config.hideStatusBarDelay();
final int combatTimeout = config.hideStatusBarDelay();
if (isNpc)
{
@@ -105,13 +111,12 @@ public class StatusBarsPlugin extends Plugin
}
else if (lastCombatAction != null)
{
if (Duration.between(getLastCombatAction(), Instant.now()).getSeconds() > COMBAT_TIMEOUT)
if (Duration.between(getLastCombatAction(), Instant.now()).getSeconds() > combatTimeout)
{
overlayManager.remove(overlay);
}
}
}
}
@Override
protected void shutDown() throws Exception