Skip to content

Ignore chat triggers for interactive ban reason#2067

Merged
peace-maker merged 2 commits intoalliedmodders:masterfrom
Rainyan:bug/abortban
Oct 16, 2023
Merged

Ignore chat triggers for interactive ban reason#2067
peace-maker merged 2 commits intoalliedmodders:masterfrom
Rainyan:bug/abortban

Conversation

@Rainyan
Copy link
Contributor

@Rainyan Rainyan commented Oct 15, 2023

If the admin types a chat trigger for a command while BaseBans is waiting for them to type a ban reason, don't treat that message as the ban reason.

This change fixes a problem where an admin decides to cancel their ban with sm_abortban, by invoking it via a chat trigger (!abortban, /abortban, etc), but ends up accidentally banning the player with the ban reason !abortban (or by attempting to access any other command via a chat trigger while the basebans chat listener was expecting to receive the ban reason).

Steps to reproduce

Admin decides to cancel the ban, point of view:
abortban_example1

It feels like substituting the "sm_command" with the "!command" chat trigger should work here. However:

The unfortunate player point of view (banned with reason "!abortban"):
abortban_example2

You can attempt to ban yourself to test this behaviour.

After this change

After this commit, any chat trigger messages are ignored for the interactive ban reason, so things like !abortban will work.

If the admin types a chat trigger for a command while BaseBans is
waiting for them to type a ban reason, don't treat that message as the
ban reason.

This fixes a problem where the admin decides to cancel their ban with
"!abortban", "/abortban" etc, but ends up accidentally banning the
player with the ban reason "!abortban" (or by attempting to access any
other command via a chat trigger before typing the ban reason).
Check if we're actually waiting for chat reason before calling the native
Copy link
Member

@asherkin asherkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great little quality of life improvement 👍

@peace-maker peace-maker merged commit 8938a29 into alliedmodders:master Oct 16, 2023
@Rainyan Rainyan deleted the bug/abortban branch October 16, 2023 18:22
psychonic pushed a commit that referenced this pull request Jun 22, 2024
* Ignore chat triggers for interactive ban reason

If the admin types a chat trigger for a command while BaseBans is
waiting for them to type a ban reason, don't treat that message as the
ban reason.

This fixes a problem where the admin decides to cancel their ban with
"!abortban", "/abortban" etc, but ends up accidentally banning the
player with the ban reason "!abortban" (or by attempting to access any
other command via a chat trigger before typing the ban reason).

* Optimize

Check if we're actually waiting for chat reason before calling the native
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants