reportbutton: add Game Ticks option
This commit is contained in:
@@ -39,6 +39,7 @@ import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
@@ -62,6 +63,7 @@ public class ReportButtonPlugin extends Plugin
|
||||
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("MMM. dd, yyyy");
|
||||
|
||||
private Instant loginTime;
|
||||
private int ticksSinceLogin;
|
||||
private boolean ready;
|
||||
|
||||
@Inject
|
||||
@@ -114,12 +116,24 @@ public class ReportButtonPlugin extends Plugin
|
||||
if (ready)
|
||||
{
|
||||
loginTime = Instant.now();
|
||||
ticksSinceLogin = 0;
|
||||
ready = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick tick)
|
||||
{
|
||||
ticksSinceLogin++;
|
||||
|
||||
if (config.time() == TimeStyle.GAME_TICKS)
|
||||
{
|
||||
updateReportButtonTime();
|
||||
}
|
||||
}
|
||||
|
||||
@Schedule(
|
||||
period = 500,
|
||||
unit = ChronoUnit.MILLIS
|
||||
@@ -159,6 +173,9 @@ public class ReportButtonPlugin extends Plugin
|
||||
case DATE:
|
||||
reportButton.setText(getDate());
|
||||
break;
|
||||
case GAME_TICKS:
|
||||
reportButton.setText(getGameTicks());
|
||||
break;
|
||||
case OFF:
|
||||
reportButton.setText("Report");
|
||||
break;
|
||||
@@ -177,6 +194,11 @@ public class ReportButtonPlugin extends Plugin
|
||||
return time.format(DateTimeFormatter.ofPattern("HH:mm:ss"));
|
||||
}
|
||||
|
||||
private String getGameTicks()
|
||||
{
|
||||
return Integer.toString(ticksSinceLogin);
|
||||
}
|
||||
|
||||
private static String getLocalTime()
|
||||
{
|
||||
return LocalTime.now().format(DATE_TIME_FORMAT);
|
||||
|
||||
@@ -31,7 +31,8 @@ public enum TimeStyle
|
||||
LOGIN_TIME("Login Timer"),
|
||||
UTC("UTC Time"),
|
||||
JAGEX("Jagex HQ Time"),
|
||||
LOCAL_TIME("Local Time");
|
||||
LOCAL_TIME("Local Time"),
|
||||
GAME_TICKS("Game Ticks");
|
||||
|
||||
private final String name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user