mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add some features of command logging
This commit is contained in:
parent
cd3b6a0845
commit
bdf37e427c
2 changed files with 19 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars)
|
public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(command);
|
||||||
if (sneaking)
|
if (sneaking)
|
||||||
{
|
{
|
||||||
var result = handler.sendEntityAction(Protocol.ActionType.StopSneaking);
|
var result = handler.sendEntityAction(Protocol.ActionType.StopSneaking);
|
||||||
|
|
|
||||||
|
|
@ -325,6 +325,7 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
while (true);
|
while (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform an internal MCC command (not a server command, use SendText() instead for that!)
|
/// Perform an internal MCC command (not a server command, use SendText() instead for that!)
|
||||||
|
|
@ -335,6 +336,7 @@ namespace MinecraftClient
|
||||||
/// <returns>TRUE if the command was indeed an internal MCC command</returns>
|
/// <returns>TRUE if the command was indeed an internal MCC command</returns>
|
||||||
public bool PerformInternalCommand(string command, ref string response_msg, Dictionary<string, object> localVars = null)
|
public bool PerformInternalCommand(string command, ref string response_msg, Dictionary<string, object> localVars = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Load commands from the 'Commands' namespace */
|
/* Load commands from the 'Commands' namespace */
|
||||||
|
|
||||||
if (cmds.Count == 0)
|
if (cmds.Count == 0)
|
||||||
|
|
@ -383,12 +385,28 @@ namespace MinecraftClient
|
||||||
else if (cmds.ContainsKey(command_name))
|
else if (cmds.ContainsKey(command_name))
|
||||||
{
|
{
|
||||||
response_msg = cmds[command_name].Run(this, command, localVars);
|
response_msg = cmds[command_name].Run(this, command, localVars);
|
||||||
|
foreach (ChatBot bot in bots.ToArray())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bot.OnInternalCommand(command_name, response_msg);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
if (!(e is ThreadAbortException))
|
||||||
|
{
|
||||||
|
ConsoleIO.WriteLogLine("OnInternalCommand: Got error from " + bot.ToString() + ": " + e.ToString());
|
||||||
|
}
|
||||||
|
else throw; //ThreadAbortException should not be caught
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
response_msg = "Unknown command '" + command_name + "'. Use '" + (Settings.internalCmdChar == ' ' ? "" : "" + Settings.internalCmdChar) + "help' for help.";
|
response_msg = "Unknown command '" + command_name + "'. Use '" + (Settings.internalCmdChar == ' ' ? "" : "" + Settings.internalCmdChar) + "help' for help.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue