create an integer that receives the NPCs combat level and before calling the attack code insert a simple if statement to check if the player's combat level is less than double.
to give an example:
Code:int npcCombatLevel = npc.getCombatLevel(); if(player.getCombatLevel() <(npc.getCombatLevel() * 2)) { // do aggression. }