Make MishapDisallowedSpell properly display the offending action #970
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.
MishapDisallowedSpell's current text (
has been disallowed by the server owners) is clearly designed to be placed after the name of the pattern that caused it, as happens with most mishaps, so you'd get something likeMind's Reflection: has been disallowed by the server owners.However, the name of the triggering pattern is obtained from the mishap context (here), and if the context doesn't have a stored name, you get nothing. MishapDisallowedSpell is thrown from
CastingEnvrionment.precheckAction(), which is called inPatternIota.execute()(here) before thecastedNamesupplier (defined 3 lines earlier) is changed to return something other than null.The result of all this is that the mishap context doesn't get a name, and thus the chat message you get when trying to cast something containing a disallowed pattern is just
has been disallowed by the server owners, with no explanation of what has been disallowed.This PR fixes that, changing the mishap message to properly display the name of the triggering action. Note that the name of the action is not pink, as in most mishaps, to make sure that in the edge case where it somehow does get thrown with a proper context (ie an addon manually throwing it somewhere) you don't get two pink names in a row.
