From 6505fcccb30d5b9197d527c45d3875d90b666b52 Mon Sep 17 00:00:00 2001 From: ORelio Date: Wed, 15 Mar 2017 19:14:58 +0100 Subject: [PATCH] Add 'Debug' command for toggling debug messages See #223 --- MinecraftClient/Commands/Debug.cs | 23 +++++++++++++++++++++++ MinecraftClient/MinecraftClient.csproj | 1 + MinecraftClient/config/README.txt | 1 + 3 files changed, 25 insertions(+) create mode 100644 MinecraftClient/Commands/Debug.cs diff --git a/MinecraftClient/Commands/Debug.cs b/MinecraftClient/Commands/Debug.cs new file mode 100644 index 00000000..5ce70646 --- /dev/null +++ b/MinecraftClient/Commands/Debug.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace MinecraftClient.Commands +{ + public class Debug : Command + { + public override string CMDName { get { return "debug"; } } + public override string CMDDesc { get { return "debug [on|off]: toggle debug messages."; } } + + public override string Run(McTcpClient handler, string command) + { + if (hasArg(command)) + { + Settings.DebugMessages = (getArg(command).ToLower() == "on"); + } + else Settings.DebugMessages = !Settings.DebugMessages; + return "Debug messages are now " + (Settings.DebugMessages ? "ON" : "OFF"); + } + } +} diff --git a/MinecraftClient/MinecraftClient.csproj b/MinecraftClient/MinecraftClient.csproj index 66f79230..9828e0ba 100644 --- a/MinecraftClient/MinecraftClient.csproj +++ b/MinecraftClient/MinecraftClient.csproj @@ -87,6 +87,7 @@ + diff --git a/MinecraftClient/config/README.txt b/MinecraftClient/config/README.txt index c763b597..186064b5 100644 --- a/MinecraftClient/config/README.txt +++ b/MinecraftClient/config/README.txt @@ -67,6 +67,7 @@ In scripts and remote control, no slash is needed to perform the command. - set varname=value : set a value which can be used as %varname% in further commands - wait