Hello,
i just found out some things and wanted to let you know about them 😁
Basically, when you execute:
/lockedcratetimer.conf CheckTimer
or
/lockedcratetimer.conf HackingSeconds
and you don't enter any value after that you get an IndexOutOfRangeException
Something like this, I've also added check if there is anything else after the args[1]
switch (args[0])
{
case "HackingSeconds":
// Check if there is args[1], check if there is anything after args[1]
if (args.Length < 2 || args.Length > 2 || string.IsNullOrEmpty(args[1]))
{
player.Reply("You must enter a valid value!");
return;
}
int time;
success = int.TryParse(args[1], out time);
if (success)
{
this.HackingSeconds = time;
Config["HackingSeconds"] = time;
SaveConfig();
player.Reply("success");
}
else
{
player.Reply("value must be an integer");
}
break;
case "CheckTimer":
// Check if there is args[1], check if there is anything after args[1]
if (args.Length < 2 || args.Length > 2 || string.IsNullOrEmpty(args[1]))
{
player.Reply("You must enter a valid value!");
return;
}
bool check;
success = bool.TryParse(args[1], out check);
if (success)
{
this.CheckTimer = check;
Config["CheckTimer"] = check;
SaveConfig();
player.Reply("success");
}
else
{
player.Reply("value must be true or false");
}
break;
default:
player.Reply(string.Format("Key '{0}' not found, try 'lockedcratetimer.conf list' to get a list of Config keys", args[0]));
break;