Jump to content

Remove Event Hooks


ZeppelinII

Recommended Posts

Does anyone know if it is possible to stop a method from from firing?

 

Events.OnPlayerUpdate.Add(checkPlayer)

 

i tried this, but i got an error - Events.OnPlayerUpdate.Remove(checkPlayer)

 

So if anyone knows how to accomplish this functionality then please let me know or if you know that it isn't possible that would be great also. I just feel like this would be the optimal solution for toggling a feature on/off as opposed to checking a condition once inside the method.

 

Thank you for your responses.

 

 

 

 

Link to comment
Share on other sites

Thank you, but I know that is an option. I was hoping that i could just remove the call to that function all together as to not have useless/unnecessary calls to a method I no longer want to invoke. If there is no other way, I will just do it this way. Thought it would be nice to save the user some cpu time (however minimal).

Link to comment
Share on other sites

I don't think removing event hooks is possible ... you could spelunk in the java source and check the EventManager if you want to be sure (it's been quite some time since I've actively written mods so it might have changed in the meantime).

Link to comment
Share on other sites

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