Skip to content

Commit 4b0660e

Browse files
committed
fix: fix event cancellation #199
1 parent 0d61ea6 commit 4b0660e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/legacy/api/EventAPI.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,11 @@ void InitBasicEventListeners() {
838838
}
839839

840840
// Other Cmd
841-
IF_LISTENED(EVENT_TYPES::onConsoleCmd) { CallEvent(EVENT_TYPES::onConsoleCmd, String::newString(cmd)); }
841+
IF_LISTENED(EVENT_TYPES::onConsoleCmd) {
842+
if (!CallEvent(EVENT_TYPES::onConsoleCmd, String::newString(cmd))) {
843+
ev.cancel();
844+
}
845+
}
842846
IF_LISTENED_END(EVENT_TYPES::onConsoleCmd);
843847
}
844848
} else if (ev.commandContext().mOrigin->getOriginType() == CommandOriginType::Player) {

0 commit comments

Comments
 (0)