Core/Commands: Change way we handle optional args. Fixes #43
This commit is contained in:
@@ -87,7 +87,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("create", CypherStrings.CommandAccCreateHelp, RBACPermissions.CommandAccountCreate, true)]
|
||||
static bool HandleAccountCreateCommand(CommandHandler handler, string accountName, string password, string email)
|
||||
static bool HandleAccountCreateCommand(CommandHandler handler, string accountName, string password, OptionalArg<string> email)
|
||||
{
|
||||
if (accountName.Contains("@"))
|
||||
{
|
||||
@@ -95,7 +95,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
AccountOpResult result = Global.AccountMgr.CreateAccount(accountName, password, email);
|
||||
AccountOpResult result = Global.AccountMgr.CreateAccount(accountName, password, email.ValueOr(""));
|
||||
switch (result)
|
||||
{
|
||||
case AccountOpResult.Ok:
|
||||
|
||||
@@ -733,10 +733,10 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandNonGroup("help", RBACPermissions.CommandHelp, true)]
|
||||
static bool HandleHelpCommand(CommandHandler handler, string cmd)
|
||||
static bool HandleHelpCommand(CommandHandler handler, OptionalArg<string> cmd)
|
||||
{
|
||||
ChatCommandNode.SendCommandHelpFor(handler, cmd);
|
||||
if (cmd.IsEmpty())
|
||||
ChatCommandNode.SendCommandHelpFor(handler, cmd.ValueOr(""));
|
||||
if (!cmd.HasValue)
|
||||
ChatCommandNode.SendCommandHelpFor(handler, "help");
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user