Skip to content

Commit b902c75

Browse files
committed
fix: add onPlayerCmd and onConsoleCmd event that was accidentally deleted.
1 parent e613497 commit b902c75

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.18.1] - 2026-04-13
11+
12+
### Fixed
13+
14+
- Added `onPlayerCmd` and `onConsoleCmd` event that was accidentally deleted.
15+
1016
## [0.18.0] - 2026-04-07
1117

1218
### Changed
@@ -1245,7 +1251,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12451251
[#353]: https://github.com/LiteLDev/LegacyScriptEngine/issues/353
12461252
[#358]: https://github.com/LiteLDev/LegacyScriptEngine/issues/358
12471253

1248-
[Unreleased]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.18.0...HEAD
1254+
[Unreleased]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.18.1...HEAD
1255+
[0.18.1]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.18.0...v0.18.1
12491256
[0.18.0]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.17.13...v0.18.0
12501257
[0.17.13]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.17.12...v0.17.13
12511258
[0.17.12]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.17.11...v0.17.12

src/legacy/api/EventAPI.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ void InitBasicEventListeners() {
842842
#ifndef LSE_BACKEND_NODEJS
843843
if (!ProcessDebugEngine(cmd)) {
844844
ev.cancel();
845+
return;
845846
}
846847
#endif
847848
#ifdef LSE_BACKEND_NODEJS
@@ -855,6 +856,24 @@ void InitBasicEventListeners() {
855856
return;
856857
}
857858
#endif
859+
IF_LISTENED(EVENT_TYPES::onConsoleCmd) {
860+
if (!CallEvent(EVENT_TYPES::onConsoleCmd, String::newString(cmd))) {
861+
ev.cancel();
862+
}
863+
}
864+
IF_LISTENED_END(EVENT_TYPES::onConsoleCmd);
865+
} else if (originType == CommandOriginType::Player) {
866+
std::string cmd = ev.commandContext().mCommand;
867+
if (cmd.starts_with("/")) {
868+
cmd.erase(0, 1);
869+
}
870+
Player* player = static_cast<Player*>(ev.commandContext().mOrigin->getEntity());
871+
IF_LISTENED(EVENT_TYPES::onPlayerCmd) {
872+
if (!CallEvent(EVENT_TYPES::onPlayerCmd, PlayerClass::newPlayer(player), String::newString(cmd))) {
873+
ev.cancel();
874+
}
875+
}
876+
IF_LISTENED_END(EVENT_TYPES::onPlayerCmd);
858877
}
859878
});
860879

tooth.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"format_version": 3,
33
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
44
"tooth": "github.com/LiteLDev/LegacyScriptEngine",
5-
"version": "0.18.0",
5+
"version": "0.18.1",
66
"info": {
77
"name": "LegacyScriptEngine",
88
"description": "A plugin engine for running LLSE plugins on LeviLamina",

0 commit comments

Comments
 (0)