hideunder: add gamestate check for hiding entities. (#1565)

This commit is contained in:
Ganom
2019-09-09 04:31:40 -04:00
committed by Kyle
parent eadeebd4f0
commit f7591ffe28

View File

@@ -83,11 +83,11 @@ public class HideUnder extends Plugin
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
public void onGameStateChanged(GameStateChanged event)
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOGGED_IN)
{
client.setIsHidingEntities(true);
client.setIsHidingEntities(isPlayerRegionAllowed());
}
}
@@ -207,4 +207,19 @@ public class HideUnder extends Plugin
}
}
}
private boolean isPlayerRegionAllowed()
{
final Player localPlayer = client.getLocalPlayer();
if (localPlayer == null)
{
return true;
}
final int playerRegionID = WorldPoint.fromLocalInstance(client, localPlayer.getLocalLocation()).getRegionID();
// 9520 = Castle Wars
return playerRegionID != 9520;
}
}