UNPKG

jsplanet

Version:

A controller for Trackmania 2020 dedicated server.

58 lines (57 loc) 2.19 kB
class ServerManager { remote; constructor(remote) { this.remote = remote; } async getModeScriptSettings() { const [settings] = await this.remote.callMethod("GetModeScriptSettings"); return settings; } async getModeScriptText() { const [scriptText] = await this.remote.callMethod("GetModeScriptText"); return scriptText; } async getPassword() { const [password] = await this.remote.callMethod("GetServerPassword"); return password; } async getScriptName() { const [scriptName] = await this.remote.callMethod("GetScriptName"); return { current: scriptName.CurrentValue, next: scriptName.NextValue }; } async getSpectatorPassword() { const [password] = await this.remote.callMethod("GetServerPasswordForSpectator"); return password; } async pause() { const [_, response] = await this.remote.callMethod("TriggerModeScriptEventArray", "Maniaplanet.Pause.SetActive", ["true"]); const [pauseStatus] = await response; return pauseStatus; } async resume() { const [_, response] = await this.remote.callMethod("TriggerModeScriptEventArray", "Maniaplanet.Pause.SetActive", ["false"]); const [pauseStatus] = await response; return pauseStatus; } async setModeScriptSettings(settings) { const [isSuccess] = await this.remote.callMethod("SetModeScriptSettings", settings); return isSuccess; } async setModeScriptText(scriptText) { const [isSuccess] = await this.remote.callMethod("SetModeScriptText", scriptText); return isSuccess; } async setPassword(password) { const [isSuccess] = await this.remote.callMethod("SetServerPassword", password); return isSuccess; } async setScriptName(scriptName) { const [isSuccess] = await this.remote.callMethod("SetScriptName", scriptName); return isSuccess; } async setSpectatorPassword(password) { const [isSucess] = await this.remote.callMethod("SetServerPasswordForSpectator", password); return isSucess; } } export default ServerManager;