添加onServerStopping事件
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
#include "Global.h"
|
||||
#include "ll/api/service/Bedrock.h"
|
||||
#include "magic_enum.hpp"
|
||||
#include "mc/deps/core/string/HashedString.h"
|
||||
#include "mc/world/effect/MobEffect.h"
|
||||
#include <regex>
|
||||
|
||||
bool isInteger(const std::string& str) {
|
||||
|
||||
@@ -314,6 +314,17 @@ void Export_Event_API() {
|
||||
);
|
||||
return true;
|
||||
}
|
||||
case doHash("onServerStopping"): {
|
||||
auto Call = RemoteCall::importAs<bool()>(eventName, eventId);
|
||||
eventBus->emplaceListener<ll::event::server::ServerStoppingEvent>(
|
||||
[Call](ll::event::server::ServerStoppingEvent& ev) {
|
||||
try {
|
||||
Call();
|
||||
} catch (...) {}
|
||||
}
|
||||
);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user