Inventory issue on multiworld server
steve4744 opened this issue ยท 3 comments
Hi Ash,
I've found an issue with inventory items being lost when quitting a course.
When a player dies (exceeding max deaths) or quits a course, he gets teleported to the lobby.
If the course is in a different world than the lobby, when the player returns to the world containing the parkour course (but not playing parkour, just /mvtp for example) then the original inventory for that world is lost (being replaced by the 3 parkour objects (arrow,bone,sapling) - as they were the final inventory items he had before being teleported out of parkour.
This happens because the "playerLeave" class calls "loadInventory(player)" after "CourseMethods.joinLobby". You need to load the inventory before returning to the lobby - that way, whatever inventory management plugin is installed (PerWorldInventory for example), will have the correct items.
When a course is successfully completed, loadInventory(player) is called before CourseMethods.joinLobby which works correctly.
I've tested the latest code with the order reversed and it works fine.
Cheers,
Steve
Amazing, thank you for identifying and helping me fix the problem.
I will include this in the plugin release.
Will update this ticket when fix has been committed for confirmation of it working.
Please confirm latest commit has fixed the issue and I will close the ticket, thank you! :)