Skip to main content

ForgivePlayerAsync

Forgives a player, clearing their active action log and optionally resetting their strikes. This method is only available to dev players.

Method Signature

public async Task<ForgivePlayerResponse> ForgivePlayerAsync(string playerUserId, bool shouldResetStrikes = false)

Parameters

ParameterTypeRequiredDescription
playerUserIdstringYesThe unique ID of the player to forgive
shouldResetStrikesboolNoWhether to reset the player's strike count (defaults to false)

Returns

Returns a ForgivePlayerResponse object, or null if the request failed or the caller is not a dev player.

Usage Example

var result = await PlaySafeManager.Instance.ForgivePlayerAsync(targetPlayerId, shouldResetStrikes: true);

if (result != null && result.Ok)
{
Debug.Log($"Player {targetPlayerId} has been forgiven.");
}
else
{
Debug.LogWarning($"Failed to forgive player: {result?.Message ?? "Unknown error"}");
}

Response Type

ForgivePlayerResponse

public class ForgivePlayerResponse
{
public bool Ok { get; set; }
public object Data { get; set; }
public string Message { get; set; }
}

Properties

PropertyTypeDescription
OkboolIndicates whether the request was successful
MessagestringResponse message from the server

Error Handling

The method returns null if:

  • The current player is not a dev player
  • Network request fails
  • Response parsing fails

Always check for null and verify the Ok property before proceeding.

Notes

  • This method is only available to dev players. Non-dev players will receive a warning and the method will return null.
  • Forgiving a player clears their active action log and creates a new forgive action log entry.
  • If shouldResetStrikes is true, the player's strike count will be reset to zero.
  • Forgiveness triggers a webhook notification with actionValue: "forgive" and trigger: "manual_forgiveness".