From 06f0932862e0b897bc60436b6384e1bc883474eb Mon Sep 17 00:00:00 2001 From: Madpeter Date: Wed, 6 May 2020 17:34:59 +0100 Subject: [PATCH] updated to use the new config value to disable --- Core/Commands/Self/PayAvatar.cs | 18 +++++++++++------- Core/Commands/Self/PayObject.cs | 23 ++++++++++++++--------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Core/Commands/Self/PayAvatar.cs b/Core/Commands/Self/PayAvatar.cs index 2fb5062..d2b8427 100644 --- a/Core/Commands/Self/PayAvatar.cs +++ b/Core/Commands/Self/PayAvatar.cs @@ -16,19 +16,23 @@ namespace BSB.Commands.Self { 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); - return true; + if (amount > 0) + { + 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; } diff --git a/Core/Commands/Self/PayObject.cs b/Core/Commands/Self/PayObject.cs index 60f24e0..b86c0a2 100644 --- a/Core/Commands/Self/PayObject.cs +++ b/Core/Commands/Self/PayObject.cs @@ -14,25 +14,30 @@ namespace BSB.Commands.Self public override string Helpfile { get { return "Makes the bot pay a object"; } } public override bool CallFunction(string[] args) { + 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]); - return true; + if (args[2].Length > 0) + { + 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; }