Retrieve List of Blocking Players
Last updated on
Use the following function to retrieve a list of players that have blocked the current player. This method has a callback that returns an array of data that contains the blocking player's User ID.
- Unreal Engine
- Unity
FRegistry::Lobby.Connect();
FRegistry::Lobby.GetListOfBlockers(THandler<FAccelByteModelsListBlockerResponse>::CreateLambda([](const FAccelByteModelsListBlockerResponse& Result)
{
// Do something if GetListOfBlockers has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetListOfBlockers has an error
UE_LOG(LogTemp, Log, TEXT("Error GetListOfBlockers, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
AccelBytePlugin.GetLobby().Connect();
AccelBytePlugin.GetLobby().GetListOfBlocker(result =>
{
if (result.IsError)
{
// Do something if GetListOfBlocker has an error
Debug.Log($"Error GetListOfBlocker, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetListOfBlocker has been successful
}
});
Retrieve List of Blocking Players by User ID
Use the following function to retrieve a list of players that have been blocked by a specific player, using that player's User ID.
- Unreal Engine
FString UserId = FString("SomeUserId");
FRegistry::Lobby.Connect();
FRegistry::Lobby.GetListOfBlockers(UserId, THandler<FAccelByteModelsListBlockerResponse>::CreateLambda([](const FAccelByteModelsListBlockerResponse& Result)
{
// Do something if GetListOfBlockers has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetListOfBlockers has an error
UE_LOG(LogTemp, Log, TEXT("Error GetListOfBlockers, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));