Merge pull request #2645 from AlexKolpa/fix-etceteria
Fix region check Kingdom plugin
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.kingdomofmiscellania;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.common.primitives.Ints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
@@ -34,7 +34,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.MapRegionChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -47,7 +47,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
@Slf4j
|
||||
public class KingdomPlugin extends Plugin
|
||||
{
|
||||
private static final int[] KINGDOM_REGION = {9787, 9788, 9789, 10043, 10044, 10045, 10299, 10300, 10301};
|
||||
private static final ImmutableSet<Integer> KINGDOM_REGION = ImmutableSet.of(10044, 10300);
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@@ -85,9 +85,12 @@ public class KingdomPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onRegionChanged(MapRegionChanged event)
|
||||
public void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
processInfobox();
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
processInfobox();
|
||||
}
|
||||
}
|
||||
|
||||
private void processInfobox()
|
||||
@@ -125,7 +128,7 @@ public class KingdomPlugin extends Plugin
|
||||
|
||||
private boolean isInKingdom()
|
||||
{
|
||||
return Ints.indexOf(client.getMapRegions(), KINGDOM_REGION) >= 0;
|
||||
return KINGDOM_REGION.contains(client.getLocalPlayer().getWorldLocation().getRegionID());
|
||||
}
|
||||
|
||||
private boolean hasCompletedQuest()
|
||||
|
||||
Reference in New Issue
Block a user