Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MinecraftClient/Bots.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public override void Update()
count++;
if (count == timeping)
{
SendText("/ping");
SendText(Settings.AntiAFK_Text);
count = 0;
}
}
Expand Down
26 changes: 23 additions & 3 deletions MinecraftClient/MinecraftClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<Install>false</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
Expand All @@ -23,10 +24,11 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
Expand Down Expand Up @@ -59,6 +61,24 @@
<StartupObject>MinecraftClient.Program</StartupObject>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
<ManifestCertificateThumbprint>A031397043FB37471161CDFFE0D48E014EF30582</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>MinecraftClient_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup />
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.7.4114.6375, Culture=neutral, PublicKeyToken=0e99375e54769942">
<SpecificVersion>False</SpecificVersion>
Expand Down
2 changes: 1 addition & 1 deletion MinecraftClient/MinecraftClient.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<StartArguments>TestBot - localhost</StartArguments>
</PropertyGroup>
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<PublishUrlHistory>publish\|C:\Users\Robert\Desktop\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
Expand Down
9 changes: 7 additions & 2 deletions MinecraftClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,15 @@ private static void InitializeClient()
{
Console.WriteLine("Cannot connect to the server : This version is not supported !");
ReadLineReconnect();
Console.WriteLine("Waiting " + Settings.Retry_Delay + " seconds before reconnecting...");
System.Threading.Thread.Sleep(Settings.Retry_Delay * 1000); Restart();
}
}
else
{
Console.WriteLine("Failed to ping this IP.");
ReadLineReconnect();
Console.WriteLine("Waiting " + Settings.Retry_Delay + " seconds before reconnecting...");
System.Threading.Thread.Sleep(Settings.Retry_Delay * 1000); Restart();
}
}
else
Expand All @@ -266,7 +269,9 @@ private static void InitializeClient()
case MinecraftCom.LoginResult.Error: Console.WriteLine("Network error."); break;
}
while (Console.KeyAvailable) { Console.ReadKey(false); }
if (Settings.SingleCommand == "") { ReadLineReconnect(); }
if (Settings.SingleCommand == "") { Console.WriteLine("Waiting " + Settings.Retry_Delay + " seconds before reconnecting..."); }
{System.Threading.Thread.Sleep(Settings.Retry_Delay * 1000); Restart();
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion MinecraftClient/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ public static class Settings
public static string TranslationsFile_FromMCDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\.minecraft\assets\lang\en_US.lang";
public static string TranslationsFile = "translations.lang";
public static string Bots_OwnersFile = "bot-owners.txt";
public static int Retry_Delay = 10;

//AntiAFK Settings
public static bool AntiAFK_Enabled = false;
public static int AntiAFK_Delay = 600;
public static string AntiAFK_Text = "/ping";

//Hangman Settings
public static bool Hangman_Enabled = false;
Expand Down Expand Up @@ -116,6 +118,7 @@ public static void LoadSettings(string settingsfile)
case "login": Login = argValue; break;
case "password": Password = argValue; break;
case "serverip": ServerIP = argValue; break;
case "retry_delay": Retry_Delay = str2int(argValue); break;
case "singlecommand": SingleCommand = argValue; break;
case "translationsfile": TranslationsFile = argValue; break;
case "botownersfile": Bots_OwnersFile = argValue; break;
Expand All @@ -137,6 +140,7 @@ public static void LoadSettings(string settingsfile)
{
case "enabled": AntiAFK_Enabled = str2bool(argValue); break;
case "delay": AntiAFK_Delay = str2int(argValue); break;
case "text": AntiAFK_Text = argValue; break;
}
break;

Expand Down Expand Up @@ -194,7 +198,7 @@ public static void LoadSettings(string settingsfile)

public static void WriteDefaultSettings(string settingsfile)
{
System.IO.File.WriteAllText(settingsfile, "#Minecraft Console Client v" + Program.Version + "\r\n#Startup Config File\r\n\r\n[Main]\r\n\r\n#General settings\r\n#leave blank = prompt user on startup\r\n#Use \"-\" as password for offline mode\r\n\r\nlogin=\r\npassword=\r\nserverip=\r\n\r\n#Advanced settings\r\n\r\ntranslationsfile=translations.lang\r\nbotownersfile=bot-owners.txt\r\nconsoletitle=Minecraft Console Client\r\n\r\n#Bot Settings\r\n\r\n[Alerts]\r\nenabled=false\r\nalertsfile=alerts.txt\r\nexcludesfile=alerts-exclude.txt\r\n\r\n[AntiAFK]\r\nenabled=false\r\ndelay=600 #10 = 1s\r\n\r\n[AutoRelog]\r\nenabled=false\r\ndelay=10\r\nretries=3 #-1 = unlimited\r\nkickmessagesfile=kickmessages.txt\r\n\r\n[ChatLog]\r\nenabled=false\r\ntimestamps=true\r\nfilter=messages\r\nlogfile=chatlog.txt\r\n\r\n[Hangman]\r\nenabled=false\r\nenglish=true\r\nwordsfile=hangman-en.txt\r\nfichiermots=hangman-fr.txt\r\n\r\n[Scripting]\r\nenabled=false\r\nscriptfile=testscript.txt\r\n", Encoding.UTF8);
System.IO.File.WriteAllText(settingsfile, "#Minecraft Console Client v" + Program.Version + "\r\n#Startup Config File\r\n\r\n[Main]\r\n\r\n#General settings\r\n#leave blank = prompt user on startup\r\n#Use \"-\" as password for offline mode\r\n\r\nlogin=\r\npassword=\r\nserverip=\r\n\r\n#Advanced settings\r\n\r\ntranslationsfile=translations.lang\r\nbotownersfile=bot-owners.txt\r\nconsoletitle=Minecraft Console Client\r\nRetry_Delay=10 #Time to wait after login failure to retry in seconds\r\n\r\n#Bot Settings\r\n\r\n[Alerts]\r\nenabled=false\r\nalertsfile=alerts.txt\r\nexcludesfile=alerts-exclude.txt\r\n\r\n[AntiAFK]\r\nenabled=false\r\ndelay=600 #10 = 1s\r\ntext=/ping\r\n\r\n[AutoRelog]\r\nenabled=false\r\ndelay=10\r\nretries=3 #-1 = unlimited\r\nkickmessagesfile=kickmessages.txt\r\n\r\n[ChatLog]\r\nenabled=false\r\ntimestamps=true\r\nfilter=messages\r\nlogfile=chatlog.txt\r\n\r\n[Hangman]\r\nenabled=false\r\nenglish=true\r\nwordsfile=hangman-en.txt\r\nfichiermots=hangman-fr.txt\r\n\r\n[Scripting]\r\nenabled=false\r\nscriptfile=testscript.txt\r\n", Encoding.UTF8);
}

public static int str2int(string str) { try { return Convert.ToInt32(str); } catch { return 0; } }
Expand Down