Ejemplo n.º 1
0
        public override void HandleResponse(JObject response)
        {
            if ((int)response["meta"]["next_check"] > 0)
            {
                Tebex.Instance.nextCheck = (int)response["meta"]["next_check"];
                //Tebex.Instance.nextCheck = 60;
            }

            if ((bool)response["meta"]["execute_offline"])
            {
                try
                {
                    TebexCommandRunner.doOfflineCommands();
                }
                catch (Exception e)
                {
                    Tebex.logError(e.ToString());
                }
            }

            JArray players = (JArray)response["players"];

            var onlinePlayers = MySession.Static.Players.GetOnlinePlayers();

            if (onlinePlayers.Count == 0)
            {
                return;
            }

            foreach (var player in players)
            {
                try
                {
                    ulong      steamId      = (ulong)player["uuid"];
                    long       identityId   = MySession.Static.Players.TryGetIdentityId(steamId);
                    MyIdentity targetPlayer = MySession.Static.Players.TryGetIdentity(identityId);

                    bool playerOnline = false;
                    foreach (var onlinePlr in onlinePlayers)
                    {
                        if (onlinePlr.Id.SteamId == steamId)
                        {
                            playerOnline = true;
                        }
                    }

                    if (playerOnline)
                    {
                        Tebex.logWarning("Execute commands for " + (string)targetPlayer.DisplayName + "(ID: " + steamId.ToString() + ")");
                        TebexCommandRunner.doOnlineCommands((int)player["id"], (string)targetPlayer.DisplayName,
                                                            steamId.ToString());
                    }
                }
                catch (Exception e)
                {
                    Tebex.logError(e.Message);
                }
            }
        }
Ejemplo n.º 2
0
 public override void HandleError(Exception e)
 {
     Tebex.logError("We are unable to fetch your server details. Please check your secret key.");
 }
Ejemplo n.º 3
0
 public override void HandleError(Exception e)
 {
     Tebex.logError("We were unable to validate your secret key.");
     Context.Respond("We were unable to validate your secret key.");
 }
Ejemplo n.º 4
0
 public override void HandleError(Exception e)
 {
     Tebex.logError("We are unable to fetch your server queue. Please check your secret key.");
     Tebex.logError(e.ToString());
 }