mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix all warnings & Trim (#2226)
* Fix AutoFishing crash * Fix all warnings * Remove DotNetZip. * Fix the usage of HttpClient.
This commit is contained in:
parent
4aa6c1c99f
commit
1d52d1eadd
227 changed files with 2201 additions and 43564 deletions
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace MinecraftClient.ChatBots
|
||||
{
|
||||
|
|
@ -13,8 +11,8 @@ namespace MinecraftClient.ChatBots
|
|||
public class PlayerListLogger : ChatBot
|
||||
{
|
||||
private int count;
|
||||
private int timeping;
|
||||
private string file;
|
||||
private readonly int timeping;
|
||||
private readonly string file;
|
||||
|
||||
/// <summary>
|
||||
/// This bot sends a /list command every X seconds and save the result.
|
||||
|
|
@ -35,24 +33,14 @@ namespace MinecraftClient.ChatBots
|
|||
count++;
|
||||
if (count == timeping)
|
||||
{
|
||||
string[] playerList = GetOnlinePlayers();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < playerList.Length; i++)
|
||||
{
|
||||
sb.Append(playerList[i]);
|
||||
|
||||
// Do not add a comma after the last username
|
||||
if (i != playerList.Length - 1)
|
||||
sb.Append(", ");
|
||||
}
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
LogDebugToConsole("Saving Player List");
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
string TimeStamp = "[" + now.Year + '/' + now.Month + '/' + now.Day + ' ' + now.Hour + ':' + now.Minute + ']';
|
||||
System.IO.File.AppendAllText(file, TimeStamp + "\n" + sb.ToString() + "\n\n");
|
||||
StringBuilder sb = new();
|
||||
sb.AppendLine(string.Format("[{0}/{1}/{2} {3}:{4}]", now.Year, now.Month, now.Day, now.Hour, now.Minute));
|
||||
sb.AppendLine(string.Join(", ", GetOnlinePlayers())).AppendLine();
|
||||
System.IO.File.AppendAllText(file, sb.ToString());
|
||||
|
||||
count = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue