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
  • Try asking for help in the chatbox
  • Removing/Unregistering an EventListener


    BenjaminUC
     Share

    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()

    Edited by Jort
    Link to comment
    Share on other sites

    • 3 months later...

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • 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.