updated to use the new config value to disable

This commit is contained in:
Madpeter 2020-05-06 17:34:59 +01:00
parent 321e3f67db
commit 06f0932862
2 changed files with 25 additions and 16 deletions

View file

@ -16,19 +16,23 @@ namespace BSB.Commands.Self
{ {
if (base.CallFunction(args) == true) if (base.CallFunction(args) == true)
{ {
if (UUID.TryParse(args[0], out UUID avataruuid) == true) if (bot.GetAllowFunds == true)
{ {
if (int.TryParse(args[1], out int amount) == true) if (UUID.TryParse(args[0], out UUID avataruuid) == true)
{ {
if (amount > 0) if (int.TryParse(args[1], out int amount) == true)
{ {
bot.GetClient.Self.GiveAvatarMoney(avataruuid, amount); if (amount > 0)
return true; {
bot.GetClient.Self.GiveAvatarMoney(avataruuid, amount);
return true;
}
} }
return Failed("Invaild amount");
} }
return Failed("Invaild amount"); return Failed("Invaild avatar UUID");
} }
return Failed("Invaild avatar UUID"); return Failed("Transfer funds to avatars disabled");
} }
return false; return false;
} }

View file

@ -14,25 +14,30 @@ namespace BSB.Commands.Self
public override string Helpfile { get { return "Makes the bot pay a object"; } } public override string Helpfile { get { return "Makes the bot pay a object"; } }
public override bool CallFunction(string[] args) public override bool CallFunction(string[] args)
{ {
if (base.CallFunction(args) == true) if (base.CallFunction(args) == true)
{ {
if (UUID.TryParse(args[0], out UUID objectuuid) == true) if (bot.GetAllowFunds == true)
{ {
if (int.TryParse(args[1], out int amount) == true) if (UUID.TryParse(args[0], out UUID objectuuid) == true)
{ {
if (amount > 0) if (int.TryParse(args[1], out int amount) == true)
{ {
if (args[2].Length > 0) if (amount > 0)
{ {
bot.GetClient.Self.GiveObjectMoney(objectuuid, amount, args[2]); if (args[2].Length > 0)
return true; {
bot.GetClient.Self.GiveObjectMoney(objectuuid, amount, args[2]);
return true;
}
return Failed("Invaild object name");
} }
return Failed("Invaild object name");
} }
return Failed("Invaild amount");
} }
return Failed("Invaild amount"); return Failed("Invaild object UUID");
} }
return Failed("Invaild object UUID"); return Failed("Transfer funds to objects disabled");
} }
return false; return false;
} }