Call to a member function clearAll() on null
Issue description
I'm resetting the inventory of players on PlayerInteractEvent and PlayerQuitEvent with $inventory->clearAll(); in my plugin, but it throws errors sometimes.
Steps to reproduce the issue
It's very difficult to reproduce because it only happens sometimes. Just call $inventory->clearAll(); on PlayerQuitEvent or on interact with sign, and it'll crash after some players. When I open a test server on my network, it happens after 3-4 hours which are about 100 players who were on the server.
OS and versions
- Genisys: 8e139ea
- PHP: 7.0.9
- Server OS: Debian 8.5 x64
- Game version: 0.15.6 PE on iOS
Crashdump, backtrace, memory dumps, plugins list or other files
[36m[15:05:40] [m[31m[Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerQuitEvent' to 'JumpLeague v1.0.0': Call to a member function clearAll() on null on jjplaying\JumpLeague\EventListener[m
[36m[15:05:40] [m[31m[Server thread/CRITICAL]: Error: "Call to a member function clearAll() on null" (EXCEPTION) in "/src/pocketmine/Player" at line 1347[m
[36m[15:12:43] [m[31m[Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'JumpLeague v1.0.0': Call to a member function clearAll() on null on jjplaying\JumpLeague\EventListener[m
[36m[15:12:43] [m[31m[Server thread/CRITICAL]: Error: "Call to a member function clearAll() on null" (EXCEPTION) in "/src/pocketmine/Player" at line 1347[m
[36m[15:51:06] [m[31m[Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'JumpLeague v1.0.0': Call to a member function clearAll() on null on jjplaying\JumpLeague\EventListener[m
[36m[15:51:06] [m[31m[Server thread/CRITICAL]: Error: "Call to a member function clearAll() on null" (EXCEPTION) in "/src/pocketmine/Player" at line 1347[m
Most likely it's a timing issue. Will be investigated.
@dktapps What if another event was added ex) "PlayerPreQuitEvent" that was called by the server before PlayerQuitEvent was called?