File tree Expand file tree Collapse file tree 5 files changed +26
-17
lines changed Expand file tree Collapse file tree 5 files changed +26
-17
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @carbonhost/typescript" ,
3- "version" : " 0.0.45 " ,
3+ "version" : " 0.0.46 " ,
44 "main" : " dist/index.js" ,
55 "module" : " dist/index.mjs" ,
66 "types" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change 11
22import type { AxiosInstance } from "axios" ;
3- import type { CarbonStarStats } from "../types/stats " ;
3+ import type { CarbonPluginInfo , CarbonStarStats } from "../types/carbon-plugin " ;
44import type { CarbonStar } from "../carbon-star" ;
55import type { CarbonPluginCommandResponse } from "../carbon-plugin/types" ;
66
@@ -26,13 +26,7 @@ export class MinecraftManager {
2626 } ) . then ( ( res ) => res . data ) ;
2727 }
2828
29- // TODO: Make this ping the `/` endpoint
30- async isCarbonPluginInstalled ( ) {
31- try {
32- await this . axios . get ( "/commands?query=carbon" ) ;
33- return true ;
34- } catch ( e ) {
35- return false ;
36- }
29+ async getInfo ( ) {
30+ return this . axios . get < CarbonPluginInfo > ( "/carbon-plugin" ) . then ( ( res ) => res . data ) ;
3731 }
3832}
Original file line number Diff line number Diff line change 11
22import type { AxiosInstance } from "axios" ;
33import type { CarbonStar } from "../carbon-star" ;
4- import type { CarbonStarStats } from "../types/stats " ;
4+ import type { CarbonStarStats } from "../types/carbon-plugin " ;
55
66export class StatManager {
77 // @ts -ignore
Original file line number Diff line number Diff line change 1+ export interface CarbonStarStats {
2+ onlinePlayers : number
3+ ramUsage : number
4+ cpuUsage : number
5+ timestamp : Date
6+ }
7+
8+ export interface CarbonPluginInfo {
9+ tps : number
10+ mspt : number
11+ resources : {
12+ ramUsage : number
13+ ramTotal : number
14+ cpuUsage : number
15+ cpuCores : number
16+ }
17+ playerCountInfo : {
18+ onlinePlayers : number
19+ maxPlayers : number
20+ }
21+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments