yeow-api 0.2.105 → 0.2.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/server.ts +15 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -33,7 +33,9 @@ export {
|
|
|
33
33
|
broadcast, broadcastSync, dispatchCommand, dispatchCommandSync,
|
|
34
34
|
setMotd, setMotdSync, setIcon, setIconSync,
|
|
35
35
|
getMotd, getMotdSync, getVersion, getVersionSync,
|
|
36
|
+
getTps, getTpsSync,
|
|
36
37
|
} from './server.js';
|
|
38
|
+
export type { TpsInfo } from './server.js';
|
|
37
39
|
export {
|
|
38
40
|
fs,
|
|
39
41
|
readFile, readFileSync, readFileBase64, readFileBase64Sync,
|
package/src/server.ts
CHANGED
|
@@ -13,3 +13,18 @@ export function getMotd(options?: TaskOptions): Promise<string> { return post<st
|
|
|
13
13
|
export function getMotdSync(options?: TaskOptions): string { return call<string>('server.getMotd', {}, options); }
|
|
14
14
|
export function getVersion(options?: TaskOptions): Promise<string> { return post<string>('server.getVersion', {}, options); }
|
|
15
15
|
export function getVersionSync(options?: TaskOptions): string { return call<string>('server.getVersion', {}, options); }
|
|
16
|
+
|
|
17
|
+
export interface TpsInfo {
|
|
18
|
+
/** 最近 1 分钟平均 TPS。 */
|
|
19
|
+
tps1m: number;
|
|
20
|
+
/** 最近 5 分钟平均 TPS。 */
|
|
21
|
+
tps5m: number;
|
|
22
|
+
/** 最近 15 分钟平均 TPS。 */
|
|
23
|
+
tps15m: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 服务器 TPS。**跨平台不保证可用**(Paper 平台基于 `Bukkit.getTPS`;其他平台运行时不保证,
|
|
27
|
+
* 且未来 TPS 这一概念可能发生变化)——调用前需自行降级处理。
|
|
28
|
+
*/
|
|
29
|
+
export function getTps(options?: TaskOptions): Promise<TpsInfo> { return post<TpsInfo>('server.getTps', {}, options); }
|
|
30
|
+
export function getTpsSync(options?: TaskOptions): TpsInfo { return call<TpsInfo>('server.getTps', {}, options); }
|