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?

I may use the plugin settings and pulse them to let them know the instance is still alive - I'll update if that worked for me. Thanks @Enraged

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