Skip to content

Commit f3b8901

Browse files
authored
fix: Replace throwing error in InteractingShootingTargetEventArgs with warning to prevent crashes (#825)
* fix: no more crash * docs: update warn text
1 parent 7815cf8 commit f3b8901

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

EXILED/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ public int NewMaxHp
7777
set
7878
{
7979
if (!ShootingTarget.IsSynced)
80-
throw new InvalidOperationException("Attempted to set MaxHp while target is in local mode. Set target's IsSynced to true before setting IsAllowed.");
80+
{
81+
Log.Warn("Attempted to set MaxHp while target is in local mode. Set target's IsSynced to true before setting NewMaxHp.");
82+
return;
83+
}
84+
8185
maxHp = Mathf.Clamp(value, 1, 256);
8286
}
8387
}
@@ -91,7 +95,11 @@ public int NewAutoResetTime
9195
set
9296
{
9397
if (!ShootingTarget.IsSynced)
94-
throw new InvalidOperationException("Attempted to set AutoResetTime while target is in local mode. Set target's IsSynced to true before setting IsAllowed.");
98+
{
99+
Log.Warn("Attempted to set AutoResetTime while target is in local mode. Set target's IsSynced to true before setting NewAutoResetTime.");
100+
return;
101+
}
102+
95103
autoResetTime = Mathf.Clamp(value, 0, 10);
96104
}
97105
}

0 commit comments

Comments
 (0)