Looking further down in the player class and how accessing an inventory is implemented in the interactOn() method, I believe you can pass the result from the getContainer() function that the ChestBlock class inherits from ContainerBlock. So just once you have a Block object, verifying that it's a ContainerBlock, it'd just be block.getContainer() with appropriate world and position parameters.
Oh, and of course, don't forget to not do this if it's a remote world.