Corrects a issue with the commands system not using the override min args value leading to crashs if you did not send the correct args.
This commit is contained in:
parent
e1e40b161c
commit
349fc6299f
5 changed files with 13 additions and 15 deletions
|
|
@ -10,9 +10,7 @@ namespace BetterSecondBotShared.API
|
||||||
public abstract class API_interface
|
public abstract class API_interface
|
||||||
{
|
{
|
||||||
public string CommandName { get { return GetType().Name.ToLowerInvariant(); } }
|
public string CommandName { get { return GetType().Name.ToLowerInvariant(); } }
|
||||||
|
public virtual int Min_Required_args { get { return 0; } }
|
||||||
protected int min_required_args;
|
|
||||||
public int Min_Required_args { get { return min_required_args; } }
|
|
||||||
public virtual string Helpfile { get { return "No help given"; } }
|
public virtual string Helpfile { get { return "No help given"; } }
|
||||||
public virtual string[] ArgTypes { get { return new string[] { }; } }
|
public virtual string[] ArgTypes { get { return new string[] { }; } }
|
||||||
public virtual string[] ArgHints { get { return new string[] { }; } }
|
public virtual string[] ArgHints { get { return new string[] { }; } }
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace BetterSecondBot.HttpServer.Control.Interface
|
||||||
public override string[] ArgHints { get { return new [] { "Command","Args (~#~ split)" }; } }
|
public override string[] ArgHints { get { return new [] { "Command","Args (~#~ split)" }; } }
|
||||||
public override string Helpfile { get { return "Calls the Commands interface via HTTP (returns OK if not rejected)"; } }
|
public override string Helpfile { get { return "Calls the Commands interface via HTTP (returns OK if not rejected)"; } }
|
||||||
|
|
||||||
protected new int min_required_args = 2;
|
public override int Min_Required_args { get { return 2; } }
|
||||||
|
|
||||||
public override string[] CallFunction(string[] args)
|
public override string[] CallFunction(string[] args)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ namespace BSB.Commands
|
||||||
|
|
||||||
public abstract class ParcelCommand_RequirePerms_1arg : ParcelCommand_RequirePerms
|
public abstract class ParcelCommand_RequirePerms_1arg : ParcelCommand_RequirePerms
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 1;
|
public override int Min_Required_args { get { return 1; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class ParcelCommand_CheckParcel_1arg : ParcelCommand_CheckParcel
|
public abstract class ParcelCommand_CheckParcel_1arg : ParcelCommand_CheckParcel
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 1;
|
public override int Min_Required_args { get { return 1; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class ParcelCommand_RequirePerms : ParcelCommand_CheckParcel
|
public abstract class ParcelCommand_RequirePerms : ParcelCommand_CheckParcel
|
||||||
|
|
|
||||||
|
|
@ -273,19 +273,19 @@ namespace BSB.Commands
|
||||||
|
|
||||||
public abstract class CoreCommand_1arg : CoreCommand
|
public abstract class CoreCommand_1arg : CoreCommand
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 1;
|
public override int Min_Required_args { get { return 1; } }
|
||||||
}
|
}
|
||||||
public abstract class CoreCommand_2arg : CoreCommand
|
public abstract class CoreCommand_2arg : CoreCommand
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 2;
|
public override int Min_Required_args { get { return 2; } }
|
||||||
}
|
}
|
||||||
public abstract class CoreCommand_3arg : CoreCommand
|
public abstract class CoreCommand_3arg : CoreCommand
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 3;
|
public override int Min_Required_args { get { return 3; } }
|
||||||
}
|
}
|
||||||
public abstract class CoreCommand_4arg : CoreCommand
|
public abstract class CoreCommand_4arg : CoreCommand
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 4;
|
public override int Min_Required_args { get { return 4; } }
|
||||||
}
|
}
|
||||||
public abstract class CoreCommand_SmartReply_1arg : CoreCommand_1arg
|
public abstract class CoreCommand_SmartReply_1arg : CoreCommand_1arg
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -58,19 +58,19 @@ namespace BSB.RLV
|
||||||
}
|
}
|
||||||
public abstract class RLV_command_1arg : RLV_command
|
public abstract class RLV_command_1arg : RLV_command
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 1;
|
public override int Min_Required_args { get { return 1; } }
|
||||||
}
|
}
|
||||||
public abstract class RLV_command_2arg : RLV_command
|
public abstract class RLV_command_2arg : RLV_command
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 2;
|
public override int Min_Required_args { get { return 2; } }
|
||||||
}
|
}
|
||||||
public abstract class RLV_command_3arg : RLV_command
|
public abstract class RLV_command_3arg : RLV_command
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 3;
|
public override int Min_Required_args { get { return 3; } }
|
||||||
}
|
}
|
||||||
public abstract class RLV_command_4arg : RLV_command
|
public abstract class RLV_command_4arg : RLV_command
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 4;
|
public override int Min_Required_args { get { return 4; } }
|
||||||
}
|
}
|
||||||
public abstract class RLV_command : API_interface
|
public abstract class RLV_command : API_interface
|
||||||
{
|
{
|
||||||
|
|
@ -141,7 +141,7 @@ namespace BSB.RLV
|
||||||
|
|
||||||
public abstract class RLV_UUID_flag_4arg_yn : RLV_UUID_flag_optional_arg_yn
|
public abstract class RLV_UUID_flag_4arg_yn : RLV_UUID_flag_optional_arg_yn
|
||||||
{
|
{
|
||||||
protected new int min_required_args = 4;
|
public override int Min_Required_args { get { return 4; } }
|
||||||
public override string Helpfile { get { return "[Class helpfile] RLV / 4arg"; } }
|
public override string Helpfile { get { return "[Class helpfile] RLV / 4arg"; } }
|
||||||
public override string[] ArgTypes { get { return new[] { "Unknown", "Unknown", "Unknown", "Unknown" }; } }
|
public override string[] ArgTypes { get { return new[] { "Unknown", "Unknown", "Unknown", "Unknown" }; } }
|
||||||
public override string[] ArgHints { get { return new[] { "Unknown", "Unknown", "Unknown", "Unknown" }; } }
|
public override string[] ArgHints { get { return new[] { "Unknown", "Unknown", "Unknown", "Unknown" }; } }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue