Пример #1
0
        public async Task Minecraft(CommandContext ctx, [Description("IP of the server")] string ip)
        {
            if (ctx.Channel.Get(ConfigManager.Enabled)
                .And(ctx.Channel.GetMethodEnabled()))
            {
                await ctx.TriggerTypingAsync();

                string[] parsedIp = ip.Split(':');
                ushort   port     = parsedIp.Length == 1 ? (ushort)25565 : ushort.Parse(parsedIp[1]);
                await ctx.RespondAsyncFix(StatReader.ReadStat(parsedIp[0], port));
            }
        }
Пример #2
0
        public void LoadStatsFromFile(string path)
        {
            StatReader reader = new StatReader(_engine);
            JArray     json   = FileHandler.FromPath <JArray>(path);

            foreach (JToken entry in json)
            {
                if (entry.Type != JTokenType.Object)
                {
                    throw new MeException($"Expected a json object \"{path}\"at  \"{entry}\".");
                }

                StatTemplate newEntry = reader.FromJson(entry.ToObject <JObject>());
                AddStat(newEntry);
            }
        }
Пример #3
0
 public override StatsComponent CreateStatsComp()
 {
     GD.PrintS("i am called. name is: ");
     StatReader.ReadStats(StatsFilePath);
     return(new StatsComponent());
 }