2014-06-18 13:32:17 +02:00
|
|
|
|
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%."; } }
|
|
|
|
|
|
|
2020-06-20 15:01:16 +02:00
|
|
|
|
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
2014-06-18 13:32:17 +02:00
|
|
|
|
{
|
|
|
|
|
|
if (hasArg(command))
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] temp = getArg(command).Split('=');
|
|
|
|
|
|
if (temp.Length > 1)
|
|
|
|
|
|
{
|
2015-06-20 22:58:18 +02:00
|
|
|
|
if (Settings.SetVar(temp[0], getArg(command).Substring(temp[0].Length + 1)))
|
2014-06-18 13:32:17 +02:00
|
|
|
|
{
|
|
|
|
|
|
return ""; //Success
|
|
|
|
|
|
}
|
|
|
|
|
|
else return "variable name must be A-Za-z0-9.";
|
|
|
|
|
|
}
|
|
|
|
|
|
else return CMDDesc;
|
|
|
|
|
|
}
|
|
|
|
|
|
else return CMDDesc;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|