use of net.runelite.api.GameState in project runelite by runelite.
the class UsernameSyncerPlugin method applyUsername.
private void applyUsername() {
GameState gameState = client.getGameState();
if (gameState == GameState.LOGIN_SCREEN) {
String username = config.username();
if (Strings.isNullOrEmpty(username)) {
return;
}
// Save it only once
if (usernameCache == null) {
usernameCache = client.getPreferences().getRememberedUsername();
}
client.getPreferences().setRememberedUsername(username);
}
}
use of net.runelite.api.GameState in project runelite by runelite.
the class IdleNotifierPlugin method onGameStateChanged.
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged) {
lastInteracting = null;
GameState state = gameStateChanged.getGameState();
switch(state) {
case LOGGING_IN:
case HOPPING:
case CONNECTION_LOST:
ready = true;
break;
case LOGGED_IN:
if (ready) {
sixHourWarningTime = Instant.now().plus(SIX_HOUR_LOGOUT_WARNING_AFTER_DURATION);
ready = false;
}
break;
}
}
use of net.runelite.api.GameState in project runelite by runelite.
the class ReportButtonPlugin method onGameStateChange.
@Subscribe
public void onGameStateChange(GameStateChanged event) {
GameState state = event.getGameState();
switch(state) {
case LOGGING_IN:
case HOPPING:
case CONNECTION_LOST:
ready = true;
break;
case LOGGED_IN:
if (ready) {
loginTime = Instant.now();
ready = false;
}
break;
}
}