runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterPlugin.java
/**
	 * Iterates over all the traps that were placed by the local player and
	 * checks if the trap is still there. If the trap is gone, it removes
	 * the trap from the local players trap collection.
	 */
Iterates over all the traps that were placed by the local player and
checks if the trap is still there. If the trap is gone, it removes
the trap from the local players trap collection.
Iterates over all the traps that were placed by the local player and checks if the trap is still there . If the trap is gone it removes the trap from the local players trap collection .
@Subscribe
	public void onGameTick(GameTick event)
	{
		Iterator<Map.Entry<WorldPoint, HunterTrap>> it = traps.entrySet().iterator();
		Tile[][][] tiles = client.getRegion().getTiles();
		Instant expire = Instant.now().minus(HunterTrap.TRAP_TIME.multipliedBy(2));
		while (it.hasNext())
		{
			Map.Entry<WorldPoint, HunterTrap> entry = it.next();
			HunterTrap trap = entry.getValue();
			WorldPoint world = entry.getKey();
			LocalPoint local = LocalPoint.fromWorld(client, world);
			if (local == null)
			{
				if (trap.getPlacedOn().isBefore(expire))
				{
					log.debug("Trap removed from personal trap collection due to timeout, {} left", traps.size());
					it.remove();
					continue;
				}
				continue;
			}
			Tile tile = tiles[world.getPlane()][local.getRegionX()][local.getRegionY()];
			GameObject[] objects = tile.getGameObjects();
			boolean containsBoulder = false;
			boolean containsAnything = false;
			boolean containsYoungTree = false;
			for (GameObject object : objects)
			{
				if (object != null)
				{
					containsAnything = true;
					if (object.getId() == ObjectID.BOULDER_19215 || object.getId() == ObjectID.LARGE_BOULDER)
					{
						containsBoulder = true;
						break;
					}
					if (object.getId() == ObjectID.YOUNG_TREE_8732 || object.getId() == ObjectID.YOUNG_TREE_8990 ||
						object.getId() == ObjectID.YOUNG_TREE_9000 || object.getId() == ObjectID.YOUNG_TREE_9341)
					{
						containsYoungTree = true;
					}
				}
			}
			if (!containsAnything || containsYoungTree)
			{
				it.remove();
				log.debug("Trap removed from personal trap collection, {} left", traps.size());
			}
			else if (containsBoulder) 
			{
				it.remove();
				log.debug("Special trap removed from personal trap collection, {} left", traps.size());
				if (config.maniacalMonkeyNotify() && trap.getObjectId() == ObjectID.MONKEY_TRAP &&
					!trap.getState().equals(HunterTrap.State.FULL) && !trap.getState().equals(HunterTrap.State.OPEN))
				{
					notifier.notify("The monkey escaped.");
				}
			}
		}
		lastTickLocalPlayerLocation = client.getLocalPlayer().getWorldLocation();
	}
@ Subscribe public void onGameTick ( GameTick event ) { Iterator < Map . Entry < WorldPoint , HunterTrap > > it = traps . entrySet ( ) . iterator ( ) ; Tile [ ] [ ] [ ] tiles = client . getRegion ( ) . getTiles ( ) ; Instant expire = Instant . now ( ) . minus ( HunterTrap . TRAP_TIME . multipliedBy ( 2 ) ) ; while ( it . hasNext ( ) ) { Map . Entry < WorldPoint , HunterTrap > entry = it . next ( ) ; HunterTrap trap = entry . getValue ( ) ; WorldPoint world = entry . getKey ( ) ; LocalPoint local = LocalPoint . fromWorld ( client , world ) ; if ( local == null ) { if ( trap . getPlacedOn ( ) . isBefore ( expire ) ) { log . debug ( "Trap removed from personal trap collection due to timeout, {} left" , traps . size ( ) ) ; it . remove ( ) ; continue ; } continue ; } Tile tile = tiles [ world . getPlane ( ) ] [ local . getRegionX ( ) ] [ local . getRegionY ( ) ] ; GameObject [ ] objects = tile . getGameObjects ( ) ; boolean containsBoulder = false ; boolean containsAnything = false ; boolean containsYoungTree = false ; for ( GameObject object : objects ) { if ( object != null ) { containsAnything = true ; if ( object . getId ( ) == ObjectID . BOULDER_19215 || object . getId ( ) == ObjectID . LARGE_BOULDER ) { containsBoulder = true ; break ; } if ( object . getId ( ) == ObjectID . YOUNG_TREE_8732 || object . getId ( ) == ObjectID . YOUNG_TREE_8990 || object . getId ( ) == ObjectID . YOUNG_TREE_9000 || object . getId ( ) == ObjectID . YOUNG_TREE_9341 ) { containsYoungTree = true ; } } } if ( ! containsAnything || containsYoungTree ) { it . remove ( ) ; log . debug ( "Trap removed from personal trap collection, {} left" , traps . size ( ) ) ; } else if ( containsBoulder ) { it . remove ( ) ; log . debug ( "Special trap removed from personal trap collection, {} left" , traps . size ( ) ) ; if ( config . maniacalMonkeyNotify ( ) && trap . getObjectId ( ) == ObjectID . MONKEY_TRAP && ! trap . getState ( ) . equals ( HunterTrap . State . FULL ) && ! trap . getState ( ) . equals ( HunterTrap . State . OPEN ) ) { notifier . notify ( "The monkey escaped." ) ; } } } lastTickLocalPlayerLocation = client . getLocalPlayer ( ) . getWorldLocation ( ) ; }
Iterates over all the traps that were placed by the local player and
 checks if the trap is still there.
Iterates over all the traps that were placed by the local player and checks if the trap is still there .
// Check if all traps are still there, and remove the ones that are not. // Not within the client's viewport // Cull very old traps // Check for young trees (used while catching salamanders) in the tile. // Otherwise, hunter timers will never disappear after a trap is dismantled // For traps like deadfalls. This is different because when the trap is gone, there is still a GameObject (boulder) // Case we have notifications enabled and the action was not manual, throw notification