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
  • Removing/Unregistering an EventListener


    BenjaminUC

    Recommended Posts

    Hi,

    It is easy to add/register a new EventListener with:

    getClient().getInstance().addEventListener(listener);

    However, I haven't been able to find where to unregister it again. I am aware of the many removeXListener methods in the Canvas class

    image.png.85886caa3a1ed635d55635b85feb0954.png

    Specifically I'm registering PaintListener's dynamically based on the current executing Node. (I'm using my own custom Node structure not TaskNode)

    It seems that when you stop and start the script, the previous registered listeners are still registered and thus not removed when the script is stopped.

    How and where do you unregister an EventListener (PaintListener)?

    Link to comment
    Share on other sites

    • 1 year later...

    I have the same problem, paint gets drawn twice when script is restarted.

    I dirty-solved it by creating a new method in my custom painter class which 'disables' it, which I call in onExit()

    Link to comment
    Share on other sites

    • 3 months later...

    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.