world map: use game state change event to load quest icons
This was queueing potentially multiple tasks if the config was changed on the login screen, all waiting for the player to be logged in. Instead, use the game state change event to load the icons.
This commit is contained in:
@@ -110,6 +110,10 @@ public class ClientThread
|
||||
{
|
||||
ir.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
log.trace("Deferring task {}", r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Quest;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.StatChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
@@ -168,6 +169,15 @@ public class WorldMapPlugin extends Plugin
|
||||
woodcuttingLevel = 0;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||
{
|
||||
if (gameStateChanged.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
updateQuestStartPointIcons();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
@@ -488,17 +498,14 @@ public class WorldMapPlugin extends Plugin
|
||||
}
|
||||
|
||||
// Must setup the quest icons on the client thread, after the player has logged in.
|
||||
clientThread.invokeLater(() ->
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
if (client.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
return false;
|
||||
Arrays.stream(QuestStartLocation.values())
|
||||
.map(this::createQuestStartPoint)
|
||||
.forEach(worldMapPointManager::add);
|
||||
}
|
||||
|
||||
Arrays.stream(QuestStartLocation.values())
|
||||
.map(this::createQuestStartPoint)
|
||||
.forEach(worldMapPointManager::add);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user