-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathVisualTicksPlugin.java
More file actions
71 lines (62 loc) · 1.54 KB
/
VisualTicksPlugin.java
File metadata and controls
71 lines (62 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.visualticks;
import com.google.inject.Provides;
import javax.inject.Inject;
import com.visualticks.utils.ResetUtils;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.StatChanged;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@Slf4j
@PluginDescriptor(
name = "Visual Ticks"
)
public class VisualTicksPlugin extends Plugin
{
@Inject
private VisualTicksConfig config;
@Inject
private OverlayManager overlayManager;
@Inject
private VisualTicksOverlay overlay;
public int tick = 0;
private boolean isReset = false;
@Override
protected void startUp() throws Exception
{
overlayManager.add(overlay);
}
@Override
protected void shutDown() throws Exception
{
overlayManager.remove(overlay);
}
@Subscribe
public void onStatChanged(StatChanged statChanged)
{
if (statChanged.getSkill() == config.getResetSkill())
{
if (config.isResetCounter()) {
isReset = true;
}
}
}
@Subscribe
private void onGameTick(GameTick gameTick) {
if (isReset) {
tick = ResetUtils.calculateOffset(config.getOffset(), config.numberOfTicks());
isReset = false;
} else {
tick++;
}
if(tick > config.numberOfTicks() - 1) tick = 0;
}
@Provides
VisualTicksConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(VisualTicksConfig.class);
}
}