Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Developing a custom listener?


    msemtex

    Recommended Posts

    Posted

    Hi all,

    Does anyone have any advice or link to a simple tutorial to create a custom listener? I'm looking to implement a listener that detects a nearby player, the event would be captured in the main script along the lines of a player detected method:

    public class Script extends AbstractScript implements PlayerListener {
    
    	@Override
    	public void playerDetected(Player player)
    	{
         		// do stuff based on the detected player
    	}
    }

     

    Posted

    You can get this quite simply like so:

    List<Player> allPlayers = Players.all();
    if(allPlayers.size() > 1) //always atleast 1 cause of localPlayer
    {
        
    }
    

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.