Because you're referring directly to the player, I'd put the check INSIDE the class. Otherwise you're defying the point of player classes.
Inside the 'foobar' class I'd do the following
HTML Code:
//Call the check on login
function onCreated() {
this.createVariables();
}
//Do the check here
public function createVariables() {
if (this.foo != null && this.bar != null) return;
this.foo = 1;
this.bar = 2;
}