Minecraft-Console-Client/MinecraftClient/Commands/Set.cs
ORelio 3ce91188c7 Add support for C# scripts in scripting bot
- Now scripts can also be written in C#
- C# scripts can access ChatBot API
- Add more methods in ChatBot API
- Add an example of C# script file
- Coding style fixes: method names ucfirst
2015-06-20 22:58:18 +02:00

31 lines
953 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MinecraftClient.Commands
{
public class Set : Command
{
public override string CMDName { get { return "set"; } }
public override string CMDDesc { get { return "set varname=value: set a custom %variable%."; } }
public override string Run(McTcpClient handler, string command)
{
if (hasArg(command))
{
string[] temp = getArg(command).Split('=');
if (temp.Length > 1)
{
if (Settings.SetVar(temp[0], getArg(command).Substring(temp[0].Length + 1)))
{
return ""; //Success
}
else return "variable name must be A-Za-z0-9.";
}
else return CMDDesc;
}
else return CMDDesc;
}
}
}