Jump to content

Plugin - Only create instance of class if it doesn't already exist


Recommended Posts

In a plugin I'm writing I create an instance of a class.

I do not want to dispose it when the bot is stopped (which is fine and working) however I don't want to create another instance of it if it already exists as there would then be 2 of them (as I'm not disposing the original).

I can't track it in a variable within my plugin because once the bot is restarted a new instance of the plugin is spawned and would not have those variables.

Is there something I can set in a wrobot variable to track whether my plugin has launched and thus I don't need to track it in my plugin?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...