添加onServerStopping事件
This commit is contained in:
Vendored
+8
@@ -240,4 +240,12 @@ declare class Event {
|
|||||||
containerId: number
|
containerId: number
|
||||||
) => void
|
) => void
|
||||||
): boolean;
|
): boolean;
|
||||||
|
|
||||||
|
/** 关闭服务器(不可拦截) */
|
||||||
|
static listen(
|
||||||
|
/** 事件名 */
|
||||||
|
event: "onServerStopping",
|
||||||
|
/** 回调函数 */
|
||||||
|
listener: () => void
|
||||||
|
): boolean;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
/// <reference path='d:/dts/dts/helperlib/src/index.d.ts'/>
|
|
||||||
|
|
||||||
/** LRCA导出接口 */
|
/** LRCA导出接口 */
|
||||||
const GMLIB_API = {
|
const GMLIB_API = {
|
||||||
/** 创建悬浮字 @type {function(FloatPos,string,boolean):number} */
|
/** 创建悬浮字 @type {function(FloatPos,string,boolean):number} */
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
#include "Global.h"
|
#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>
|
#include <regex>
|
||||||
|
|
||||||
bool isInteger(const std::string& str) {
|
bool isInteger(const std::string& str) {
|
||||||
|
|||||||
@@ -314,6 +314,17 @@ void Export_Event_API() {
|
|||||||
);
|
);
|
||||||
return true;
|
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:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user