fix: OnEscaping Exiled and LabAPI bug #580
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Describe the changes
This change modifies the default value of the IsAllowed property in the EscapingEventArgs constructor. The primary goal is to improve compatibility with other plugins that implement their own custom escape scenarios (for example: LabAPI). Previously, IsAllowed was explicitly set to false by default for any escape identified as EscapeScenario.CustomEscape, effectively blocking other plugins. This change reverses that logic, setting IsAllowed = true by default for all escape scenarios, adopting an "allow by default, deny by exception" philosophy. This approach is safe because the base game itself performs a final validation after the event, aborting the escape if the final scenario is invalid (None).
What is the current behavior? (You can also link to an open issue here)
Currently, Exiled's EscapingEventArgs constructor automatically sets IsAllowed = false if the game's escape scenario is determined to be EscapeScenario.CustomEscape(for labapi) . This pre emptively blocks any other plugins that rely on custom escape mechanics from functioning correctly, as the escape process is cancelled by Exiled's event before those plugins can execute their logic. This is the root cause of the issue where custom escape plugins only work when Exiled is disabled.
What is the new behavior? (if this is a feature change)
The EscapingEventArgs constructor now sets IsAllowed = true by default for all escape scenarios, including custom ones. This allows other plugins that handle custom escapes to work alongside Exiled without being blocked by default. These plugins can now modify the EscapeScenario as needed. The base game's logic, which executes after our event, will then proceed. Crucially, the base game still includes a final check and will abort the process if the final EscapeScenario is None. Our change correctly allows custom logic to proceed to this vanilla validation checkpoint instead of being blocked prematurely. Plugins can still cancel an escape if they need to by subscribing to the Player.Escaping event and setting ev.IsAllowed = false within their own handler. This makes Exiled's event system a more interoperable framework.
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No this is fix
Other information:
Now Exiled is doing what Labapi did, so nothing gets broken.
https://discord.com/channels/656673194693885975/1376301959581007964
Types of changes
Submission checklist
Patches (if there are any changes related to Harmony patches)
Other
Exiled Event Location:
How does LabApi :