Skip to content

Commit 5cf54ef

Browse files
committed
refactor: delay onServerStarted
1 parent 17742bf commit 5cf54ef

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [0.10.1] - 2025-03-16
1111

12+
### Changed
13+
14+
- Synced [ScriptX](https://github.com/LiteLDev/ScriptX) with upstream
15+
- Delay onServerStarted for 1 tick to fix compatibility with old plugins(e.g. LLSE-FakePlayer)
16+
- Show error when loading plugins failed [#240] @xiaoqch
17+
1218
### Fixed
1319

1420
- Fixed DefaultDataLoadHelper
@@ -793,6 +799,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
793799
[#227]: https://github.com/LiteLDev/LegacyScriptEngine/issues/227
794800
[#231]: https://github.com/LiteLDev/LegacyScriptEngine/issues/231
795801
[#236]: https://github.com/LiteLDev/LegacyScriptEngine/issues/236
802+
[#240]: https://github.com/LiteLDev/LegacyScriptEngine/issues/240
796803
[#243]: https://github.com/LiteLDev/LegacyScriptEngine/issues/243
797804
[#249]: https://github.com/LiteLDev/LegacyScriptEngine/issues/249
798805
[#251]: https://github.com/LiteLDev/LegacyScriptEngine/issues/251

src/legacy/api/EventAPI.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -849,12 +849,16 @@ void InitBasicEventListeners() {
849849
}
850850
});
851851

852+
using namespace ll::chrono_literals;
852853
// ===== onServerStarted =====
853854
bus.emplaceListener<ServerStartedEvent>([](ServerStartedEvent&) {
854-
IF_LISTENED(EVENT_TYPES::onServerStarted) {
855-
CallEvent(EVENT_TYPES::onServerStarted); // Not cancellable
856-
}
857-
IF_LISTENED_END(EVENT_TYPES::onServerStarted);
855+
ll::coro::keepThis([]() -> ll::coro::CoroTask<> {
856+
co_await 1_tick;
857+
IF_LISTENED(EVENT_TYPES::onServerStarted) {
858+
CallEvent(EVENT_TYPES::onServerStarted); // Not cancellable
859+
}
860+
IF_LISTENED_END(EVENT_TYPES::onServerStarted);
861+
}).launch(ll::thread::ServerThreadExecutor::getDefault());
858862

859863
isCmdRegisterEnabled = true;
860864

@@ -863,8 +867,6 @@ void InitBasicEventListeners() {
863867

864868
// 植入tick
865869
ll::coro::keepThis([]() -> ll::coro::CoroTask<> {
866-
using namespace ll::chrono_literals;
867-
868870
while (true) {
869871
co_await 1_tick;
870872

0 commit comments

Comments
 (0)