app\models\Player::getJsonProfile PHP Method

getJsonProfile() public method

Get Json profile of player.
public getJsonProfile ( integer $api_type ) : string
$api_type integer Which API to use, 0 for CustomSkinAPI, 1 for UniSkinAPI
return string User profile in json format
    public function getJsonProfile($api_type)
    {
        // Support both CustomSkinLoader API & UniSkinAPI
        if ($api_type == self::CSL_API || $api_type == self::USM_API) {
            $responses = Event::fire(new GetPlayerJson($this, $api_type));
            // if listeners return nothing
            if (isset($responses[0]) && $responses[0] !== null) {
                return $responses[0];
            } else {
                return $this->generateJsonProfile($api_type);
            }
        } else {
            throw new InvalidArgumentException('The given api type should be Player::CSL_API or Player::USM_API.');
        }
    }