xpglobes: add duration of xp orbs in config

This commit is contained in:
Håkon Rosseland Paulsen
2018-04-23 17:26:31 +02:00
committed by Adam
parent 419905a766
commit 0e630d8f5b
2 changed files with 15 additions and 2 deletions

View File

@@ -112,4 +112,15 @@ public interface XpGlobesConfig extends Config
{ {
return OrbCentering.DYNAMIC; return OrbCentering.DYNAMIC;
} }
@ConfigItem(
keyName = "Orb duration",
name = "Duration of orbs",
description = "Change the duration the xp orbs are visible",
position = 7
)
default int xpOrbDuration()
{
return 10;
}
} }

View File

@@ -51,7 +51,6 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDependency(XpTrackerPlugin.class) @PluginDependency(XpTrackerPlugin.class)
public class XpGlobesPlugin extends Plugin public class XpGlobesPlugin extends Plugin
{ {
private static final int SECONDS_TO_SHOW_GLOBE = 10;
private static final int MAXIMUM_SHOWN_GLOBES = 5; private static final int MAXIMUM_SHOWN_GLOBES = 5;
private XpGlobe[] globeCache = new XpGlobe[Skill.values().length - 1]; //overall does not trigger xp change event private XpGlobe[] globeCache = new XpGlobe[Skill.values().length - 1]; //overall does not trigger xp change event
@@ -60,6 +59,9 @@ public class XpGlobesPlugin extends Plugin
@Inject @Inject
private Client client; private Client client;
@Inject
private XpGlobesConfig config;
@Inject @Inject
private XpGlobesOverlay overlay; private XpGlobesOverlay overlay;
@@ -148,7 +150,7 @@ public class XpGlobesPlugin extends Plugin
{ {
XpGlobe globe = it.next(); XpGlobe globe = it.next();
Instant globeCreationTime = globe.getTime(); Instant globeCreationTime = globe.getTime();
if (currentTime.isBefore(globeCreationTime.plusSeconds(SECONDS_TO_SHOW_GLOBE))) if (currentTime.isBefore(globeCreationTime.plusSeconds(config.xpOrbDuration())))
{ {
//if a globe is not expired, stop checking newer globes //if a globe is not expired, stop checking newer globes
return; return;