Getting a Player from an Interaction

Hi !

I’m a newbie on Sponge and I’d like to develop a plugin that will use a lock system. For the algorithm I thought about, I would need to browse the inventory of the player to get a few informations, but doing so requires getting a Player object from the event, is there a way to do this?

Thank you !

You need to get the event cause. There is 2 examples over here

On a related note the inventory api isn’t ready so you’re going to hit a brick wall until it’s been implemented.

You also might want to give this a read

https://docs.spongepowered.org/en/plugin/events.html

Thanks a lot for your quick answer, I will try this and let you know :smile:

It works, thank you very much !