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)); } }
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); } }
public override StatsComponent CreateStatsComp() { GD.PrintS("i am called. name is: "); StatReader.ReadStats(StatsFilePath); return(new StatsComponent()); }