Wait for a PluginReference to load?

Hey!

I have a plugin, A, that uses another plugin, B. I do so via a [PluginReference] and .Call()'s. However, I need to do so when A loads. If B hasn't loaded when A finishes loading, I get a null pointer.

Is there a way to avoid this without using // Requires?

My only thought is to have a timer run until the other plugin loads, but this seems like a poor solution.

OnPluginLoaded
5b6ed4c9ac8e4.jpg misticos
OnPluginLoaded

Just noticed that, thanks for the quick response!

On a related note: I have numerous plugins, and some of them share functions (i.e. FindPlayer(arg)). To accomodate, I made a library plugin, and for ease of use, I //require that plugin in every plugin.

However, for some reason, this means that if I reload any plugin requiring the library, it also reloads every other plugin that requires the library. Once I get a lot more of them, this will mean my entire server will reload (practically) just from reloading one plugin. Is there a way to stop this? Or do you know the reasoning behind it doing this?

 

Thanks!

Such methods are simple enough not to be moved to a "library plugin" and thats why you should not do this. If it is essential enough it should be in uMod.
5b6ed4c9ac8e4.jpg misticos
Such methods are simple enough not to be moved to a "library plugin" and thats why you should not do this. If it is essential enough it should be in uMod.

Fair point. Time to do some refactoring. Thanks for the hlep.