I've got a plugin structure where each class has an $isRunning, and each plugin implements Listener and gets registered in my Main file. I have certain events that pretty much look like this: PHP: public function onBlockBreak(BlockBreakEvent $event){ if($this->isRunning()) { //some stuff here }} I feel like its not a good idea to have a bunch of events that trigger that line of code every time, so is there a way to deregister an event?
Calling just one getter function is minimal lag (unless it is not a simple getter function), so that wouldn't really matter, I think. But if you are handling events like DataPacketReceiveEvent or PlayerMoveEvent, those that may get called thousands times a second, you should probably avoid even registering them in the first case.