protected static GameMode?GetCurrentGameMode(TMSPSPluginBase plugin) { GenericResponse <int> currentGameModeResponse = plugin.Context.RPCClient.Methods.GetGameMode(); if (currentGameModeResponse.Erroneous) { plugin.Logger.Error("Error getting current game mode: " + currentGameModeResponse.Fault.FaultMessage); plugin.Logger.ErrorToUI("An error occured during current game mode retrieval!"); return(null); } CurrentGameMode = (GameMode?)currentGameModeResponse.Value; return(CurrentGameMode); }
protected static ServerOptions GetServerOptions(TMSPSPluginBase plugin) { GenericResponse <ServerOptions> serverOptionsResponse = plugin.Context.RPCClient.Methods.GetServerOptions(); if (serverOptionsResponse.Erroneous) { plugin.Logger.Error("Error getting server options: " + serverOptionsResponse.Fault.FaultMessage); plugin.Logger.ErrorToUI("An error occured during server options retrieval!"); return(null); } CurrentServerOptions = serverOptionsResponse.Value; return(serverOptionsResponse.Value); }
protected static List <PlayerInfo> GetPlayerList(TMSPSPluginBase plugin) { GenericListResponse <PlayerInfo> playersResponse = plugin.Context.RPCClient.Methods.GetPlayerList(); if (playersResponse.Erroneous) { plugin.Logger.Error("Error getting PlayerList: " + playersResponse.Fault.FaultMessage); plugin.Logger.ErrorToUI("An error occured during player list retrieval!"); return(null); } foreach (PlayerInfo playerInfo in playersResponse.Value) { plugin.GetPlayerSettings(playerInfo.Login, true).UpdateFromPlayerInfo(playerInfo); } return(playersResponse.Value); }
protected static GameMode?GetCurrentGameModeCached(TMSPSPluginBase plugin) { return(CurrentGameMode ?? GetCurrentGameMode(plugin)); }
protected static ServerOptions GetServerOptionsCached(TMSPSPluginBase plugin) { return(CurrentServerOptions ?? GetServerOptions(plugin)); }