2016-11-15 07:21:22 +05:30
|
|
|
#include "ClaimAccount.h"
|
|
|
|
#include <launch/LaunchTask.h>
|
|
|
|
|
2021-11-20 20:52:22 +05:30
|
|
|
#include "Application.h"
|
|
|
|
#include "minecraft/auth/AccountList.h"
|
|
|
|
|
2016-11-15 07:21:22 +05:30
|
|
|
ClaimAccount::ClaimAccount(LaunchTask* parent, AuthSessionPtr session): LaunchStep(parent)
|
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
if(session->status == AuthSession::Status::PlayableOnline)
|
|
|
|
{
|
2021-11-20 20:52:22 +05:30
|
|
|
auto accounts = APPLICATION->accounts();
|
|
|
|
m_account = accounts->getAccountByProfileName(session->player_name);
|
2018-07-15 18:21:05 +05:30
|
|
|
}
|
2016-11-15 07:21:22 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
void ClaimAccount::executeTask()
|
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
if(m_account)
|
|
|
|
{
|
|
|
|
lock.reset(new UseLock(m_account));
|
|
|
|
emitSucceeded();
|
|
|
|
}
|
2016-11-15 07:21:22 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
void ClaimAccount::finalize()
|
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
lock.reset();
|
2016-11-15 07:21:22 +05:30
|
|
|
}
|