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