Search in sources :

Example 1 with GameState

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);
    }
}
Also used : GameState(net.runelite.api.GameState)

Example 2 with GameState

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;
    }
}
Also used : GameState(net.runelite.api.GameState) Subscribe(com.google.common.eventbus.Subscribe)

Example 3 with GameState

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;
    }
}
Also used : GameState(net.runelite.api.GameState) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

GameState (net.runelite.api.GameState)3 Subscribe (com.google.common.eventbus.Subscribe)2