Well, I've not really done anything with commands myself, but looking at CommandBase, I see both getCommandSenderAsPlayer and getPlayer methods, so I'd hazard a guess at one of those being the solution. Try some things, and come post your code if it's not working, along with logs and/or what it's (not) doing as expected.