replace if/else in Player to ternary operator