Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
 protected static GameMode?GetCurrentGameModeCached(TMSPSPluginBase plugin)
 {
     return(CurrentGameMode ?? GetCurrentGameMode(plugin));
 }
Example #5
0
 protected static ServerOptions GetServerOptionsCached(TMSPSPluginBase plugin)
 {
     return(CurrentServerOptions ?? GetServerOptions(plugin));
 }