Ok so I know the solution to this should be a check if the player is online or just an instanceof Player. However I still get errors like these throughout numerous spots in my plugin. For example... PHP: $event->getDamager(); Sometimes when this is called as the damager is logged or logs out, it throws me an error like shown in the title, it returns as null. What confuses me is I always have checks before using these functions? Which brings me to my question, how can I avoid getting these errors?
If the error reads like "call to a member function getDamager() on null", then that means there's no event object.
Same here https://forums.pmmp.io/threads/need-help-d.10105/ Just check if $event->getDamager() is online or null