Java Code Examples for net.runelite.api.GameState#LOGGED_IN
The following examples show how to use
net.runelite.api.GameState#LOGGED_IN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PartyPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Schedule( period = 10, unit = ChronoUnit.SECONDS ) public void shareLocation() { if (client.getGameState() != GameState.LOGGED_IN) { return; } final PartyMember localMember = party.getLocalMember(); if (localMember == null) { return; } final LocationUpdate locationUpdate = new LocationUpdate(client.getLocalPlayer().getWorldLocation()); locationUpdate.setMemberId(localMember.getMemberId()); wsClient.send(locationUpdate); }
Example 2
Source File: TMorph.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe public void onGameTick(GameTick event) { if (client.getGameState() != GameState.LOGGED_IN) { return; } final Player player = client.getLocalPlayer(); if (player == null || player.getPlayerAppearance() == null || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null || client.getViewportWidget() == null) { return; } updateGear(panelMorph, player); updateGear(NEWLINE_SPLITTER.withKeyValueSeparator(':').split(config.set1()), player); updateGear(NEWLINE_SPLITTER.withKeyValueSeparator(':').split(config.set2()), player); updateGear(NEWLINE_SPLITTER.withKeyValueSeparator(':').split(config.set3()), player); }
Example 3
Source File: SpecialCounterPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onGameStateChanged(GameStateChanged event) { if (event.getGameState() == GameState.LOGGED_IN) { if (currentWorld == -1) { currentWorld = client.getWorld(); } else if (currentWorld != client.getWorld()) { currentWorld = client.getWorld(); removeCounters(); } } }
Example 4
Source File: ThievingPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe private void onGameObjectDespawned(GameObjectDespawned event) { if (client.getGameState() != GameState.LOGGED_IN || recentlyLoggedIn) { return; } final GameObject object = event.getGameObject(); Chest chest = Chest.of(object.getId()); if (chest != null) { ChestRespawn chestRespawn = new ChestRespawn(chest, object.getWorldLocation(), Instant.now().plus(chest.getRespawnTime()), client.getWorld()); respawns.add(chestRespawn); } }
Example 5
Source File: RaidsPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onGameStateChanged(GameStateChanged event) { if (client.getGameState() == GameState.LOGGED_IN) { // skip event while the game decides if the player belongs in a raid or not if (client.getLocalPlayer() == null || client.getLocalPlayer().getWorldLocation().equals(TEMP_LOCATION)) { return; } checkInRaid = true; } else if (client.getGameState() == GameState.LOGIN_SCREEN || client.getGameState() == GameState.CONNECTION_LOST) { loggedIn = false; } else if (client.getGameState() == GameState.HOPPING) { reset(); } }
Example 6
Source File: FriendsChatPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onGameTick(GameTick gameTick) { if (client.getGameState() != GameState.LOGGED_IN) { return; } Widget chatTitleWidget = client.getWidget(WidgetInfo.FRIENDS_CHAT_TITLE); if (chatTitleWidget != null) { Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST); Widget owner = client.getWidget(WidgetInfo.FRIENDS_CHAT_OWNER); FriendsChatManager friendsChatManager = client.getFriendsChatManager(); if (friendsChatManager != null && friendsChatManager.getCount() > 0) { chatTitleWidget.setText(TITLE + " (" + friendsChatManager.getCount() + "/100)"); } else if (config.recentChats() && chatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText())) { chatTitleWidget.setText(RECENT_TITLE); loadFriendsChats(); } } if (!config.showJoinLeave()) { return; } timeoutMessages(); addActivityMessages(); }
Example 7
Source File: KeyRemappingPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
void unlockChat() { Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT); if (chatboxInput != null && client.getGameState() == GameState.LOGGED_IN) { final boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1; final Color textColor = isChatboxTransparent ? JagexColors.CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND : JagexColors.CHAT_TYPED_TEXT_OPAQUE_BACKGROUND; setChatboxWidgetInput(chatboxInput, ColorUtil.wrapWithColorTag(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT) + "*", textColor)); } }
Example 8
Source File: VirtualLevelsPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void initializePreviousXpMap() { if (client.getGameState() != GameState.LOGGED_IN) { previousXpMap.clear(); } else { for (final Skill skill : Skill.values()) { previousXpMap.put(skill, client.getSkillExperience(skill)); } } }
Example 9
Source File: BankPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onGameStateChanged(GameStateChanged event) { if (event.getGameState() != GameState.LOGGED_IN) { keyManager.unregisterKeyListener(this); return; } keyManager.registerKeyListener(this); }
Example 10
Source File: WorldHopperPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onGameStateChanged(GameStateChanged gameStateChanged) { // If the player has disabled the side bar plugin panel, do not update the UI if (config.showSidebar() && gameStateChanged.getGameState() == GameState.LOGGED_IN) { if (lastWorld != client.getWorld()) { int newWorld = client.getWorld(); panel.switchCurrentHighlight(newWorld, lastWorld); lastWorld = newWorld; } } }
Example 11
Source File: WorldService.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void tick() { try { if (worlds == null || client.getGameState() == GameState.LOGGED_IN) { fetch(); } } finally { firstRunFuture.complete(worlds); } }
Example 12
Source File: EmojiPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe void onChatMessage(ChatMessage chatMessage) { if (client.getGameState() != GameState.LOGGED_IN || modIconsStart == -1) { return; } switch (chatMessage.getType()) { case PUBLICCHAT: case MODCHAT: case FRIENDSCHAT: case PRIVATECHAT: case PRIVATECHATOUT: case MODPRIVATECHAT: break; default: return; } final MessageNode messageNode = chatMessage.getMessageNode(); final String message = messageNode.getValue(); final String updatedMessage = updateMessage(message); if (updatedMessage == null) { return; } messageNode.setRuneLiteFormatMessage(updatedMessage); chatMessageManager.update(messageNode); client.refreshChat(); }
Example 13
Source File: GroundMarkerPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onGameStateChanged(GameStateChanged gameStateChanged) { if (gameStateChanged.getGameState() != GameState.LOGGED_IN) { return; } // map region has just been updated loadPoints(); }
Example 14
Source File: AttackStylesPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onGameStateChanged(GameStateChanged event) { if (event.getGameState() == GameState.LOGGED_IN) { resetWarnings(); } }
Example 15
Source File: ChatboxPerformancePlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void shutDown() { if (client.getGameState() == GameState.LOGGED_IN) { clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0)); } }
Example 16
Source File: FriendsChatPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
@Subscribe private void onChatMessage(ChatMessage chatMessage) { if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) { return; } FriendsChatManager friendsChatManager = client.getFriendsChatManager(); if (friendsChatManager == null || friendsChatManager.getCount() == 0) { return; } switch (chatMessage.getType()) { case PRIVATECHAT: case MODPRIVATECHAT: if (!config.privateMessageIcons()) { return; } break; case PUBLICCHAT: case MODCHAT: if (!config.publicChatIcons()) { return; } break; case FRIENDSCHAT: if (!config.chatIcons()) { return; } break; default: return; } insertRankIcon(chatMessage); }
Example 17
Source File: RaidsPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
void checkRaidPresence(boolean force) { if (client.getGameState() != GameState.LOGGED_IN) { return; } boolean setting = client.getVar(Varbits.IN_RAID) == 1; if (force || inRaidChambers != setting) { inRaidChambers = setting; updateInfoBoxState(); if (inRaidChambers) { raid = buildRaid(); if (raid == null) { log.debug("Failed to build raid"); return; } Layout layout = layoutSolver.findLayout(raid.toCode()); if (layout == null) { log.debug("Could not find layout match"); return; } layoutFullCode = layout.getCode(); raid.updateLayout(layout); RaidRoom[] rooms = raid.getCombatRooms(); RotationSolver.solve(rooms); raid.setCombatRooms(rooms); setOverlayStatus(true); if (config.displayLayoutMessage()) { sendRaidLayoutMessage(); } Matcher puzzleMatch = PUZZLES.matcher(raid.getFullRotationString()); final List<String> puzzles = new ArrayList<>(); while (puzzleMatch.find()) { puzzles.add(puzzleMatch.group()); } if (raid.getFullRotationString().contains("Crabs")) { switch (puzzles.size()) { case 1: goodCrabs = handleCrabs(puzzles.get(0)); break; case 2: goodCrabs = handleCrabs(puzzles.get(0), puzzles.get(1)); break; case 3: goodCrabs = handleCrabs(puzzles.get(0), puzzles.get(1), puzzles.get(2)); break; } } } else if (!config.scoutOverlayAtBank()) { setOverlayStatus(false); } } // If we left party raid was started or we left raid if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 && (!inRaidChambers || !config.scoutOverlayInRaid())) { setOverlayStatus(false); raidStarted = false; } }
Example 18
Source File: TelekineticRoom.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Subscribe public void onGameTick(GameTick event) { if (!config.telekinetic() || !inside() || client.getGameState() != GameState.LOGGED_IN) { maze = null; moves.clear(); return; } if (maze == null || telekineticWalls.size() != maze.getWalls()) { bounds = getBounds(telekineticWalls.toArray(new WallObject[0])); maze = Maze.fromWalls(telekineticWalls.size()); client.clearHintArrow(); } else if (guardian != null) { WorldPoint current; if (guardian.getId() == MAZE_GUARDIAN_MOVING) { destination = getGuardianDestination(); current = WorldPoint.fromLocal(client, destination); } else { destination = null; current = guardian.getWorldLocation(); } //Prevent unnecessary updating when the guardian has not moved if (current.equals(location)) { return; } log.debug("Updating guarding location {} -> {}", location, current); location = current; if (location.equals(finishLocation)) { client.clearHintArrow(); } else { log.debug("Rebuilding moves due to guardian move"); this.moves = build(); } } else { client.clearHintArrow(); moves.clear(); } }
Example 19
Source File: XpTrackerPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
@Subscribe void onGameStateChanged(GameStateChanged event) { GameState state = event.getGameState(); if (state == GameState.LOGGED_IN) { // LOGGED_IN is triggered between region changes too. // Check that the username changed or the world type changed. XpWorldType type = worldSetToType(client.getWorldType()); if (!Objects.equals(client.getUsername(), lastUsername) || lastWorldType != type) { // Reset log.debug("World change: {} -> {}, {} -> {}", lastUsername, client.getUsername(), Objects.requireNonNullElse(lastWorldType, "<unknown>"), Objects.requireNonNullElse(type, "<unknown>")); lastUsername = client.getUsername(); // xp is not available until after login is finished, so fetch it on the next gametick fetchXp = true; lastWorldType = type; resetState(); // Must be set from hitting the LOGGING_IN or HOPPING case below assert initializeTracker; } } else if (state == GameState.LOGGING_IN || state == GameState.HOPPING) { initializeTracker = true; } else if (state == GameState.LOGIN_SCREEN) { Player local = client.getLocalPlayer(); if (local == null) { return; } String username = local.getName(); if (username == null) { return; } long totalXp = client.getOverallExperience(); // Don't submit xptrack unless xp threshold is reached if (Math.abs(totalXp - lastXp) > XP_THRESHOLD) { xpClient.update(username); lastXp = totalXp; } } }
Example 20
Source File: Notifier.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
public void processFlash(final Graphics2D graphics) { if (flashStart == null || client.getGameState() != GameState.LOGGED_IN) { flashStart = null; return; } FlashNotification flashNotification = runeLiteConfig.flashNotification(); if (client.getGameCycle() % 40 >= 20 // For solid colour, fall through every time. && (flashNotification == FlashNotification.FLASH_TWO_SECONDS || flashNotification == FlashNotification.FLASH_UNTIL_CANCELLED)) { return; } final Color color = graphics.getColor(); graphics.setColor(FLASH_COLOR); graphics.fill(new Rectangle(client.getCanvas().getSize())); graphics.setColor(color); if (!Instant.now().minusMillis(MINIMUM_FLASH_DURATION_MILLIS).isAfter(flashStart)) { return; } switch (flashNotification) { case FLASH_TWO_SECONDS: case SOLID_TWO_SECONDS: flashStart = null; break; case SOLID_UNTIL_CANCELLED: case FLASH_UNTIL_CANCELLED: // Any interaction with the client since the notification started will cancel it after the minimum duration if ((client.getMouseIdleTicks() < MINIMUM_FLASH_DURATION_TICKS || client.getKeyboardIdleTicks() < MINIMUM_FLASH_DURATION_TICKS || client.getMouseLastPressedMillis() > mouseLastPressedMillis) && clientUI.isFocused()) { flashStart = null; } break; } }