Skip to content

Commit

Permalink
fix: fix event cancellation #199
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Jan 5, 2025
1 parent 0d61ea6 commit 4b0660e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/legacy/api/EventAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,11 @@ void InitBasicEventListeners() {
}

// Other Cmd
IF_LISTENED(EVENT_TYPES::onConsoleCmd) { CallEvent(EVENT_TYPES::onConsoleCmd, String::newString(cmd)); }
IF_LISTENED(EVENT_TYPES::onConsoleCmd) {
if (!CallEvent(EVENT_TYPES::onConsoleCmd, String::newString(cmd))) {
ev.cancel();
}
}
IF_LISTENED_END(EVENT_TYPES::onConsoleCmd);
}
} else if (ev.commandContext().mOrigin->getOriginType() == CommandOriginType::Player) {
Expand Down

0 comments on commit 4b0660e

Please sign in to comment.