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(
|
@ConfigItem(
|
||||||
position = 4,
|
position = 4,
|
||||||
keyName = "toggleRestorationBars",
|
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."
|
description = "Visually hides the Status Bars when player is out of combat."
|
||||||
)
|
)
|
||||||
default boolean toggleRestorationBars()
|
default boolean toggleRestorationBars()
|
||||||
|
|||||||
@@ -87,10 +87,16 @@ public class StatusBarsPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
hideStatusBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideStatusBar()
|
||||||
{
|
{
|
||||||
final Actor interacting = client.getLocalPlayer().getInteracting();
|
final Actor interacting = client.getLocalPlayer().getInteracting();
|
||||||
final boolean isNpc = interacting instanceof NPC;
|
final boolean isNpc = interacting instanceof NPC;
|
||||||
final int COMBAT_TIMEOUT = config.hideStatusBarDelay();
|
final int combatTimeout = config.hideStatusBarDelay();
|
||||||
|
|
||||||
if (isNpc)
|
if (isNpc)
|
||||||
{
|
{
|
||||||
@@ -105,13 +111,12 @@ public class StatusBarsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
else if (lastCombatAction != null)
|
else if (lastCombatAction != null)
|
||||||
{
|
{
|
||||||
if (Duration.between(getLastCombatAction(), Instant.now()).getSeconds() > COMBAT_TIMEOUT)
|
if (Duration.between(getLastCombatAction(), Instant.now()).getSeconds() > combatTimeout)
|
||||||
{
|
{
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
|
|||||||
Reference in New Issue
Block a user