mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
App refactoring almost done
- Created specific namespaces and folders for each app brick - Added proxy support using Starksoft's Biko Library - App bricks: Main, ChatBots, Crypto, Protocol, Proxy - Each class is now in its own file (Aes streams, chatbots) - Used "Bridge" design pattern for Crypto, Protocol, Proxy - Added back support for Minecraft 1.4.6 to 1.6.4 (MCC 1.6.2) - Need to fully re-test everything and fix bugs - To Fix : Server pinging is slow on SpigotMC - To Do : Add Minecraft 1.2.5 (MCC 1.3) and maybe 1.3 to 1.4.5
This commit is contained in:
parent
9be1d99ca0
commit
d2ec2f48b7
43 changed files with 6039 additions and 2178 deletions
53
MinecraftClient/ChatBots/PlayerListLogger.cs
Normal file
53
MinecraftClient/ChatBots/PlayerListLogger.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MinecraftClient.ChatBots
|
||||
{
|
||||
/// <summary>
|
||||
/// This bot sends a /list command every X seconds and save the result.
|
||||
/// </summary>
|
||||
|
||||
public class PlayerListLogger : ChatBot
|
||||
{
|
||||
private int count;
|
||||
private int timeping;
|
||||
private string file;
|
||||
|
||||
/// <summary>
|
||||
/// This bot sends a /list command every X seconds and save the result.
|
||||
/// </summary>
|
||||
/// <param name="pingparam">Time amount between each list ping (10 = 1s, 600 = 1 minute, etc.)</param>
|
||||
|
||||
public PlayerListLogger(int pingparam, string filetosavein)
|
||||
{
|
||||
count = 0;
|
||||
file = filetosavein;
|
||||
timeping = pingparam;
|
||||
if (timeping < 10) { timeping = 10; } //To avoid flooding
|
||||
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
count++;
|
||||
if (count == timeping)
|
||||
{
|
||||
SendText("/list");
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetText(string text)
|
||||
{
|
||||
if (text.Contains("Joueurs en ligne") || text.Contains("Connected:") || text.Contains("online:"))
|
||||
{
|
||||
LogToConsole("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" + getVerbatim(text) + "\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue