mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix null characters in chat prompt (old bug)
Sometimes null characters were inserted in chat prompt Rename "Scripting" bot into "Script" bot.
This commit is contained in:
parent
b0e4e993ce
commit
a543620a80
5 changed files with 23 additions and 14 deletions
|
|
@ -254,7 +254,7 @@ namespace MinecraftClient
|
|||
|
||||
protected void RunScript(string filename, string playername = "")
|
||||
{
|
||||
handler.BotLoad(new Bots.Scripting(filename, playername));
|
||||
handler.BotLoad(new Bots.Script(filename, playername));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -833,11 +833,9 @@ namespace MinecraftClient
|
|||
|
||||
/// <summary>
|
||||
/// Runs a list of commands
|
||||
/// Usage: bot:scripting:filename
|
||||
/// Script must be placed in the config directory
|
||||
/// </summary>
|
||||
|
||||
public class Scripting : ChatBot
|
||||
public class Script : ChatBot
|
||||
{
|
||||
private string file;
|
||||
private string[] lines = new string[0];
|
||||
|
|
@ -846,12 +844,12 @@ namespace MinecraftClient
|
|||
private int nextline = 0;
|
||||
private string owner;
|
||||
|
||||
public Scripting(string filename)
|
||||
public Script(string filename)
|
||||
{
|
||||
file = filename;
|
||||
}
|
||||
|
||||
public Scripting(string filename, string ownername)
|
||||
public Script(string filename, string ownername)
|
||||
:this(filename)
|
||||
{
|
||||
if (ownername != "")
|
||||
|
|
|
|||
|
|
@ -60,8 +60,11 @@ namespace MinecraftClient
|
|||
break;
|
||||
|
||||
default:
|
||||
Console.Write('*');
|
||||
password += k.KeyChar;
|
||||
if (k.KeyChar != 0)
|
||||
{
|
||||
Console.Write('*');
|
||||
password += k.KeyChar;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -159,7 +162,15 @@ namespace MinecraftClient
|
|||
}
|
||||
break;
|
||||
default:
|
||||
AddChar(k.KeyChar);
|
||||
if (k.KeyChar != 0)
|
||||
AddChar(k.KeyChar);
|
||||
/*
|
||||
reading_lock = false;
|
||||
WriteLine("CHAR: " + ((int)k.KeyChar));
|
||||
if (!System.IO.File.Exists("debug-chars.txt")) { System.IO.File.Create("debug-chars.txt"); }
|
||||
System.IO.File.AppendAllText("debug-chars.txt", "'" + k.KeyChar + "' " + ((int)k.KeyChar) + "\r\n");
|
||||
reading_lock = true;
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ namespace MinecraftClient
|
|||
}
|
||||
else if (text.ToLower().StartsWith("/script "))
|
||||
{
|
||||
handler.BotLoad(new Bots.Scripting(text.Substring(8)));
|
||||
handler.BotLoad(new Bots.Script(text.Substring(8)));
|
||||
}
|
||||
else if (text != "")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -597,12 +597,12 @@ namespace MinecraftClient
|
|||
catch (ObjectDisposedException) { }
|
||||
|
||||
foreach (ChatBot bot in bots)
|
||||
if (bot is Bots.Scripting)
|
||||
scripts_on_hold.Add((Bots.Scripting)bot);
|
||||
if (bot is Bots.Script)
|
||||
scripts_on_hold.Add((Bots.Script)bot);
|
||||
}
|
||||
|
||||
private List<ChatBot> bots = new List<ChatBot>();
|
||||
private static List<Bots.Scripting> scripts_on_hold = new List<Bots.Scripting>();
|
||||
private static List<Bots.Script> scripts_on_hold = new List<Bots.Script>();
|
||||
public void BotLoad(ChatBot b) { b.SetHandler(this); bots.Add(b); b.Initialize(); Settings.SingleCommand = ""; }
|
||||
public void BotUnLoad(ChatBot b) { bots.RemoveAll(item => object.ReferenceEquals(item, b)); }
|
||||
public void BotClear() { bots.Clear(); }
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ namespace MinecraftClient
|
|||
if (Settings.ChatLog_Enabled) { handler.BotLoad(new Bots.ChatLog(Settings.ChatLog_File, Settings.ChatLog_Filter, Settings.ChatLog_DateTime)); }
|
||||
if (Settings.PlayerLog_Enabled) { handler.BotLoad(new Bots.PlayerListLogger(Settings.PlayerLog_Delay, Settings.PlayerLog_File)); }
|
||||
if (Settings.AutoRelog_Enabled) { handler.BotLoad(new Bots.AutoRelog(Settings.AutoRelog_Delay, Settings.AutoRelog_Retries)); }
|
||||
if (Settings.StartupScript_Enabled) { handler.BotLoad(new Bots.Scripting(Settings.StartupScript_ScriptFile)); Settings.StartupScript_Enabled = false; }
|
||||
if (Settings.StartupScript_Enabled) { handler.BotLoad(new Bots.Script(Settings.StartupScript_ScriptFile)); Settings.StartupScript_Enabled = false; }
|
||||
if (Settings.RemoteCtrl_Enabled){ handler.BotLoad(new Bots.RemoteControl()); }
|
||||
|
||||
//Start the main TCP client
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue