Move isOverlayOutdated to IndexDatabase

Instead of creating new callback and then simply setting boolean on
RuneLite to dump it somewhere, expose this boolean from IndexDatabase
and remove injection of RuneLite.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-08-03 10:40:24 +02:00
parent 5e3d205d0b
commit 5a152f0514
6 changed files with 17 additions and 31 deletions

View File

@@ -43,7 +43,6 @@ import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.util.EnumConverter;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.client.account.SessionManager;
@@ -146,10 +145,6 @@ public class RuneLite
@Nullable
private Client client;
@Getter
@Setter
private boolean overlayOutdated;
public static void main(String[] args) throws Exception
{
Locale.setDefault(Locale.ENGLISH);

View File

@@ -42,7 +42,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.IndexDataBase;
import net.runelite.api.MainBufferProvider;
import net.runelite.api.RenderOverview;
import net.runelite.api.WorldMapManager;
@@ -275,13 +274,6 @@ public class Hooks implements Callbacks
keyManager.processKeyTyped(keyEvent);
}
@Override
public void overlayLoadFailed(IndexDataBase indexDataBase, int archiveId, int fileId)
{
RuneLite runeLite = injector.getInstance(RuneLite.class);
runeLite.setOverlayOutdated(true);
}
@Override
public void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y)
{

View File

@@ -32,7 +32,6 @@ import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.client.RuneLite;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -46,9 +45,6 @@ import net.runelite.client.plugins.PluginDescriptor;
@Slf4j
public class ZoomPlugin extends Plugin
{
@Inject
private RuneLite runeLite;
@Inject
private Client client;
@@ -64,7 +60,7 @@ public class ZoomPlugin extends Plugin
@Subscribe
public void onScriptEvent(ScriptCallbackEvent event)
{
if (runeLite.isOverlayOutdated())
if (client.getIndexScripts().isOverlayOutdated())
{
// if any cache overlay fails to load then assume at least one of the zoom scripts is outdated
// and prevent zoom extending entirely.