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:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user