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
| Parameter | Type | Required | Description |
|---|---|---|---|
playerUserId | string | Yes | The unique ID of the player to forgive |
shouldResetStrikes | bool | No | Whether 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
| Property | Type | Description |
|---|---|---|
Ok | bool | Indicates whether the request was successful |
Message | string | Response 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
forgiveaction log entry. - If
shouldResetStrikesistrue, the player's strike count will be reset to zero. - Forgiveness triggers a webhook notification with
actionValue: "forgive"andtrigger: "manual_forgiveness".