hideunder: add gamestate check for hiding entities. (#1565)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user